< prev index next >

test/jdk/java/lang/invoke/accessProtectedSuper/Test.java

Print this page
rev 52456 : imported patch asm.additional


  37 import jdk.internal.org.objectweb.asm.ClassWriter;
  38 import jdk.internal.org.objectweb.asm.MethodVisitor;
  39 import jdk.internal.org.objectweb.asm.ClassVisitor;
  40 import jdk.internal.org.objectweb.asm.Opcodes;
  41 
  42 interface MyFunctionalInterface {
  43 
  44     void invokeMethodReference();
  45 }
  46 
  47 class MakeProtected implements BogoLoader.VisitorMaker, Opcodes {
  48 
  49     final boolean whenVisitInner;
  50 
  51     MakeProtected(boolean when_visit_inner) {
  52         super();
  53         whenVisitInner = when_visit_inner;
  54     }
  55 
  56     public ClassVisitor make(ClassVisitor cv) {
  57         return new ClassVisitor(Opcodes.ASM5, cv) {
  58 
  59             @Override
  60             public void visitInnerClass(String name, String outerName,
  61                     String innerName, int access) {
  62                 if (whenVisitInner) {
  63                     int access_ = (ACC_PROTECTED | access) & ~(ACC_PRIVATE | ACC_PUBLIC);
  64                     System.out.println("visitInnerClass: name = " + name
  65                             + ", outerName = " + outerName
  66                             + ", innerName = " + innerName
  67                             + ", access original = 0x" + Integer.toHexString(access)
  68                             + ", access modified to 0x" + Integer.toHexString(access_));
  69                     access = access_;
  70                 }
  71                 super.visitInnerClass(name, outerName, innerName, access);
  72             }
  73         };
  74     }
  75 };
  76 
  77 public class Test {




  37 import jdk.internal.org.objectweb.asm.ClassWriter;
  38 import jdk.internal.org.objectweb.asm.MethodVisitor;
  39 import jdk.internal.org.objectweb.asm.ClassVisitor;
  40 import jdk.internal.org.objectweb.asm.Opcodes;
  41 
  42 interface MyFunctionalInterface {
  43 
  44     void invokeMethodReference();
  45 }
  46 
  47 class MakeProtected implements BogoLoader.VisitorMaker, Opcodes {
  48 
  49     final boolean whenVisitInner;
  50 
  51     MakeProtected(boolean when_visit_inner) {
  52         super();
  53         whenVisitInner = when_visit_inner;
  54     }
  55 
  56     public ClassVisitor make(ClassVisitor cv) {
  57         return new ClassVisitor(Opcodes.ASM7, cv) {
  58 
  59             @Override
  60             public void visitInnerClass(String name, String outerName,
  61                     String innerName, int access) {
  62                 if (whenVisitInner) {
  63                     int access_ = (ACC_PROTECTED | access) & ~(ACC_PRIVATE | ACC_PUBLIC);
  64                     System.out.println("visitInnerClass: name = " + name
  65                             + ", outerName = " + outerName
  66                             + ", innerName = " + innerName
  67                             + ", access original = 0x" + Integer.toHexString(access)
  68                             + ", access modified to 0x" + Integer.toHexString(access_));
  69                     access = access_;
  70                 }
  71                 super.visitInnerClass(name, outerName, innerName, access);
  72             }
  73         };
  74     }
  75 };
  76 
  77 public class Test {


< prev index next >