@@ -124,14 +124,14 @@ func JavaFilePath(f pgs.File, ctx pgsgo.Context, tpl *template.Template) *pgs.Fi
124
124
return nil
125
125
}
126
126
127
- fullPath := strings .Replace (javaPackage (f ), "." , string (os .PathSeparator ), - 1 )
127
+ fullPath := strings .ReplaceAll (javaPackage (f ), "." , string (os .PathSeparator ))
128
128
fileName := classNameFile (f ) + "Validator.java"
129
129
filePath := pgs .JoinPaths (fullPath , fileName )
130
130
return & filePath
131
131
}
132
132
133
133
func JavaMultiFilePath (f pgs.File , m pgs.Message ) pgs.FilePath {
134
- fullPath := strings .Replace (javaPackage (f ), "." , string (os .PathSeparator ), - 1 )
134
+ fullPath := strings .ReplaceAll (javaPackage (f ), "." , string (os .PathSeparator ))
135
135
fileName := classNameMessage (m ) + "Validator.java"
136
136
filePath := pgs .JoinPaths (fullPath , fileName )
137
137
return filePath
@@ -167,9 +167,9 @@ func classNameMessage(m pgs.Message) string {
167
167
// When multiple files is false, underscores are stripped. Short of rewriting all the name sanitization
168
168
// logic for java, using "UnderscoreUnderscoreUnderscore" is an escape sequence seems to work with an extremely
169
169
// small likelihood of name conflict.
170
- className = strings .Replace (className , "_" , "UnderscoreUnderscoreUnderscore" , - 1 )
170
+ className = strings .ReplaceAll (className , "_" , "UnderscoreUnderscoreUnderscore" )
171
171
className = sanitizeClassName (className )
172
- className = strings .Replace (className , "UnderscoreUnderscoreUnderscore" , "_" , - 1 )
172
+ className = strings .ReplaceAll (className , "UnderscoreUnderscoreUnderscore" , "_" )
173
173
return className
174
174
}
175
175
@@ -442,10 +442,10 @@ func (fns javaFuncs) javaTypeLiteralSuffixForPrototype(t pgs.ProtoType) string {
442
442
func (fns javaFuncs ) javaStringEscape (s string ) string {
443
443
s = fmt .Sprintf ("%q" , s )
444
444
s = s [1 : len (s )- 1 ]
445
- s = strings .Replace (s , `\u00` , `\x` , - 1 )
446
- s = strings .Replace (s , `\x` , `\\x` , - 1 )
447
- // s = strings.Replace (s, `\`, `\\`, -1 )
448
- s = strings .Replace (s , `"` , `\"` , - 1 )
445
+ s = strings .ReplaceAll (s , `\u00` , `\x` )
446
+ s = strings .ReplaceAll (s , `\x` , `\\x` )
447
+ // s = strings.ReplaceAll (s, `\`, `\\`)
448
+ s = strings .ReplaceAll (s , `"` , `\"` )
449
449
return `"` + s + `"`
450
450
}
451
451
0 commit comments