Hi,
I would like to use the most recent version of the Checker Framework in my project.
After the bump a error has been throws.
The code looks good to me, so I assume it is / could be a regression in the Checker Framework.
The framework does not complain using 2.1.5 and 2.1.6
After switching to 2.1.7 is complains:
error: [[all, keyfor]:lambda.param.type.incompatible] incompatible parameter types in lambda expression.
After using
@SuppressWarnings(value = { "lambda.param.type.incompatible" })
for the respective function it complains about:
error: [[all, keyfor]:expression.unparsable.type.invalid] Expression annotation invalid: [error for expression: this.timeTemperatures error: this.timeTemperatures: findPackage threw an exception when looking up package this: null]
After using
@SuppressWarnings(value = { "lambda.param.type.incompatible", "expression.unparsable.type.invalid" })
for the respective function it does not complain anymore, but I don't think suppress warnings is the correct way to solve it (perhaps only a temporary workaround).
Here the code that raises the error:
===
package tmp;
import java.math.BigDecimal;
import java.time.DayOfWeek;
import java.time.LocalTime;
import java.util.SortedMap;
import java.util.stream.Collectors;
public class Demo {
protected final SortedMap<DayOfWeek, SortedMap<LocalTime, BigDecimal>> timeTemperatures;
public Demo(final SortedMap<DayOfWeek, SortedMap<LocalTime, BigDecimal>> timeTemperatures) {
this.timeTemperatures = timeTemperatures;
}
@Override
public String toString() {
return String.format("time=[%s]", timeTemperatures.keySet().stream()
.map(key -> String.format("%s=%s", key, timeTemperatures.get(key))).collect(Collectors.joining(",")));
}
}
====
If I change the code to this one:
===
package tmp;
import java.math.BigDecimal;
import java.time.DayOfWeek;
import java.time.LocalTime;
import java.util.SortedMap;
import java.util.stream.Collectors;
public class Demo {
public String test(final SortedMap<DayOfWeek, SortedMap<LocalTime, BigDecimal>> timeTemperatures) {
return String.format("time=[%s]", timeTemperatures.keySet().stream()
.map(key -> String.format("%s=%s", key, timeTemperatures.get(key))).collect(Collectors.joining(",")));
}
}
===
I receive another error using 2.1.7
[ERROR] error: SourceChecker.typeProcess: unexpected Throwable (StackOverflowError) while processing /.../Demo.java; invoke the compiler with -AprintErrorStack to see the stack trace.
Best regards,
Markus