Fixed
Status Update
Comments
tr...@google.com <tr...@google.com>
al...@google.com <al...@google.com> #2
I don't think I'll be able to change it from a single Class to a vararg or array, but I might be able to change it to a single Class followed by a default null array. Not ideal, but at least it doesn't require a 2.0.
tr...@google.com <tr...@google.com> #3
Whatever works to allow for multiple experimental classes.
Is it considered a breaking change to add a default value to markerClass? Could you do something like this:
public @interface UseExperimental {
Class<?> markerClass() default void.class;
Class<?>[] value() default {};
}
Then @UseExperimental could be used like:
@UseExperimental(markerClass = MyExperimental.class)
or
@UseExperimental(MyExperimental.class)
or
@UseExperimental({MyExperimental.class, MyOtherExperimental.class})
It would also be ok (but a little weird) to use it like:
@UseExperimental(markerClass = MyExperimental.class, value = {MyOtherExperimental.class})
Is it considered a breaking change to add a default value to markerClass? Could you do something like this:
public @interface UseExperimental {
Class<?> markerClass() default void.class;
Class<?>[] value() default {};
}
Then @UseExperimental could be used like:
@UseExperimental(markerClass = MyExperimental.class)
or
@UseExperimental(MyExperimental.class)
or
@UseExperimental({MyExperimental.class, MyOtherExperimental.class})
It would also be ok (but a little weird) to use it like:
@UseExperimental(markerClass = MyExperimental.class, value = {MyOtherExperimental.class})
al...@google.com <al...@google.com> #4
That should work --
al...@google.com <al...@google.com>
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 07ff9477a2fd998662ebb11447b3a5291a6fd087
Author: Alan Viverette <alanv@google.com>
Date: Mon Dec 09 17:17:14 2019
Add support for multiple marker classes by migrating to Kotlin
Fixes: 145137892
Test: ExperimentalDetectorTest
Change-Id: I762a525bfc1e78aac4fa6458daa979b2fb3800e1
A annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/ExperimentalLocation.java
A annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/ExperimentalLocationKt.kt
A annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/LocationProvider.java
A annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/LocationProviderKt.kt
M annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/UseJavaExperimentalFromJava.java
M annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/UseJavaExperimentalFromKt.kt
M annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/UseJavaPackageFromKt.kt
M annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/UseKtExperimentalFromJava.java
M annotation/annotation-experimental-lint/src/main/java/androidx/annotation/experimental/lint/ExperimentalDetector.kt
M annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/ExperimentalDetectorTest.kt
A annotation/annotation-experimental/api/1.1.0-alpha01.ignore
M annotation/annotation-experimental/api/1.1.0-alpha01.txt
A annotation/annotation-experimental/api/api_lint.ignore
M annotation/annotation-experimental/api/current.txt
M annotation/annotation-experimental/api/public_plus_experimental_1.1.0-alpha01.txt
M annotation/annotation-experimental/api/public_plus_experimental_current.txt
A annotation/annotation-experimental/api/restricted_1.1.0-alpha01.ignore
M annotation/annotation-experimental/api/restricted_1.1.0-alpha01.txt
M annotation/annotation-experimental/api/restricted_current.txt
M annotation/annotation-experimental/build.gradle
M annotation/annotation-experimental/src/main/java/androidx/annotation/experimental/Experimental.kt
D annotation/annotation-experimental/src/main/java/androidx/annotation/experimental/UseExperimental.java
A annotation/annotation-experimental/src/main/java/androidx/annotation/experimental/UseExperimental.kt
https://android-review.googlesource.com/1185577
Branch: androidx-master-dev
commit 07ff9477a2fd998662ebb11447b3a5291a6fd087
Author: Alan Viverette <alanv@google.com>
Date: Mon Dec 09 17:17:14 2019
Add support for multiple marker classes by migrating to Kotlin
Fixes: 145137892
Test: ExperimentalDetectorTest
Change-Id: I762a525bfc1e78aac4fa6458daa979b2fb3800e1
A annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/ExperimentalLocation.java
A annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/ExperimentalLocationKt.kt
A annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/LocationProvider.java
A annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/LocationProviderKt.kt
M annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/UseJavaExperimentalFromJava.java
M annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/UseJavaExperimentalFromKt.kt
M annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/UseJavaPackageFromKt.kt
M annotation/annotation-experimental-lint/integration-tests/src/main/java/sample/UseKtExperimentalFromJava.java
M annotation/annotation-experimental-lint/src/main/java/androidx/annotation/experimental/lint/ExperimentalDetector.kt
M annotation/annotation-experimental-lint/src/test/kotlin/androidx/annotation/experimental/lint/ExperimentalDetectorTest.kt
A annotation/annotation-experimental/api/1.1.0-alpha01.ignore
M annotation/annotation-experimental/api/1.1.0-alpha01.txt
A annotation/annotation-experimental/api/api_lint.ignore
M annotation/annotation-experimental/api/current.txt
M annotation/annotation-experimental/api/public_plus_experimental_1.1.0-alpha01.txt
M annotation/annotation-experimental/api/public_plus_experimental_current.txt
A annotation/annotation-experimental/api/restricted_1.1.0-alpha01.ignore
M annotation/annotation-experimental/api/restricted_1.1.0-alpha01.txt
M annotation/annotation-experimental/api/restricted_current.txt
M annotation/annotation-experimental/build.gradle
M annotation/annotation-experimental/src/main/java/androidx/annotation/experimental/Experimental.kt
D annotation/annotation-experimental/src/main/java/androidx/annotation/experimental/UseExperimental.java
A annotation/annotation-experimental/src/main/java/androidx/annotation/experimental/UseExperimental.kt
Description
By comparison, the kotlin UseExperimental annotation takes a vararg markerClass argument which allows for multiple experimental APIs in the same scope.