コード例 #1
0
 Handle getLambdaAccessMethod(Handle implMethod) {
   if (!implMethod.getOwner().equals(className)) {
     return implMethod;
   }
   if (Flags.hasFlag(classAccess, ACC_INTERFACE)) {
     // the method will be relocated to a companion class
     return implMethod;
   }
   // TODO: do not generate an access method if the impl method is not private (probably not
   // implementable with a single pass)
   String name = "access$lambda$" + lambdaAccessToImplMethods.size();
   String desc = getLambdaAccessMethodDesc(implMethod);
   Handle accessMethod = new Handle(H_INVOKESTATIC, className, name, desc);
   lambdaAccessToImplMethods.put(accessMethod, implMethod);
   return accessMethod;
 }
コード例 #2
0
 @Override
 public void visitEnd() {
   for (Map.Entry<Handle, Handle> entry : lambdaAccessToImplMethods.entrySet()) {
     Handle accessMethod = entry.getKey();
     Handle implMethod = entry.getValue();
     Bytecode.generateDelegateMethod(cv, ACC_STATIC | ACC_SYNTHETIC, accessMethod, implMethod);
   }
   super.visitEnd();
 }