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

Mark methods generatred by ASM transformations as synthetic #30680

Merged
merged 2 commits into from
Jan 30, 2023
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 @@ -201,7 +201,8 @@ public ClassVisitor apply(String className, ClassVisitor classVisitor) {
public void visit(int version, int access, String name, String signature, String superName,
String[] interfaces) {
super.visit(version, access, name, signature, superName, interfaces);
MethodVisitor ctor = visitMethod(Modifier.PUBLIC, "<init>", "()V", null,
MethodVisitor ctor = visitMethod(Modifier.PUBLIC | Opcodes.ACC_SYNTHETIC, "<init>", "()V",
null,
null);
ctor.visitCode();
ctor.visitVarInsn(Opcodes.ALOAD, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ public void visit(int version, int access, String name, String signature,
String superName,
String[] interfaces) {
super.visit(version, access, name, signature, superName, interfaces);
MethodVisitor mv = visitMethod(Modifier.PUBLIC, Methods.INIT, "()V", null,
MethodVisitor mv = visitMethod(Modifier.PUBLIC | Opcodes.ACC_SYNTHETIC, Methods.INIT, "()V", null,
null);
mv.visitCode();
mv.visitVarInsn(Opcodes.ALOAD, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public FieldVisitor visitField(int access, String name, String descriptor, Strin

@Override
public void visitEnd() {
MethodVisitor injectMethod = visitMethod(Opcodes.ACC_PUBLIC, INJECT_METHOD_NAME, INJECT_METHOD_DESCRIPTOR, null,
MethodVisitor injectMethod = visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, INJECT_METHOD_NAME,
INJECT_METHOD_DESCRIPTOR, null,
null);
injectMethod.visitParameter("ctx", 0 /* modifiers */);
injectMethod.visitCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ public void visitEnd() {
public void visitEnd() {
// FIXME: handle setters
// FIXME: handle multi fields
MethodVisitor injectMethod = visitMethod(Opcodes.ACC_PUBLIC, INJECT_METHOD_NAME, INJECT_METHOD_DESCRIPTOR, null,
MethodVisitor injectMethod = visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, INJECT_METHOD_NAME,
INJECT_METHOD_DESCRIPTOR, null,
null);
injectMethod.visitParameter("ctx", 0 /* modifiers */);
injectMethod.visitCode();
Expand Down Expand Up @@ -333,7 +334,7 @@ public void visitEnd() {

if (!seenClassInit && !partTypes.isEmpty()) {
// add a class init method for the part types special fields
MethodVisitor mv = super.visitMethod(Opcodes.ACC_STATIC, "<clinit>", "()V", null, null);
MethodVisitor mv = super.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, "<clinit>", "()V", null, null);
for (Entry<FieldInfo, ServerIndexedParameter> entry : partTypes.entrySet()) {
generateMultipartFormStaticInit(mv, entry.getKey(), entry.getValue());
}
Expand Down