-
Bug
-
Resolution: Fixed
-
P5
-
6
-
b27
-
generic
-
generic
-
Not verified
interface Super<P> {}
class Y<A> implements Super<Integer>{}
interface X<A> extends Super<Double>{}
class S<L> extends Y<Object> {}
interface T<L> extends X<Object>{}
public class Test{
public static void main(String argv[]) {
S s = null; // same if I use S<Byte>
T t = null; // same if I use T<Byte>
t = (T) s;
}
}
This should not fail. T is raw in the cast.
Compile-time error:
interface Super<P> {}
class Y<A> implements Super<Integer>{}
interface X<A> extends Super<Double>{}
class S extends Y<Object> {}
interface T extends X<Object>{}
public class Test{
public static void main(String argv[]) {
S s = null;
T t = null;
t = (T) s;
}
}
Yes. Distinct supertypes: Super<Integer> and Super<Double>.
Compile-time error:
interface Super<P> {}
class Y implements Super<Integer>{}
interface X extends Super<Double>{}
class S<L> extends Y {}
interface T<L> extends X{}
public class Test{
public static void main(String argv[]) {
S s = null; // also if I use S<Byte>
T t = null; // also if I use T<Byte>
t = (T) s;
}
}
Looks like a bug. The program should compile because you cast to the
*raw* type T.
interface Super<P> {}
class Y<A> implements Super<Integer>{}
interface X<A> extends Super<Double>{}
class S extends Y {}
interface T extends X{}
public class Test{
public static void main(String argv[]) {
S s = null;
T t = null;
t = (T) s;
}
}
interface Super<P> {}
class Y implements Super<Integer>{}
interface X extends Super<Double>{}
class S extends Y {}
interface T extends X{}
public class Test{
public static void main(String argv[]) {
S s = null;
T t = null;
t = (T) s;
}
}
class Y<A> implements Super<Integer>{}
interface X<A> extends Super<Double>{}
class S<L> extends Y<Object> {}
interface T<L> extends X<Object>{}
public class Test{
public static void main(String argv[]) {
S s = null; // same if I use S<Byte>
T t = null; // same if I use T<Byte>
t = (T) s;
}
}
This should not fail. T is raw in the cast.
Compile-time error:
interface Super<P> {}
class Y<A> implements Super<Integer>{}
interface X<A> extends Super<Double>{}
class S extends Y<Object> {}
interface T extends X<Object>{}
public class Test{
public static void main(String argv[]) {
S s = null;
T t = null;
t = (T) s;
}
}
Yes. Distinct supertypes: Super<Integer> and Super<Double>.
Compile-time error:
interface Super<P> {}
class Y implements Super<Integer>{}
interface X extends Super<Double>{}
class S<L> extends Y {}
interface T<L> extends X{}
public class Test{
public static void main(String argv[]) {
S s = null; // also if I use S<Byte>
T t = null; // also if I use T<Byte>
t = (T) s;
}
}
Looks like a bug. The program should compile because you cast to the
*raw* type T.
interface Super<P> {}
class Y<A> implements Super<Integer>{}
interface X<A> extends Super<Double>{}
class S extends Y {}
interface T extends X{}
public class Test{
public static void main(String argv[]) {
S s = null;
T t = null;
t = (T) s;
}
}
interface Super<P> {}
class Y implements Super<Integer>{}
interface X extends Super<Double>{}
class S extends Y {}
interface T extends X{}
public class Test{
public static void main(String argv[]) {
S s = null;
T t = null;
t = (T) s;
}
}
- duplicates
-
JDK-6542952 javac fail to compile casts to raw type
- Closed
- relates to
-
JDK-8044366 4.8: Are indirect supertypes of a raw type erased?
- Open