Menu

#105 [Generics] Wrong subtyping check

Self_Reported
open
nobody
5
2012-11-27
2006-11-16
No

The assignment in the below class should not be allowed since we are basically assigning a Bug3<String> to a Bug3<Integer>. However, MultiJava accepts the assignment. Apparently, the parameterization of the declared supertype Bug3<String> is completely ignored when checking the assignment.

======================================
class A extends Bug3<String> { }

public class Bug3<T> {
public void foo() {
Bug3<Integer> integer = new A();
}
}
======================================

Discussion


Log in to post a comment.

Auth0 Logo