-
Notifications
You must be signed in to change notification settings - Fork 100
Added recipe to remove @VisibleForTesting annotation when used from production code
#689
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
Added recipe to remove @VisibleForTesting annotation when used from production code
#689
Conversation
…roduction code
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
...nrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProductionTest.java
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
…accessed-from-production-code
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
.../openrewrite/java/testing/cleanup/RemoveVisibleForTestingAnnotationWhenUsedInProduction.java
Outdated
Show resolved
Hide resolved
| return target; | ||
| } | ||
| }; | ||
| return Preconditions.check(new IsLikelyNotTest().getVisitor(), visitor); |
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.
UseType<>() is not working here. It does work with the FQN, but not with "*.VisibleForTesting"
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.
That might be a limitation in openrewrite/rewrite; ideally we'd detect the use of that annotation on the type, especially when we include implicit usages, but it appears we do not for now. Could require a fix upstream, but not pressing for now.
@VisibleForTesting annotation when used from production code
…accessed-from-production-code
|
As discussed we're still seeing performance issues, likely because we're having to visit & determine the type of all references to classes, methods and fields to see if their target is annotated with Perhaps it'd be an option to expand |
What's changed?
Added recipe to remove @VisibleForTesting annotation when used from production code
What's your motivation?
@VisibleForTestingif variable is accessed from production code #224Anyone you would like to review specifically?
@jevanlingen
@Laurens-W
@greg-at-moderne