-
Notifications
You must be signed in to change notification settings - Fork 114
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
Don't infer package name from lex rule names. #414
Conversation
Fix jflex-de#104 Also, make ClassInfo immutable.
This will still fail if the string Test case: @Test
public void guessPackageAndClass_givenClass_package_in_rule() throws Exception {
String lex =
"\n"
+ "%%\n"
+ "\n"
+ "%public\n"
+ "%class Foo\n"
+ "\n"
+ "%apiprivate\n"
+ "%int\n"
+ "\n"
+ "%%\n"
+ "\n"
+ "package X { /* no action; */ }"
+ "\n"
+ "[^] { /* no action */ }\n";
assertThat(guessPackageAndClass(lex)).isEqualTo(new ClassInfo("Foo", null));
} The code should probably become more aware in which section it currently is, and scan for package name only up until the first |
You are absolutely right. There are 2 reasons why I dont' want to go for a proper fix:
In the end, there are only three robusts solutions:
|
I'll submit this for now. |
Yes, that's alright. I'll make a low-priority issue so I don't forget coming back to this once you've merged the Out/Option refactor. (I think I can fix this properly reasonably easily). |
Fix #104
Also, make ClassInfo immutable.