Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-11530

Annotated setter parameters handled wrong in schema creation

Details

    • Important

    Description

      I'm facing an exception telling me that my JavaBean contained a setter for a field that had a mismatching nullable attribute, although both getter and setter (parameters) are annotated with @Nullable.

       

      The code responsible for determining if a setter's parameter is nullable looks wrong to me, since it does check if the type (class) itself is annotated with @Nullable instead of checking the actual parameter's annotations only considers type annotations instead of looking at parameter annotations, too. Java distinguishes between parameter annotations and type annotations. Therefore annotations declared without java.lang.annotation.ElementType#TYPE_USE can't be accessed through Executable#getAnnotatedParameterTypes().

       

      FieldValueTypeInformation

      boolean nullable =
        Arrays.stream(method.getParameters()[0].getAnnotatedType().getAnnotations())
              .anyMatch(annotation -> isNullableAnnotation(annotation));

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              krakowski Filip Krakowski
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 50m
                  3h 50m