Skip to content

Instantly share code, notes, and snippets.

@mariuszs
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariuszs/0a82ca08f55499906ea9 to your computer and use it in GitHub Desktop.
Save mariuszs/0a82ca08f55499906ea9 to your computer and use it in GitHub Desktop.
Ambiguous under java 8 with Float
```java
public class Ambiguous {
public static void main(String... args){
then(bar());
}
public static <E extends Float> E bar() {
return null;
}
public static void then(Throwable actual) { }
public static void then(CharSequence actual) { }
}
```
javac -source 1.8 -verbose Ambiguous.java
[parsing started RegularFileObject[Ambiguous.java]]
[parsing completed 19ms]
[search path for source files: .]
[search path for class files: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/resources.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/rt.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/sunrsasign.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/jsse.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/jce.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/charsets.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/jfr.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/classes,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/sunec.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/sunpkcs11.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/zipfs.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/cldrdata.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/nashorn.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/localedata.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/dnsns.jar,/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/sunjce_provider.jar,.]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/String.class)]]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Float.class)]]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Throwable.class)]]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/CharSequence.class)]]
[checking Ambiguous]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/io/Serializable.class)]]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Number.class)]]
[loading ZipFileIndexFileObject[/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Comparable.class)]]
[wrote RegularFileObject[Ambiguous.class]]
[total 212ms]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment