-
Notifications
You must be signed in to change notification settings - Fork 39
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
Introduce ErrorProneRuntimeClasspath
check
#882
Conversation
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
Looks good. All 44 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
Kudos, SonarCloud Quality Gate passed! |
Looks good. All 44 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
2e67804
to
1fa3951
Compare
1fa3951
to
2695c4d
Compare
2695c4d
to
9307a2e
Compare
I've started to resolve the conflicts here. Almost done; will finalize after some meetings. |
90f58c2
to
ec1ce7e
Compare
Rebased; the PR now targets |
Looks good. All 43 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
1 similar comment
Looks good. All 43 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
ec1ce7e
to
748b70f
Compare
Once again rebased and resolved a conflict. @rickie and @mohamedsamehsalah I suspect this'll start happening more ;) |
Looks good. All 43 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
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.
Nothing stands out for me
Is there a general rule to follow when determining if a class is available on run-time or not ?
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.
I added one more commit, in which I resorted a few things. The only place I didn't reorder is the listing in JUnitValueSource
, as there the existing order seems more intuitive.
Is there a general rule to follow when determining if a class is available on run-time or not ?
Thanks for reviewing @mohamedsamehsalah! I'm not sure about a "general rule", but we use this code to check whether a given class is "currently" on the classpath. That of course doesn't mean that a class will also be on the classpath when the code is executed at a later point in time. For example, we have a bunch of provided
dependencies that may not actually be "provided" by downstream users. That's why the ErrorProneRuntimeClasspath
check restricts itself to types that match the CLASSPATH_TYPES
regex: those are known to be dependencies of Error Prone, and thus ~guaranteed to be present. I've also added a comment making this more explicit :)
Looks good. All 43 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
...one-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneRuntimeClasspath.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.
Cool PR, sorry for delay in review :). 🚀
} | ||
|
||
@Override | ||
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { |
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.
Interesting, AFAIKT we always start with the two overrides, right?
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.
Indeed. Here I think the idea was to have two "groups" methods, one for each "direction", but I see now that this is not how it turned out. Will move 👍
*/ | ||
private static final Pattern CLASSPATH_TYPES = | ||
Pattern.compile( | ||
"com\\.google\\.common\\..*|com\\.google\\.errorprone\\.([^\\.]+(?<!TestHelper)(\\..*)?)|java\\..*"); |
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.
"com\\.google\\.common\\..*|com\\.google\\.errorprone\\.([^\\.]+(?<!TestHelper)(\\..*)?)|java\\..*"); | |
"com\\.google\\.common\\..*|com\\.google\\.errorprone\\.([^.]+(?<!TestHelper)(\\..*)?)|java\\..*"); |
Test passes without these 👀. Seems redundant.
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.
Added the commit as it can probably be improved. Other issue is not a blocker for me so already approving.
Looks good. All 43 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
Prefer "type-safe" type references were possible, but use string literals if the references type may not be available at runtime.
59bb665
to
1ce6800
Compare
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.
Rebased and added a commit.
Ideally we move this check, and some like it, to a separate Maven module, so that downstream users won't have to disable it. But that's something we can/should pick up separately.
} | ||
|
||
@Override | ||
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { |
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.
Indeed. Here I think the idea was to have two "groups" methods, one for each "direction", but I see now that this is not how it turned out. Will move 👍
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 2 New issues |
Looks good. All 43 mutations in this change were killed.
Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed. |
ErrorProneRuntimeClasspath
check
❗ This PR is on top of #881. ❗Suggested commit message:
The PR is split into three commits that can best be reviewed one-by-one: the check, its automated suggestions, and manual tweaks.