-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix mapping stats not skipping anonymous classes #469
base: master
Are you sure you want to change the base?
Conversation
Adds indexing of inner & enclosing classes, since it's the only way to properly detect an anonymous class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to take some time to do a more indpeth review of this when im not tired.
enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/StatsDialog.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren't really improvements; many things this patch does is already accomplishable, and what it tries to do is at great costs for it's done wrong
import cuchaz.enigma.translation.representation.entry.ClassEntry; | ||
|
||
public class InnerClassIndex implements JarIndexer { | ||
private Multimap<ClassDefEntry, InnerClassData> innerClasses = ArrayListMultimap.create(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This thing is wrong; we don't want to record one map entry for every MethodHandles.Lookup
reference. To check if a class is an anonymous class, simply check its EnclosingMethods
https://docs.oracle.com/javase/specs/jvms/se19/html/jvms-4.html#jvms-4.7.7 which asm somehow calls "OuterClass" and describes it incorrectly
} | ||
} | ||
|
||
record OuterClassData(String owner, String name, String descriptor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These names are wrong names from ASM, should've been like EnclosingMethodData
. Also hasEnclosingMethod
is wrong too; it returns that whether the given class is enclosed in a regular method instead of <init>
or <clinit>
(read the italics in https://docs.oracle.com/javase/specs/jvms/se19/html/jvms-4.html#jvms-4.7.7)
This reverts commit f992016.
I'm going to commit the filtering of packages in a separate PR |
Taken from
QuiltMC/enigma@a1892c0 andQuiltMC/enigma@fbd2753.