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

Add -Werror for javac #107

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Add -Werror for javac #107

wants to merge 13 commits into from

Conversation

nimakarimipour
Copy link
Member

@nimakarimipour nimakarimipour commented Dec 7, 2022

Low Priority

This PR adds -Werror javac flag to builds and gets rid of all existing warnings.

@msridhar @lazaroclapp this is low priority but just wanted to get rid of warnings 🙂.

Copy link
Member

@msridhar msridhar left a comment

Choose a reason for hiding this comment

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

couple questions

@@ -74,7 +74,7 @@ public Node addNodeToVertices(Fix fix) {
* in the same group. A greedy algorithm is used to find the solution.
*/
// TODO: Remove SuppressWarnings below later.
@SuppressWarnings("JdkObsolete")
@SuppressWarnings({"JdkObsolete", "unchecked"})
Copy link
Member

Choose a reason for hiding this comment

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

Why not just fix the error instead of suppressing?

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 didn't know how I can resolve the warning for creating array of LinkedLists. Since I was confident that there will be no problem with the code I just silenced it.

However, I just changed it to use List of Lists 6517fba, I don't think this will impact the performance. But if you think this will actually impact the performance, please let me know and I will undo this. Thank you.

Comment on lines +51 to +53
// just to prevent javac warnings, we currently pass "-Werror" as compiler arguments,
// all warnings must be resolved.
compileOnly deps.build.errorProneCoreOld
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this change

Copy link
Member Author

Choose a reason for hiding this comment

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

it seems once error prone is in the path we get the error below for compiling annotator-core:

warning: unknown enum constant SeverityLevel.SUGGESTION
  reason: class file for com.google.errorprone.BugPattern$SeverityLevel not found

Added a dependency to resolve this issue.

@@ -64,6 +64,7 @@ public Modification visit(NodeWithAnnotations<?> node, Range range) {
}

@Override
@SuppressWarnings("unchecked")
Copy link
Member

Choose a reason for hiding this comment

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

Again why suppress

Copy link
Member Author

Choose a reason for hiding this comment

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

@msridhar The only way to resolve this warning is to change the json dependency to org.json from com.googlecode.json-simple:json-simple since it is compiled with a very old javac (the latest release is for 2012). I am definitely interested in updating this dependency to use org.json but that will include a lot of changes which makes this PR pretty large. Should I do it in a follow up PR with an issue for now to track it ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just created a followup PR that removes the added @SuppressWarnings in this PR and all existing ones by changing dependency to org.json. #123.

@nimakarimipour
Copy link
Member Author

@msridhar Thank you for the review, this is ready for another round.

@nimakarimipour nimakarimipour added the refactoring/simplification Refactoring Simplification label Jan 2, 2023
@nimakarimipour nimakarimipour added the low priority Low priority task label Feb 17, 2023
@msridhar
Copy link
Member

msridhar commented Dec 5, 2023

@nimakarimipour do you still need a review on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low priority Low priority task refactoring/simplification Refactoring Simplification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants