Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

InnerClassLambdaMetafactory fix of hidden classes handling #52

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
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
@@ -31,13 +31,10 @@
import java.lang.constant.*;
import java.lang.reflect.code.op.CoreOps.*;

import java.io.File;
import java.io.FileOutputStream;
import java.lang.classfile.ClassBuilder;
import java.lang.classfile.Opcode;
import java.lang.classfile.TypeKind;
import java.lang.classfile.attribute.ConstantValueAttribute;
import java.lang.classfile.components.ClassPrinter;
import java.lang.invoke.LambdaMetafactory;
import java.lang.reflect.code.Block;
import java.lang.reflect.code.op.CoreOps;
@@ -94,24 +91,11 @@ public final class BytecodeGenerator {
public static <O extends Op & Op.Invokable> MethodHandle generate(MethodHandles.Lookup l, O iop) {
String name = iop instanceof FuncOp fop ? fop.funcName() : "m";
byte[] classBytes = generateClassData(l, name, iop);
// ClassPrinter.toYaml(ClassFile.of().parse(classBytes), ClassPrinter.Verbosity.TRACE_ALL, System.out::print);

{
try {
File f = new File("f.class");
try (FileOutputStream fos = new FileOutputStream(f)) {
fos.write(classBytes);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}

MethodHandles.Lookup hcl;
try {
hcl = l.defineHiddenClass(classBytes, true);
} catch (IllegalAccessException e) {
e.printStackTrace();
throw new RuntimeException(e);
}