-
Notifications
You must be signed in to change notification settings - Fork 334
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
Add token string normalization #1007
Conversation
# Conflicts: # languages/java/src/main/java/de/jplag/java/TokenGeneratingTreeScanner.java
# Conflicts: # languages/java/src/main/java/de/jplag/java/TokenGeneratingTreeScanner.java
This reverts commit 3df89fc.
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.
Some further comments. Code in general lgtm
core/src/main/java/de/jplag/normalization/NormalizationGraphConstructor.java
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.
Looks good! Just one conflict to solve, @mbrdl, then I can merge.
# Conflicts: # languages/java/src/main/java/de/jplag/java/TokenGeneratingTreeScanner.java
Why did you revert the switch? f3f061e It should enforce that you have to define behavior for all enum values. (If you don't use default) |
But the default is doing nothing? I don't understand, maybe you could provide a code snippet to show me what you mean. I reverted the switch because Sonar didn't like it. |
I can do that later. The idea would be to use the new switch without default . Then you have to define all cases (therefore, it will cause a compile error if new enum values will be added) |
From my understanding, you only have to define all cases in a switch expression, not in a switch statement. switch (type) {
case VARIABLE_FLOW -> isVariableFlow = true;
case VARIABLE_REVERSE_FLOW -> isVariableReverseFlow = true;
} compiles just fine, even though more types exist. |
I have to check that. There was some kind of switch that enforced that all types are mentioned. As far as I remember. |
E.g., https://www.happycoders.eu/java/switch-expression/ -> Completeness Analysis |
But I've recognized in the case where I've marked the code, this does not make sense. So just ignore my initial comment there :) |
My problem was that I did not realized that you set two different variables based on the enum value. |
Now that I've turned in my thesis, I've decided to add some tests before the presentation on 5/5. Could be good to have them in this PR so we can see the coverage, on the other hand it would be nice to have this PR out of the way. What do you think @tsaglam |
@mbrdl both is fine with me, whatever you prefer goes. Merging this PR now has the benefit of avoiding conflicts when other PRs are merged. |
Kudos, SonarCloud Quality Gate passed! |
Test is here, ready to merge 👍 Coverage looking a lot better now 🙃 @tsaglam |
This adds the framework for token string normalization. It also generates semantic information and adds it to the tokens in the Java language module. This cannot be disabled. I couldn't measure a difference in runtime, however.