-
Notifications
You must be signed in to change notification settings - Fork 472
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
Optimize filterGenerics()
#748
Conversation
recaf-core/src/main/java/me/coley/recaf/parse/JavaParserHelper.java
Outdated
Show resolved
Hide resolved
@Col-E Hello, I created a new regular expression that should work for most situations so far. But maybe the expression is a little complicated, which will cause OOM when using the classes provided by jregex. This problem does not occur when using java.util.regex. I'm wondering if I should replace the jregex library. Should it be replaced by java.util.regex or RegExodus like the one used in 4x? What are the advantages of RegExodus? |
@Col-E Currently I only run the regular expressions here using |
@meiMingle I've added this test that fails with this PR: @Test
void dontRemoveGenericInString() {
String code = "String x = \"Foo<X>\";";
var res = filterGeneric(code);
assertEquals(code, res);
} The expression is here in a string and should not be filtered out; but it is. Do you think you can fix it ? |
@Jydett You are right, I thought about it for a while but didn't find a reliable way to handle this situation. |
I realize this may not be a good solution |
What's new
What's fixed
For the optimization of code like the following, code processed by the old filterGenerics method will cause it to be damaged, causing JavaParser to not parse correctly.
Then
Now