jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java
changeset 9780 6fc3b49cfee4
parent 9731 d0f7a3e441c4
child 10419 12c063b39232
equal deleted inserted replaced
9779:e3a8fbcb21fb 9780:6fc3b49cfee4
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package java.lang.invoke;
    26 package java.lang.invoke;
    27 
    27 
       
    28 import java.security.AccessController;
       
    29 import java.security.PrivilegedAction;
       
    30 
    28 /**
    31 /**
    29  * This class consists exclusively of static names internal to the
    32  * This class consists exclusively of static names internal to the
    30  * method handle implementation.
    33  * method handle implementation.
    31  * Usage:  {@code import static java.lang.invoke.MethodHandleStatics.*}
    34  * Usage:  {@code import static java.lang.invoke.MethodHandleStatics.*}
    32  * @author John Rose, JSR 292 EG
    35  * @author John Rose, JSR 292 EG
    33  */
    36  */
    34 /*non-public*/ class MethodHandleStatics {
    37 /*non-public*/ class MethodHandleStatics {
    35 
    38 
    36     private MethodHandleStatics() { }  // do not instantiate
    39     private MethodHandleStatics() { }  // do not instantiate
    37 
    40 
    38     static final boolean DEBUG_METHOD_HANDLE_NAMES = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
    41     static final boolean DEBUG_METHOD_HANDLE_NAMES;
       
    42     static {
       
    43         final Object[] values = { false };
       
    44         AccessController.doPrivileged(new PrivilegedAction<Void>() {
       
    45                 public Void run() {
       
    46                     values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
       
    47                     return null;
       
    48                 }
       
    49             });
       
    50         DEBUG_METHOD_HANDLE_NAMES = (Boolean) values[0];
       
    51     }
    39 
    52 
    40     /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
    53     /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
    41         if (type == null)
    54         if (type == null)
    42             type = target.type();
    55             type = target.type();
    43         MemberName name = null;
    56         MemberName name = null;