static boolean shouldCheckFieldPresenceToEmulateJspbNullability ( FieldDescriptor desc ) { boolean hasBrokenSemantics = false ; if ( desc . hasDefaultValue ( ) || desc . isRepeated ( ) ) { return false ; } else if ( desc . getFile ( ) . getSyntax ( ) == Syntax . PROTO3 || ! hasBrokenSemantics ) { // in proto3 or proto2 with non-broken semantics we only need to check for presence for // message typed fields. return desc . getJavaType ( ) == JavaType . MESSAGE ; } else { return true ; } }
Returns whether or not we should check for presence to emulate jspb nullability semantics in server side soy .