-
Bug
-
Resolution: Fixed
-
P3
-
8, 9
-
b13
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8045170 | 8u25 | Paul Govereau | P3 | Resolved | Fixed | b01 |
JDK-8043897 | 8u20 | Paul Govereau | P3 | Resolved | Fixed | b17 |
JDK-8052610 | emb-8u26 | Paul Govereau | P3 | Resolved | Fixed | b17 |
Create an empty directory and copy into it the following two sources:
Ref.java:
public class Ref<T> {
final RefQueue<? super T> queue = new RefQueue<>();
public static void main(String[] args) {
Ref<Object> r = new Ref<>();
RefQueue<Object> q = r.queue;
}
}
RefQueue.java:
public class RefQueue<T> {}
Then execute:
mkdir out
javac -d out Ref.java
This compiles fine and produces two class files in out directory:
Ref.class
RefQueue.class
Now do the following:
mkdir out2
rm RefQueue.java
javac -cp out -d out2 Ref.java
Which produces compile-time error:
Ref.java:6: error: incompatible types: RefQueue<CAP#1> cannot be converted to RefQueue<Object>
RefQueue<Object> q = r.queue;
^
where CAP#1 is a fresh type-variable:
CAP#1 extends Object super: Object from capture of ? super Object
1 error
reported by Peter Levart at compiler-dev: http://mail.openjdk.java.net/pipermail/compiler-dev/2014-January/008457.html
Ref.java:
public class Ref<T> {
final RefQueue<? super T> queue = new RefQueue<>();
public static void main(String[] args) {
Ref<Object> r = new Ref<>();
RefQueue<Object> q = r.queue;
}
}
RefQueue.java:
public class RefQueue<T> {}
Then execute:
mkdir out
javac -d out Ref.java
This compiles fine and produces two class files in out directory:
Ref.class
RefQueue.class
Now do the following:
mkdir out2
rm RefQueue.java
javac -cp out -d out2 Ref.java
Which produces compile-time error:
Ref.java:6: error: incompatible types: RefQueue<CAP#1> cannot be converted to RefQueue<Object>
RefQueue<Object> q = r.queue;
^
where CAP#1 is a fresh type-variable:
CAP#1 extends Object super: Object from capture of ? super Object
1 error
reported by Peter Levart at compiler-dev: http://mail.openjdk.java.net/pipermail/compiler-dev/2014-January/008457.html
- backported by
-
JDK-8043897 javac, inconsistent generic types behaviour when compiling together vs. separate
-
- Resolved
-
-
JDK-8045170 javac, inconsistent generic types behaviour when compiling together vs. separate
-
- Resolved
-
-
JDK-8052610 javac, inconsistent generic types behaviour when compiling together vs. separate
-
- Resolved
-
- relates to
-
JDK-8054309 5.1.10: Lower-bounded wildcard sometimes maps to its bound in javac
-
- Open
-
-
JDK-8022162 Incorrect signature determination for certain inner class generics
-
- Closed
-
-
JDK-8039840 Fix deficiencies in isSameType
-
- Closed
-
(1 relates to)