mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
6695379: Copy method annotations and parameter annotations to synthetic bridge methods
Reviewed-by: mcimadamore
This commit is contained in:
parent
0ace868fe4
commit
7ab7587227
7 changed files with 155 additions and 21 deletions
|
@ -21,10 +21,8 @@
|
|||
* questions.
|
||||
*/
|
||||
|
||||
import com.sun.tools.classfile.*;
|
||||
import java.io.*;
|
||||
import javax.lang.model.element.*;
|
||||
import java.util.*;
|
||||
import com.sun.tools.classfile.*;
|
||||
|
||||
/**
|
||||
* The {@code ClassFileVisitor} reads a class file using the
|
||||
|
@ -150,6 +148,7 @@ class ClassFileVisitor extends Tester.Visitor {
|
|||
public int mNumParams;
|
||||
public boolean mSynthetic;
|
||||
public boolean mIsConstructor;
|
||||
public boolean mIsBridge;
|
||||
public String prefix;
|
||||
|
||||
void visitMethod(Method method, StringBuilder sb) throws Exception {
|
||||
|
@ -162,6 +161,7 @@ class ClassFileVisitor extends Tester.Visitor {
|
|||
mSynthetic = method.access_flags.is(AccessFlags.ACC_SYNTHETIC);
|
||||
mIsConstructor = mName.equals("<init>");
|
||||
prefix = cname + "." + mName + "() - ";
|
||||
mIsBridge = method.access_flags.is(AccessFlags.ACC_BRIDGE);
|
||||
|
||||
sb.append(cname).append(".").append(mName).append("(");
|
||||
|
||||
|
@ -320,6 +320,12 @@ class ClassFileVisitor extends Tester.Visitor {
|
|||
} else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) {
|
||||
expect = "name";
|
||||
allowMandated = true;
|
||||
} else if (mIsBridge) {
|
||||
allowSynthetic = true;
|
||||
/* you can't expect an special name for bridges' parameters.
|
||||
* The name of the original parameters are now copied.
|
||||
*/
|
||||
expect = null;
|
||||
}
|
||||
if (mandated) sb.append("!");
|
||||
if (synthetic) sb.append("!!");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue