Community
Participate
Working Groups
Build Identifier: I20100608-0911 The following code is accepted without an unchecked warning, but it throws ClassCastException at a synthetic cast: class Outer<T> { class Cell { final T value; Cell(T value) { this.value = value; } } // Expected a type mismatch here: Cell.class has type Class<Outer<?>.Cell> Class<Outer<T>.Cell> cellClass = Cell.class; public static void main(String[] args) { Outer<Integer>.Cell intCell = new Outer<Integer>().new Cell(314); Outer<String>.Cell strCell = new Outer<String>().cellClass.cast(intCell); String val = strCell.value; // ClassCastException System.out.println(val); } } Reproducible: Always Steps to Reproduce: 1. Compile and run the given code.
I'll investigate. cf. bug# 312076
This is a duplicate of bug# 312076 - I have a fix for the latter which also addresses this one. Will close this as duplicate and include the test case from comment# 0 in the regression test for bug# 312076. Targetting 3.7 M1 for the fix to be released. *** This bug has been marked as a duplicate of bug 312076 ***
Verified for 3.7M1.