-
Notifications
You must be signed in to change notification settings - Fork 331
Open
Description
I'm using NullAway 0.13.1 in Java 27 with Spring 7, which has this API:
public interface PreparedStatementCallback<T extends @Nullable Object> {
T doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException;
}I have an implementation that can return a nullable byte[] result:
private static final PreparedStatementCallback<byte @Nullable []> DATA_CALLBACK = new PreparedStatementCallback<>() {
@Override
public byte @Nullable [] doInPreparedStatement(PreparedStatement ps)
throws SQLException, DataAccessException {
if ( ps.execute() ) {
try (ResultSet rs = ps.getResultSet()) {
if ( rs.next() ) {
return rs.getBytes(1);
}
}
}
return null;
}
};NullAway reports this as an error:
error: [NullAway] method returns @Nullable, but superclass method org.springframework.jdbc.core.PreparedStatementCallback.doInPreparedStatement(java.sql.PreparedStatement) returns @NonNull
public byte @Nullable [] doInPreparedStatement(PreparedStatement ps)
^
(see http://t.uber.com/nullaway )
1 error
I do not get this type of error using a nullable Object result like PreparedStatementCallback<@Nullable String>. Am I writing the byte @Nullable [] version incorrectly somehow? I feel like it should not generate this error, but am not sure.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels