@@ -53,9 +53,7 @@ private static Handle getHandle(final Method method) {
5353 private static String getDescriptor (final Type ret , final Type ... params ) {
5454 final StringBuilder builder = new StringBuilder ();
5555 builder .append ("(" );
56- for (Type type : params ) {
57- builder .append (type .descriptorString ());
58- }
56+ for (final Type type : params ) builder .append (type .descriptorString ());
5957 builder
6058 .append (")" )
6159 .append (ret .descriptorString ());
@@ -66,19 +64,17 @@ private static String getDescriptor(final Type ret, final Type... params) {
6664 Gets the handle for a regular method, used for writing a dynamic call-site.
6765 """ )
6866 public static Handle getBootstrap (final boolean isDynamic , final boolean isPrivate ) {
67+ final String target ;
68+ if (isPrivate ) target = isDynamic ? "bootstrapPrivateDynamic" : "bootstrapPrivate" ;
69+ else target = isDynamic ? "bootstrapDynamic" : "bootstrap" ;
70+ final Class <?>[] array = new Class [] {MethodHandles .Lookup .class , String .class , MethodType .class , Class .class };
71+ final Method method ;
6972 try {
70- if (isPrivate ) {
71- if (isDynamic )
72- return getHandle (Bootstrapper .class .getMethod ("bootstrapPrivateDynamic" , MethodHandles .Lookup .class , String .class , MethodType .class , Class .class ));
73- return getHandle (Bootstrapper .class .getMethod ("bootstrapPrivate" , MethodHandles .Lookup .class , String .class , MethodType .class , Class .class ));
74- } else {
75- if (isDynamic )
76- return getHandle (Bootstrapper .class .getMethod ("bootstrapDynamic" , MethodHandles .Lookup .class , String .class , MethodType .class , Class .class ));
77- return getHandle (Bootstrapper .class .getMethod ("bootstrap" , MethodHandles .Lookup .class , String .class , MethodType .class , Class .class ));
78- }
73+ method = Bootstrapper .class .getMethod (target , array );
7974 } catch (Throwable ex ) {
8075 throw new ScriptBootstrapError (ex );
8176 }
77+ return Bootstrapper .getHandle (method );
8278 }
8379
8480 @ Description ("""
@@ -90,9 +86,7 @@ public static CallSite bootstrapFunction(MethodHandles.Lookup caller, String nam
9086 throws Exception {
9187 final org .objectweb .asm .Type [] types = org .objectweb .asm .Type .getArgumentTypes (args );
9288 final Class <?>[] arguments = new Class [types .length ];
93- for (int i = 0 ; i < types .length ; i ++) {
94- arguments [i ] = getClass (types [i ].getClassName ());
95- }
89+ for (int i = 0 ; i < types .length ; i ++) arguments [i ] = getClass (types [i ].getClassName ());
9690 return Metafactory .createBridge (caller , name , type , source , owner , arguments );
9791 }
9892
0 commit comments