255 if (bsm_attr.bootstrap_method_specifiers.length != 1) { 256 fail("Bad number of method specifiers " + 257 "in BootstrapMethods attribute"); 258 return; 259 } 260 BootstrapMethods_attribute.BootstrapMethodSpecifier bsm_spec = 261 bsm_attr.bootstrap_method_specifiers[0]; 262 263 if (bsm_spec.bootstrap_arguments.length != MF_ARITY) { 264 fail("Bad number of static invokedynamic args " + 265 "in BootstrapMethod attribute"); 266 return; 267 } 268 269 CONSTANT_MethodHandle_info mh = 270 (CONSTANT_MethodHandle_info)cf.constant_pool.get(bsm_spec.bootstrap_arguments[1]); 271 272 boolean kindOK; 273 switch (mh.reference_kind) { 274 case REF_invokeStatic: kindOK = mk2.isStatic(); break; 275 case REF_invokeSpecial: kindOK = !mk2.isStatic(); break; 276 case REF_invokeInterface: kindOK = mk2.inInterface(); break; 277 default: 278 kindOK = false; 279 } 280 281 if (!kindOK) { 282 fail("Bad invoke kind in implementation method handle"); 283 return; 284 } 285 286 if (!mh.getCPRefInfo().getNameAndTypeInfo().getType().toString().equals(MH_SIG)) { 287 fail("Type mismatch in implementation method handle"); 288 return; 289 } 290 } catch (Exception e) { 291 e.printStackTrace(); 292 fail("error reading " + res.compilationInfo() + ": " + e); 293 } 294 } 295 296 String makeIndyType() { 297 StringBuilder buf = new StringBuilder(); 298 buf.append("("); 299 if (!mk2.isStatic()) { 300 buf.append("LTest;"); 301 } 302 buf.append(")Ljava/lang/Runnable;"); | 255 if (bsm_attr.bootstrap_method_specifiers.length != 1) { 256 fail("Bad number of method specifiers " + 257 "in BootstrapMethods attribute"); 258 return; 259 } 260 BootstrapMethods_attribute.BootstrapMethodSpecifier bsm_spec = 261 bsm_attr.bootstrap_method_specifiers[0]; 262 263 if (bsm_spec.bootstrap_arguments.length != MF_ARITY) { 264 fail("Bad number of static invokedynamic args " + 265 "in BootstrapMethod attribute"); 266 return; 267 } 268 269 CONSTANT_MethodHandle_info mh = 270 (CONSTANT_MethodHandle_info)cf.constant_pool.get(bsm_spec.bootstrap_arguments[1]); 271 272 boolean kindOK; 273 switch (mh.reference_kind) { 274 case REF_invokeStatic: kindOK = mk2.isStatic(); break; 275 case REF_invokeVirtual: kindOK = !mk2.isStatic() && !mk2.inInterface(); break; 276 case REF_invokeInterface: kindOK = mk2.inInterface(); break; 277 default: 278 kindOK = false; 279 } 280 281 if (!kindOK) { 282 fail("Bad invoke kind in implementation method handle: " + mh.reference_kind); 283 return; 284 } 285 286 if (!mh.getCPRefInfo().getNameAndTypeInfo().getType().toString().equals(MH_SIG)) { 287 fail("Type mismatch in implementation method handle"); 288 return; 289 } 290 } catch (Exception e) { 291 e.printStackTrace(); 292 fail("error reading " + res.compilationInfo() + ": " + e); 293 } 294 } 295 296 String makeIndyType() { 297 StringBuilder buf = new StringBuilder(); 298 buf.append("("); 299 if (!mk2.isStatic()) { 300 buf.append("LTest;"); 301 } 302 buf.append(")Ljava/lang/Runnable;"); |