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
Consider a type system with the qualifier hierarchy @DefaultType <: @TopType where @DefaultType is the default qualifier in hierarchy (find source here).
Consider the following test case in this type system:
import org.checkerframework.checker.casting.qual.DefaultType;
@SuppressWarnings({"exception.parameter.invalid", "inconsistent.constructor.type"}) // for implicit constructor
public class TestCasts {
void repro(@DefaultType long startTime) {
try {
System.out.println("Inside try");
return;
} catch (Exception ex) {
long timeTaken = startTime;
@DefaultType double dblTimeTaken = timeTaken;
throw new IllegalArgumentException(ex);
} finally {
long timeTaken = startTime;
@DefaultType double dblTimeTaken = timeTaken;
}
}
}
The same code appears in the catch and finally blocks.
Running the casting checker on the test case using the command javac -processor casting checker/tests/casting/TestCasts.java results in the following unexpected error for the finally block (but not for the catch block):
checker/tests/casting/TestCasts.java:15: error: [assignment.type.incompatible] incompatible types in assignment.
@DefaultType double dblTimeTaken = timeTaken;
^
found : @TopType long
required: @DefaultType double
1 error
It looks like perhaps the local variable timeTaken is incorrectly unrefined to @TopType in the finally block.
The text was updated successfully, but these errors were encountered:
Consider a type system with the qualifier hierarchy
@DefaultType <: @TopType
where@DefaultType
is the default qualifier in hierarchy (find source here).Consider the following test case in this type system:
The same code appears in the
catch
andfinally
blocks.Running the casting checker on the test case using the command
javac -processor casting checker/tests/casting/TestCasts.java
results in the following unexpected error for thefinally
block (but not for thecatch
block):It looks like perhaps the local variable
timeTaken
is incorrectly unrefined to@TopType
in thefinally
block.The text was updated successfully, but these errors were encountered: