kennknowles commented on a change in pull request #15835:
URL: https://github.com/apache/beam/pull/15835#discussion_r742158390
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/util/ApiSurface.java
##########
@@ -712,11 +712,18 @@ private void addExposedTypes(Class<?> clazz, Class<?>
cause) {
private void addExposedTypes(Invokable<?, ?> invokable, Class<?> cause) {
addExposedTypes(invokable.getReturnType(), cause);
for (Annotation annotation : invokable.getAnnotations()) {
+ Class<? extends Annotation> annotationClass =
annotation.annotationType();
+ if (!Modifier.isPublic(annotationClass.getModifiers())) {
+ // Non-public annotations are invisible to Beam users. Example: Guava's
+ // ParametricNullness is package-private and exists to support Kotlin
platform
Review comment:
Interesting! Definitely relevant beyond Kotlin (for example
https://checkerframework.org/releases/0.9.7/doc/checkers/nullness/quals/PolyNull.html)
but your change is more general and obviously correct.
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/util/ApiSurface.java
##########
@@ -712,11 +712,18 @@ private void addExposedTypes(Class<?> clazz, Class<?>
cause) {
private void addExposedTypes(Invokable<?, ?> invokable, Class<?> cause) {
addExposedTypes(invokable.getReturnType(), cause);
for (Annotation annotation : invokable.getAnnotations()) {
+ Class<? extends Annotation> annotationClass =
annotation.annotationType();
+ if (!Modifier.isPublic(annotationClass.getModifiers())) {
+ // Non-public annotations are invisible to Beam users. Example: Guava's
+ // ParametricNullness is package-private and exists to support Kotlin
platform
Review comment:
Interesting! Definitely relevant beyond Kotlin (for example
https://checkerframework.org/releases/0.9.7/doc/checkers/nullness/quals/PolyNull.html)
but your change is more general and obviously correct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]