You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Signedness Checker emits a false positive when a char is assigned to an int or a long and returned:
public class RemainingUnsignedness {
int returnIntWithLocalVariable(char c) {
int i = c;
return i;
}
long returnLongWithLocalVariable(char c) {
long l = c;
return l;
}
int returnIntWithoutLocalVariable(char c) {
return c;
}
long returnLongWithoutLocalVariable(char c) {
return c;
}
}
Output:
root@DESKTOP-MO4BCEL:~/checker-framework# javacheck -processor SignednessChecker ~/temp-checker/checker-framework/checker/tests/signedness/RemainingUnsignedness.java
/root/temp-checker/checker-framework/checker/tests/signedness/RemainingUnsignedness.java:4: error: [return.type.incompatible] incompatible types in return.
return i;
^
type of expression: @Unsigned int
method return type: @Signed int
/root/temp-checker/checker-framework/checker/tests/signedness/RemainingUnsignedness.java:9: error: [return.type.incompatible] incompatible types in return.
return l;
^
type of expression: @Unsigned long
method return type: @Signed long
2 errors
javacheck alias: alias javacheck='$CHECKERFRAMEWORK/checker/bin/javac'
The methods returnIntWithoutLocalVariable and returnLongWithoutLocalVariable not emitting this false positive demonstrates the necessity of a local variable in emitting this false positive.
The text was updated successfully, but these errors were encountered:
The Signedness Checker emits a false positive when a
char
is assigned to anint
or along
and returned:Output:
javacheck
alias:alias javacheck='$CHECKERFRAMEWORK/checker/bin/javac'
The methods
returnIntWithoutLocalVariable
andreturnLongWithoutLocalVariable
not emitting this false positive demonstrates the necessity of a local variable in emitting this false positive.The text was updated successfully, but these errors were encountered: