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

feat: generic parsing interface and parsing of JavaPP annotations #134

Merged
merged 27 commits into from
Mar 5, 2024

Conversation

AlexanderSchultheiss
Copy link
Member

Description

The ArgoUML-SPL has been build using the Java Preprocessor library which mimics the conditional compilation of the C preprocessor. Due to JavaPP using a slightly different Syntax and being hidden behind line comments, we cannot simply apply our current parsing pipeline to ArgoUML.

This pull request pull up the necessary interfaced of our existing parsing pipeline to allow for different parser implementations. Additionally, it includes a parser for JavaPP.

Notes

I have integrated this version of DiffDetective in VEVOS and I was able to extract a ground truth for ArgoUML. However, ArgoUML only has one commit in which the variability is edited and this commit appears to contain files with missing 'endif' statements, which causes errors to be reported.

@AlexanderSchultheiss
Copy link
Member Author

@pmbittner, for some reason, GitHub is not able to determine that some files have simply been renamed or moved and instead shows them as fully deleted and re-added. This might be a bit confusing.

@AlexanderSchultheiss
Copy link
Member Author

Have to fix Javadocs

@AlexanderSchultheiss
Copy link
Member Author

It seems that the nix build breaks because I incremented DiffDetective's version number. How can I update the build files accordingly?

Copy link
Member

@pmbittner pmbittner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AlexanderSchultheiss ,

these changes look great. Thank you! 😃 The documentation is awesome, too.

I have one major comment: Should we really include the heavy reformatting changes? The reformatting of JavaDoc (e.g., to a certain line width limit) look good to me but many files also have their indentation changed extensively. Next time, I perform some changes in IntelliJ, all the formatting will be reverted, yielding large commits again.

Is this some setting in NeoVim? It might be very hard to change the indentation retroactively, so I can live with the changes. Maybe we should add a style configuration (.editorconfig) to DiffDetective or so.

new TestCase("#ifdef \\U0001000", "__B_SLASH__U0001000"),
new TestCase("#if (defined(NAME) && (NAME >= 199905) && (NAME < 1991011)) || (NAME >= 300000) || defined(NAME)", "(DEFINED___LB__NAME__RB__&&(NAME__GEQ__199905)&&(NAME__LT__1991011))||(NAME__GEQ__300000)||DEFINED___LB__NAME__RB__"),
new TestCase("#if __has_warning(\"-Wa-warning\"_foo)",
"__HAS_WARNING___LB____QUOTE____SUB__Wa__SUB__warning__QUOTE_____foo__RB__")
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this reindentation necessary? Why should we use 8 spaces instead of 4 spaces now? (Next time I change something in IntelliJ, this styling will be reset and we have huge patches again. 😵 )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not used nvim because I was worried about my style being applied to reformat the entire codebase 🙈 . I only used IntelliJ which did this autoformatting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. Seems we have different settings then. I guess its time for a common .editorconfig then. I will open an issue soon then. You dont have to revert the indentation stuff. That is too cumbersome I guess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried formatting he file with your Intellij? I am using the default settings, because I only just installed it on my new Laptop. Perhaps something else in the implementation had changed since the last time it was formatted?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just formatted this block of TestCases in IntelliJ and the same formatting as you have was applied. Interesting...

@pmbittner pmbittner closed this Feb 21, 2024
@pmbittner pmbittner reopened this Feb 21, 2024
@pmbittner
Copy link
Member

sorry, hit the wrong button and closed by accident 😓

@ibbem
Copy link
Collaborator

ibbem commented Feb 21, 2024

You missed the version bump in seven other files. Please use something like rg -F "2.1.0" or grep -F "2.1.0" -R to find all version numbers next time. You can also automatically change these places using rg -F "2.1.0" --files-with-matches | xargs sed -i 's/2\.1\.0/2.2.0/g' after verifying that the matches are actually all version numbers.

@pmbittner Should I create an issue for making these files independent of the version number such that we have one canonical place for changing the version number (e.g., pom.xml).

@ibbem
Copy link
Collaborator

ibbem commented Feb 21, 2024

I am also a NeoVim user. In case you have problems with your setup I might be able to help you.

@AlexanderSchultheiss
Copy link
Member Author

You missed the version bump in seven other files. Please use something like rg -F "2.1.0" or grep -F "2.1.0" -R to find all version numbers next time. You can also automatically change these places using rg -F "2.1.0" --files-with-matches | xargs sed -i 's/2\.1\.0/2.2.0/g' after verifying that the matches are actually all version numbers.

@pmbittner Should I create an issue for making these files independent of the version number such that we have one canonical place for changing the version number (e.g., pom.xml).

Having to do this is not ideal. I searched for the version numbers, but I was unsure which ones I can change safely, because I am not familiar with nix and was not sure whether I would break stuff. I think that having only one place where the version number is specified would be great.

@AlexanderSchultheiss
Copy link
Member Author

I am also a NeoVim user. In case you have problems with your setup I might be able to help you.

I have not configured jdtls to use Intellij's style for auto-formatting. How have you integrated Intellij's style in your configuration?

@pmbittner
Copy link
Member

@pmbittner Should I create an issue for making these files independent of the version number such that we have one canonical place for changing the version number (e.g., pom.xml).

That is a good idea, given that also I missed this in my review (even though I incremented the version number correctly just two weeks ago).

@ibbem
Copy link
Collaborator

ibbem commented Mar 4, 2024

Sorry for the late answer, I totally forgot this.

I am also a NeoVim user. In case you have problems with your setup I might be able to help you.

I have not configured jdtls to use Intellij's style for auto-formatting. How have you integrated Intellij's style in your configuration?

No actually not. I will open an issue for creating an editor config or, if possible, start agreeing on a single formatter.

I also use jdtl, however I only format lines that I actually changed: The vim.lsp.buf.format action can also act on a visual selection, so I just select the code I edited and only reformat that particular chunk. It is probably possible to integrate this with Git somehow to only reformat changed lines but I haven't done this yet.

@pmbittner
Copy link
Member

Hi all,

thanks for opening an issue @ibbem . We can proceed to merge this PR for now and deal with indentation and formatting later. Thanks @AlexanderSchultheiss for all the improvements. :)

new TestCase("#ifdef \\U0001000", "__B_SLASH__U0001000"),
new TestCase("#if (defined(NAME) && (NAME >= 199905) && (NAME < 1991011)) || (NAME >= 300000) || defined(NAME)", "(DEFINED___LB__NAME__RB__&&(NAME__GEQ__199905)&&(NAME__LT__1991011))||(NAME__GEQ__300000)||DEFINED___LB__NAME__RB__"),
new TestCase("#if __has_warning(\"-Wa-warning\"_foo)",
"__HAS_WARNING___LB____QUOTE____SUB__Wa__SUB__warning__QUOTE_____foo__RB__")
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just formatted this block of TestCases in IntelliJ and the same formatting as you have was applied. Interesting...

@pmbittner pmbittner merged commit 6da27d2 into develop Mar 5, 2024
2 checks passed
@pmbittner pmbittner mentioned this pull request Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants