--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Mon Dec 18 18:51:40 2017 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Tue Dec 19 16:24:25 2017 -0500
@@ -1628,9 +1628,6 @@
/** The parameters of the method. */
public List<VarSymbol> params = null;
- /** The names of the parameters */
- public List<Name> savedParameterNames;
-
/** For an annotation type element, its default value if any.
* The value is null if none appeared in the method
* declaration.
@@ -1886,59 +1883,20 @@
public List<VarSymbol> params() {
owner.complete();
if (params == null) {
- // If ClassReader.saveParameterNames has been set true, then
- // savedParameterNames will be set to a list of names that
- // matches the types in type.getParameterTypes(). If any names
- // were not found in the class file, those names in the list will
- // be set to the empty name.
- // If ClassReader.saveParameterNames has been set false, then
- // savedParameterNames will be null.
- List<Name> paramNames = savedParameterNames;
- savedParameterNames = null;
- // discard the provided names if the list of names is the wrong size.
- if (paramNames == null || paramNames.size() != type.getParameterTypes().size()) {
- paramNames = List.nil();
- }
- ListBuffer<VarSymbol> buf = new ListBuffer<>();
- List<Name> remaining = paramNames;
- // assert: remaining and paramNames are both empty or both
- // have same cardinality as type.getParameterTypes()
+ ListBuffer<VarSymbol> newParams = new ListBuffer<>();
int i = 0;
for (Type t : type.getParameterTypes()) {
- Name paramName;
- if (remaining.isEmpty()) {
- // no names for any parameters available
- paramName = createArgName(i, paramNames);
- } else {
- paramName = remaining.head;
- remaining = remaining.tail;
- if (paramName.isEmpty()) {
- // no name for this specific parameter
- paramName = createArgName(i, paramNames);
- }
- }
- buf.append(new VarSymbol(PARAMETER, paramName, t, this));
- i++;
+ Name paramName = name.table.fromString("arg" + i);
+ VarSymbol param = new VarSymbol(PARAMETER, paramName, t, this);
+ newParams.append(param);
+
}
- params = buf.toList();
+ params = newParams.toList();
}
+ Assert.checkNonNull(params);
return params;
}
- // Create a name for the argument at position 'index' that is not in
- // the exclude list. In normal use, either no names will have been
- // provided, in which case the exclude list is empty, or all the names
- // will have been provided, in which case this method will not be called.
- private Name createArgName(int index, List<Name> exclude) {
- String prefix = "arg";
- while (true) {
- Name argName = name.table.fromString(prefix + index);
- if (!exclude.contains(argName))
- return argName;
- prefix += "$";
- }
- }
-
public Symbol asMemberOf(Type site, Types types) {
return new MethodSymbol(flags_field, name, types.memberType(site, this), owner);
}