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

Prevent extraction of superfluous block tokens by the Java language module #911

Merged
merged 7 commits into from
Feb 13, 2023

Conversation

tsaglam
Copy link
Member

@tsaglam tsaglam commented Feb 7, 2023

Adapts the Java language module to no longer extract the block tokens }INIT and INIT{. Begin and end tokens are still extracted for control structures such as if, else, and for. As a consequence, the following two source codes will produce the same tokens:

if(condition) {
    foo();
} else {
    bar():
}
if(condition)
    foo();
else
    bar():

I added two test cases to the Java language module for this behavior.

As the underlying changes in this PR affect the token extraction for Java code, the test cases needed to be adapted. As a few test files were now too short (fewer tokens --> matches below MMT) I also adapted some test resources. The E2E test values were also updated.

This PR addresses #373.

@tsaglam tsaglam changed the base branch from main to develop February 7, 2023 13:26
@tsaglam tsaglam added bug Issue/PR that involves a bug minor Minor issue/feature/contribution/change language PR / Issue deals (partly) with new and/or existing languages for JPlag labels Feb 7, 2023
@tsaglam tsaglam linked an issue Feb 7, 2023 that may be closed by this pull request
@tsaglam tsaglam requested a review from a team February 9, 2023 15:51
@sonarcloud
Copy link

sonarcloud bot commented Feb 10, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@tsaglam tsaglam marked this pull request as ready for review February 10, 2023 19:36
@sebinside sebinside requested review from sebinside and removed request for a team February 13, 2023 13:38
@tsaglam tsaglam merged commit e391448 into develop Feb 13, 2023
@tsaglam tsaglam deleted the java-block-token branch February 13, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue/PR that involves a bug language PR / Issue deals (partly) with new and/or existing languages for JPlag minor Minor issue/feature/contribution/change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing matches when using JPlag 3
2 participants