FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
The following works in Eclipse and javac 1.8.0_11.
javac 1.8.0_20 and 1.8.0_25 are broken:
import java.util.LinkedList;
public class Test
{
public static void main(String[] args)
{
LinkedList<Animal> l = new LinkedList<Animal>();
l.add(l.getFirst().copy());
}
static class Animal
{
<T> T copy()
{
return null;
}
}
}
REGRESSION. Last worked in version 8u11
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
javac compiles the class
ACTUAL -
Test.java:8: error: no suitable method found for add(Object)
l.add(l.getFirst().copy());
^
method Collection.add(Animal) is not applicable
(argument mismatch; Object cannot be converted to Animal)
method List.add(Animal) is not applicable
(argument mismatch; Object cannot be converted to Animal)
method AbstractCollection.add(Animal) is not applicable
(argument mismatch; Object cannot be converted to Animal)
method AbstractList.add(Animal) is not applicable
(argument mismatch; Object cannot be converted to Animal)
method LinkedList.add(Animal) is not applicable
(argument mismatch; Object cannot be converted to Animal)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
REPRODUCIBILITY :
This bug can be reproduced always.