Closed GoogleCodeExporter closed 9 years ago
Thanks for the report!
Jonathan, can you have a look?
Original comment by wdi...@gmail.com
on 25 Mar 2015 at 9:36
Well looking at the stacktrace it looks likely that this is a lub that occurred
between a method type variable and a corresponding method type variable in an
override. E.g.
class M1 {
<T> void method(T t) {}
}
class M2 extends M1 {
<T2> void method(T t) {}
}
I'll try to reproduce it using this approach.
Original comment by jbu...@cs.washington.edu
on 25 Mar 2015 at 4:55
Sorry for the low quality bug reports, but assembling good repros is
time-consuming and I was hoping it might be immediately obvious to you from the
stack trace. Thanks for taking a look!
Here's a repro:
=== Test.java ===
class Test<E> {
abstract static class C<E> {
abstract X<? extends E> getX();
}
interface X<T> {}
abstract static class R<E> {
abstract boolean d(X<? extends E> id);
}
private void f(C<E> c, R<E> r) {
X<? extends E> x = c.getX();
boolean test = r.d(x);
}
}
===
$ javac -version -AprintErrorStack -processor
org.checkerframework.checker.nullness.NullnessChecker Test.java
javac 1.8.0-jsr308-1.8.11
error: SourceChecker.typeProcess: unexpected Throwable
(IllegalArgumentException) while processing Test.java; message: Type must
extend lub: type=E[ extends Object super Void] lub=E[ extends Object super Void]
Compilation unit: Test.java
Exception: java.lang.IllegalArgumentException: Type must extend lub: type=E[ extends Object super Void] lub=E[ extends Object super Void]; Stack trace: org.checkerframework.framework.flow.util.LubTypeVariableAnnotator.asLubType(LubTypeVariableAnnotator.java:163)
org.checkerframework.framework.flow.util.LubTypeVariableAnnotator.annotateEmptyLub(LubTypeVariableAnnotator.java:79)
org.checkerframework.framework.flow.util.LubTypeVariableAnnotator.annotateTypeVarAsLub(LubTypeVariableAnnotator.java:68)
org.checkerframework.framework.util.AnnotatedTypes.annotateAsLub(AnnotatedTypes.java:807)
org.checkerframework.framework.util.AnnotatedTypes.addAnnotationsImpl(AnnotatedTypes.java:885)
org.checkerframework.framework.util.AnnotatedTypes.addAnnotationsImpl(AnnotatedTypes.java:975)
...
Original comment by cus...@google.com
on 25 Mar 2015 at 10:23
Thanks for the test case. That's very useful to us. I know it's hard to
create a small isolated test case, and we appreciate it!
Original comment by michael.ernst@gmail.com
on 25 Mar 2015 at 11:18
Original comment by Jonathan...@gmail.com
on 9 Apr 2015 at 11:56
Original comment by jtha...@cs.washington.edu
on 18 Apr 2015 at 6:42
Original issue reported on code.google.com by
cus...@google.com
on 25 Mar 2015 at 1:22Attachments: