Incorrect unchecked conversion warning

Issue #190 resolved
Jesper Öqvist created an issue

ExtendJ 8.0.1-154-gaf5cf06 Java SE 8

The unchecked conversion analysis in ExtendJ is too strict. The following test case should not generate an unchecked conversion warning:

// Test safe generic type conversion.
// .result=COMPILE_PASS

abstract class AbstractContainer<T> { }
class List<T> extends AbstractContainer<T> { }
class ResourceList extends List<Resource> { }
interface Resource { }

public class Test {
  List<Resource> foo(AbstractContainer con) {
    return ((ResourceList) con);

ExtendJ generates the following, incorrect, warning:

tests/generics/subtype_04p/ warning: unchecked conversion from raw type AbstractContainer to generic type ResourceList

Comments (1)

  1. Log in to comment