test/tools/javac/MethodParameters/ClassFileVisitor.java

changeset 1792
ec871c3e8337
parent 1791
e9855150c5b0
child 2137
a48d3b981083
     1.1 --- a/test/tools/javac/MethodParameters/ClassFileVisitor.java	Sat Jun 01 21:57:56 2013 +0100
     1.2 +++ b/test/tools/javac/MethodParameters/ClassFileVisitor.java	Sat Jun 01 22:09:18 2013 +0100
     1.3 @@ -21,10 +21,8 @@
     1.4   * questions.
     1.5   */
     1.6  
     1.7 +import java.io.*;
     1.8  import com.sun.tools.classfile.*;
     1.9 -import java.io.*;
    1.10 -import javax.lang.model.element.*;
    1.11 -import java.util.*;
    1.12  
    1.13  /**
    1.14   * The {@code ClassFileVisitor} reads a class file using the
    1.15 @@ -150,6 +148,7 @@
    1.16          public int mNumParams;
    1.17          public boolean mSynthetic;
    1.18          public boolean mIsConstructor;
    1.19 +        public boolean mIsBridge;
    1.20          public String prefix;
    1.21  
    1.22          void visitMethod(Method method, StringBuilder sb) throws Exception {
    1.23 @@ -162,6 +161,7 @@
    1.24              mSynthetic = method.access_flags.is(AccessFlags.ACC_SYNTHETIC);
    1.25              mIsConstructor = mName.equals("<init>");
    1.26              prefix = cname + "." + mName + "() - ";
    1.27 +            mIsBridge = method.access_flags.is(AccessFlags.ACC_BRIDGE);
    1.28  
    1.29              sb.append(cname).append(".").append(mName).append("(");
    1.30  
    1.31 @@ -320,6 +320,12 @@
    1.32              } else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) {
    1.33                  expect = "name";
    1.34                  allowMandated = true;
    1.35 +            } else if (mIsBridge) {
    1.36 +                allowSynthetic = true;
    1.37 +                /*  you can't expect an special name for bridges' parameters.
    1.38 +                 *  The name of the original parameters are now copied.
    1.39 +                 */
    1.40 +                expect = null;
    1.41              }
    1.42              if (mandated) sb.append("!");
    1.43              if (synthetic) sb.append("!!");

mercurial