Java: Don't annotate vector-of-tables item getters with @nullable. (#5562)
* Annotate getters with @Pure when --java-checkerframework is specified. Together with @Nullable, this allows users to use static analysis tools like CheckerFramework to catch NPEs caused by unset fields. * Don't annotate vector-of-tables item getters with @Nullable. Since Flatbuffers don't support null items in vectors of tables.
This commit is contained in:
parent
df3e8bf4a7
commit
8bfafc76de
|
@ -252,7 +252,8 @@ class GeneralGenerator : public BaseGenerator {
|
|||
|
||||
std::string GenNullableAnnotation(const Type &t) const {
|
||||
return lang_.language == IDLOptions::kJava && parser_.opts.gen_nullable &&
|
||||
!IsScalar(DestinationType(t, true).base_type)
|
||||
!IsScalar(DestinationType(t, true).base_type) &&
|
||||
t.base_type != BASE_TYPE_VECTOR
|
||||
? " @Nullable "
|
||||
: "";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue