@@ -236,11 +236,18 @@ && stringContainsComments(state.getSourceForNode(tree), state.context)) {
236236 }
237237
238238 for (int i = 0 ; i < varNames .size (); i ++) {
239+ String varName = varNames .get (i );
240+
241+ // If the parameter names are missing (b/365094947), don't perform the inlining.
242+ if (varName .matches ("arg[0-9]+" )) {
243+ return Description .NO_MATCH ;
244+ }
245+
239246 // The replacement logic below assumes the existence of another token after the parameter
240247 // in the replacement string (ex: a trailing parens, comma, dot, etc.). However, in the case
241248 // where the replacement is _just_ one parameter, there isn't a trailing token. We just make
242249 // the direct replacement here.
243- if (replacement .equals (varNames . get ( i ) )) {
250+ if (replacement .equals (varName )) {
244251 replacement = callingVars .get (i );
245252 break ;
246253 }
@@ -252,7 +259,7 @@ && stringContainsComments(state.getSourceForNode(tree), state.context)) {
252259 String capturePrefixForVarargs = terminalVarargsReplacement ? "(?:,\\ s*)?" : "\\ b" ;
253260 // We want to avoid replacing a method invocation with the same name as the method.
254261 var extractArgAndNextToken =
255- Pattern .compile (capturePrefixForVarargs + Pattern .quote (varNames . get ( i ) ) + "\\ b([^(])" );
262+ Pattern .compile (capturePrefixForVarargs + Pattern .quote (varName ) + "\\ b([^(])" );
256263 String replacementResult =
257264 Matcher .quoteReplacement (terminalVarargsReplacement ? "" : callingVars .get (i )) + "$1" ;
258265 Matcher matcher = extractArgAndNextToken .matcher (replacement );
0 commit comments