krakowski commented on pull request #13622:
URL: https://github.com/apache/beam/pull/13622#issuecomment-752116959


   Hi @TheNeuralBit,
   
   I tried reproducing the issue adding a unit test to `JavaBeanSchemaTest` but 
there it passes (with `getAnnotatedType()`), which I find pretty strange.
   
   Because of this I created a separate repo for reproduction at 
https://github.com/krakowski/BEAM-11530.
   Running `./gradlew run` within this projects results in the following 
stacktrace.
   
   ```
   Exception in thread "main" java.lang.RuntimeException: JavaBean contained 
setter for field value that had a mismatching nullable attribute.
        at 
org.apache.beam.sdk.schemas.utils.JavaBeanUtils.validateJavaBean(JavaBeanUtils.java:96)
        at 
org.apache.beam.sdk.schemas.JavaBeanSchema.schemaFor(JavaBeanSchema.java:120)
        at 
org.apache.beam.sdk.schemas.annotations.DefaultSchema$DefaultSchemaProvider.schemaFor(DefaultSchema.java:133)
        ...
   ```
   
   The JavaBean used within this example is pretty simple and does contain only 
one field.
   
   ```java
   package io.github.krakowski.beam;
   
   import org.apache.avro.reflect.Nullable;
   import org.apache.beam.sdk.schemas.JavaBeanSchema;
   import org.apache.beam.sdk.schemas.annotations.DefaultSchema;
   
   @DefaultSchema(JavaBeanSchema.class)
   public final class SimpleBean {
   
       @Nullable
       private Float value;
   
       public @Nullable Float getValue() {
           return value;
       }
   
       public void setValue(@Nullable Float value) {
           this.value = value;
       }
   }
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to