< prev index next >

src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs


  71     private static final String DESCR_STRING = "Ljava/lang/String;";
  72     private static final String DESCR_OBJECT = "Ljava/lang/Object;";
  73     private static final String DESCR_CTOR_SERIALIZED_LAMBDA
  74             = "(" + DESCR_CLASS + DESCR_STRING + DESCR_STRING + DESCR_STRING + "I"
  75             + DESCR_STRING + DESCR_STRING + DESCR_STRING + DESCR_STRING + "[" + DESCR_OBJECT + ")V";
  76 
  77     private static final String DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION = "(Ljava/lang/String;)V";
  78     private static final String[] SER_HOSTILE_EXCEPTIONS = new String[] {NAME_NOT_SERIALIZABLE_EXCEPTION};
  79 
  80 
  81     private static final String[] EMPTY_STRING_ARRAY = new String[0];
  82 
  83     // Used to ensure that each spun class name is unique
  84     private static final AtomicInteger counter = new AtomicInteger(0);
  85 
  86     // For dumping generated classes to disk, for debugging purposes
  87     private static final ProxyClassesDumper dumper;
  88 
  89     static {
  90         final String key = "jdk.internal.lambda.dumpProxyClasses";
  91         String path = AccessController.doPrivileged(
  92                 new GetPropertyAction(key));
  93         dumper = (null == path) ? null : ProxyClassesDumper.getInstance(path);
  94     }
  95 
  96     // See context values in AbstractValidatingLambdaMetafactory
  97     private final String implMethodClassName;        // Name of type containing implementation "CC"
  98     private final String implMethodName;             // Name of implementation method "impl"
  99     private final String implMethodDesc;             // Type descriptor for implementation methods "(I)Ljava/lang/String;"
 100     private final Class<?> implMethodReturnClass;    // class for implementation method return type "Ljava/lang/String;"
 101     private final MethodType constructorType;        // Generated class constructor type "(CC)void"
 102     private final ClassWriter cw;                    // ASM class writer
 103     private final String[] argNames;                 // Generated names for the constructor arguments
 104     private final String[] argDescs;                 // Type descriptors for the constructor arguments
 105     private final String lambdaClassName;            // Generated name for the generated class "X$$Lambda$1"
 106 
 107     /**
 108      * General meta-factory constructor, supporting both standard cases and
 109      * allowing for uncommon options such as serialization or bridging.
 110      *
 111      * @param caller Stacked automatically by VM; represents a lookup context
 112      *               with the accessibility privileges of the caller.




  71     private static final String DESCR_STRING = "Ljava/lang/String;";
  72     private static final String DESCR_OBJECT = "Ljava/lang/Object;";
  73     private static final String DESCR_CTOR_SERIALIZED_LAMBDA
  74             = "(" + DESCR_CLASS + DESCR_STRING + DESCR_STRING + DESCR_STRING + "I"
  75             + DESCR_STRING + DESCR_STRING + DESCR_STRING + DESCR_STRING + "[" + DESCR_OBJECT + ")V";
  76 
  77     private static final String DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION = "(Ljava/lang/String;)V";
  78     private static final String[] SER_HOSTILE_EXCEPTIONS = new String[] {NAME_NOT_SERIALIZABLE_EXCEPTION};
  79 
  80 
  81     private static final String[] EMPTY_STRING_ARRAY = new String[0];
  82 
  83     // Used to ensure that each spun class name is unique
  84     private static final AtomicInteger counter = new AtomicInteger(0);
  85 
  86     // For dumping generated classes to disk, for debugging purposes
  87     private static final ProxyClassesDumper dumper;
  88 
  89     static {
  90         final String key = "jdk.internal.lambda.dumpProxyClasses";
  91         String path = GetPropertyAction.getProperty(key);

  92         dumper = (null == path) ? null : ProxyClassesDumper.getInstance(path);
  93     }
  94 
  95     // See context values in AbstractValidatingLambdaMetafactory
  96     private final String implMethodClassName;        // Name of type containing implementation "CC"
  97     private final String implMethodName;             // Name of implementation method "impl"
  98     private final String implMethodDesc;             // Type descriptor for implementation methods "(I)Ljava/lang/String;"
  99     private final Class<?> implMethodReturnClass;    // class for implementation method return type "Ljava/lang/String;"
 100     private final MethodType constructorType;        // Generated class constructor type "(CC)void"
 101     private final ClassWriter cw;                    // ASM class writer
 102     private final String[] argNames;                 // Generated names for the constructor arguments
 103     private final String[] argDescs;                 // Type descriptors for the constructor arguments
 104     private final String lambdaClassName;            // Generated name for the generated class "X$$Lambda$1"
 105 
 106     /**
 107      * General meta-factory constructor, supporting both standard cases and
 108      * allowing for uncommon options such as serialization or bridging.
 109      *
 110      * @param caller Stacked automatically by VM; represents a lookup context
 111      *               with the accessibility privileges of the caller.


< prev index next >