-
Notifications
You must be signed in to change notification settings - Fork 5k
Add base property auto upgrades instrumentation support #24632
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
Conversation
bf8f6cb
to
94a9df3
Compare
…bilityCrossVersionSpec
…nd also do some other renaming
…rty and ConfigurableFileCollection
5bbb2a6
to
fc297cb
Compare
…ionSpec and remove Checkstyle from PropertyUpgradeInstrumentationRegistry
I have reviewed the current set of changes. My only concern is non-deterministic ordering in the processor. FYI, some tests for ordering have been added in e716082, but those might not be enough. Other than that, LGTM! |
subprojects/architecture-test/src/changes/archunit_store/internal-api-nullability.txt
Outdated
Show resolved
Hide resolved
subprojects/core/src/main/java/org/gradle/internal/classpath/InstrumentingTransformer.java
Show resolved
Hide resolved
...ts/core/src/main/java/org/gradle/internal/classpath/declarations/InterceptorDeclaration.java
Show resolved
Hide resolved
...ava/org/gradle/internal/classpath/declarations/stubs/ConfigurationCacheInterceptorsStub.java
Outdated
Show resolved
Hide resolved
.../java/org/gradle/internal/classpath/declarations/stubs/PropertyUpgradesInterceptorsStub.java
Outdated
Show resolved
Hide resolved
...ovy/org/gradle/integtests/AbstractPropertyUpgradesBinaryCompatibilityCrossVersionSpec.groovy
Show resolved
Hide resolved
...Test/groovy/org/gradle/integtests/PropertyUpgradesBinaryCompatibilityCrossVersionSpec.groovy
Outdated
Show resolved
Hide resolved
...-api/src/main/java/org/gradle/internal/instrumentation/api/annotations/UpgradedProperty.java
Outdated
Show resolved
Hide resolved
...-api/src/main/java/org/gradle/internal/instrumentation/api/annotations/UpgradedProperty.java
Show resolved
Hide resolved
...c/main/java/org/gradle/internal/instrumentation/api/annotations/VisitForInstrumentation.java
Show resolved
Hide resolved
f442a95
to
21dab8b
Compare
Class<?> generatedClass = Class.forName(className); | ||
Method callInterceptorsGetter = generatedClass.getDeclaredMethod("getCallInterceptors"); | ||
// Generated classes are not public and in the org.gradle.internal.classpath.generated package | ||
callInterceptorsGetter.setAccessible(true); |
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.
Would making the generated classes public turn out cleaner? Also, I would like to reference them from tests at some point.
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.
Yes, that will make it cleaner. So I can just make them public. And if we need to forbid package access in the future, we can move that method to some org.gradle.internal.classpath.generated.InterceptorFactory
class
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.
Classes are now public
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 don't think any changes are strictly necessary, but please take a look at the suggestions.
|
||
tasks.named<JavaCompile>("compileJava") { | ||
// Without this, javac will complain about unclaimed annotations | ||
options.compilerArgs.add("-Xlint:-processing") |
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.
❔ Which annotations does it complain about and why?
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.
Annotation
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.
Looks like the org.gradle.api.NonNullApi
. You get this kind of warning, that breaks the build since we have -Werror:
warning: No processor claimed any of these annotations: org.gradle.api.NonNullApi
error: warnings found and -Werror specified
1 error
1 warning
I guess we would need to try fix that at one point
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 annotation info to the comment
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.
If @alllex changed the default for non-nullable APIs, we could lose the annotation from our packages, and then this problem would go away.
So they can be accessed outside of the org.gradle.internal.classpath.generated package
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.
LGTM.
@bot-gradle test this |
I've triggered the following builds for you: |
@bot-gradle test and merge |
Your PR is queued. See the queue page for details. |
Cherry picks property upgrades instrumentation from #24005.
It adds an option to use:
in our code, that can be upgraded to a
Property<T>
.Currently it supports creating automatic interceptors, that means, that you can use:
and it will automatically generate interceptors for
Optionally, you can also set
originalType
, that can be useful especially for primitive types:will generate interceptors for:
Is base for: #24710.