Last active
March 22, 2018 16:38
-
-
Save okkero/c22f5d5b2cb7935952dc2d23145ee1e3 to your computer and use it in GitHub Desktop.
Java 10 type inference bug: inference fails on list of objects of two different classes derived from the same base class, implementing the same interface. Error:java: java.lang.AssertionError: Unexpected intersection type: com.okkero.Test.Super&com.okkero.Test.Foo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test { | |
interface Foo {} | |
static abstract class Super {} | |
static class Sub1 extends Super implements Foo {} | |
static class Sub2 extends Super implements Foo {} | |
public static void main(String[] args) { | |
var b = List.of(new Sub1(), new Sub2()); | |
b.forEach(System.out::println); | |
} | |
} |
Seems to work with javac. Could this be an Eclipse bug?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does not happen if they extend two different base classes or don't implement any common interfaces