8143133: Wrong MethodParameters on capturing local class with multiple constructors

MethodParameters attribute not always generated for local classes constructors

Reviewed-by: jlahoda
This commit is contained in:
Maurizio Cimadamore 2015-12-14 13:55:35 +00:00
parent ec26043caf
commit de127a784a
5 changed files with 52 additions and 12 deletions

View file

@ -279,7 +279,7 @@ class ClassFileVisitor extends Tester.Visitor {
userParam = param;
}
}
if (expect != null && !param.equals(expect)) {
if (check > 0 && expect != null && !param.equals(expect)) {
error(prefix + "param[" + x + "]='"
+ param + "' expected '" + expect + "'");
return null;
@ -346,6 +346,17 @@ class ClassFileVisitor extends Tester.Visitor {
}
}
}
if (synthetic && !mandated && !allowSynthetic) {
//patch treatment for local captures
if (isAnon || (isInner & !isStatic)) {
expect = "val\\$.*";
allowSynthetic = true;
if (isFinal) {
expect = "final val\\$.*";
}
}
}
} else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) {
expect = "name";
allowMandated = true;
@ -411,7 +422,6 @@ class ClassFileVisitor extends Tester.Visitor {
if (mSynthetic) {
return 0;
}
// Otherwise, do check test parameter naming convention.
return 1;
}