[ 
https://issues.apache.org/jira/browse/BEAM-10632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17171838#comment-17171838
 ] 

Brian Hulette commented on BEAM-10632:
--------------------------------------

The JDK bug I linked before says "When an annotation is put on a member but the 
annotation type is missing on the class path, the specification requires the 
runtime to ignore this annotation, i.e. to act as if the annotation is not 
present."

So it looks like the behavior I observed where the @Nullable is ignored is 
intended behavior. I think the NPE case is due to some additional annotation 
added when checker framework runs. The NPE occurs in a module that runs checker 
framework even if there aren't any @Nullable fields.

> checkerframework @Nullable annotation causes NPE when used with Schema 
> Inference
> --------------------------------------------------------------------------------
>
>                 Key: BEAM-10632
>                 URL: https://issues.apache.org/jira/browse/BEAM-10632
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>            Reporter: Brian Hulette
>            Priority: P2
>
> {code:java}
> Caused by: java.lang.NullPointerException
>       at 
> sun.reflect.annotation.TypeAnnotationParser.mapTypeAnnotations(TypeAnnotationParser.java:356)
>       at 
> sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.<init>(AnnotatedTypeFactory.java:139)
>       at 
> sun.reflect.annotation.AnnotatedTypeFactory.buildAnnotatedType(AnnotatedTypeFactory.java:65)
>       at 
> sun.reflect.annotation.TypeAnnotationParser.buildAnnotatedType(TypeAnnotationParser.java:79)
>       at 
> java.lang.reflect.Executable.getAnnotatedReturnType0(Executable.java:633)
>       at java.lang.reflect.Method.getAnnotatedReturnType(Method.java:648)
>       at 
> org.apache.beam.sdk.schemas.FieldValueTypeInformation.hasNullableReturnType(FieldValueTypeInformation.java:173)
>       at 
> org.apache.beam.sdk.schemas.FieldValueTypeInformation.forGetter(FieldValueTypeInformation.java:132)
>       at 
> java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
>       at 
> java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
>       at 
> java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
>       at 
> java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
>       at 
> java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
>       at 
> java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
>       at 
> java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1383)
>       at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
>       at 
> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
>       at 
> java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
>       at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>       at 
> java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
>       at 
> org.apache.beam.sdk.schemas.AutoValueSchema$AbstractGetterTypeSupplier.get(AutoValueSchema.java:62)
>       at 
> org.apache.beam.sdk.schemas.utils.StaticSchemaInference.schemaFromClass(StaticSchemaInference.java:88)
>       at 
> org.apache.beam.sdk.schemas.utils.JavaBeanUtils.schemaFromJavaBeanClass(JavaBeanUtils.java:65)
>       at 
> org.apache.beam.sdk.schemas.AutoValueSchema.schemaFor(AutoValueSchema.java:117)
>       at 
> org.apache.beam.sdk.schemas.annotations.DefaultSchema$DefaultSchemaProvider.schemaFor(DefaultSchema.java:130)
> {code}
> CC: [~kenn] [~reuvenlax]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to