Skip to content

Remove LambdaForm$Hidden annotation from emitted code #118

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private byte[] transform(String className, Consumer<ClassVisitor> reader, ClassV
if (targetVersion < Opcodes.V1_7) {
next = new SwallowSuppressedExceptions(next);
next = new RemoveMethodHandlesLookupReferences(next);
next = new RemoveLambdaHiddenReferences(next);
next = new RequireNonNull(next);
}
next = new FixInvokeStaticOnInterfaceMethod(next);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright © 2013-2016 Esko Luontola and other Retrolambda contributors
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package net.orfjackal.retrolambda.lambdas;

import org.objectweb.asm.*;

import static org.objectweb.asm.Opcodes.ASM5;

public class RemoveLambdaHiddenReferences extends ClassVisitor {

private static final String LAMBDA_FORM_HIDDEN_NAME = "Ljava/lang/invoke/LambdaForm$Hidden;";

public RemoveLambdaHiddenReferences(ClassVisitor next) {
super(ASM5, next);
}

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return new MethodVisitor(ASM5, super.visitMethod(access, name, desc, signature, exceptions)) {
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
if (LAMBDA_FORM_HIDDEN_NAME.equals(desc)) {
return null;
}
return super.visitAnnotation(desc, visible);
}
};
}
}