Regression on lambda expression (2.1.6 ok, 2.1.7 nok)

13 views
Skip to first unread message

Markus Rathgeb

unread,
Jan 17, 2017, 5:38:00 AM1/17/17
to Checker Framework discussion
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

Markus Rathgeb

unread,
Jan 17, 2017, 6:06:30 AM1/17/17
to Checker Framework discussion

Michael Ernst

unread,
Jan 17, 2017, 7:29:22 AM1/17/17
to Markus Rathgeb, Checker Framework Discussions
Markus-
Thanks for reporting the problem in the issue tracker. We'll follow up on
it there.

-Mike
Reply all
Reply to author
Forward
0 new messages