Last active
December 17, 2015 22:48
-
-
Save kapv89/5684342 to your computer and use it in GitHub Desktop.
Compile time error
This file contains hidden or 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 Gen { | |
| public static void main(String[] args) { | |
| Foo<Integer> a = new Foo<Integer>(123); | |
| // Baz b = new Baz("aha"); | |
| System.out.println(a.bar.toString()); | |
| // System.out.println(b.bar); | |
| } | |
| } | |
| class Foo<T> { | |
| public T bar; | |
| public Foo(T bar) | |
| { | |
| this.bar = bar; | |
| } | |
| } | |
| class Baz extends Foo<String> { | |
| } | |
| /**** Error ****/ | |
| Gen.java:27: error: constructor Foo in class Foo<T> cannot be applied to given types; | |
| class Baz extends Foo<String> { | |
| ^ | |
| required: String | |
| found: no arguments | |
| reason: actual and formal argument lists differ in length | |
| where T is a type-variable: | |
| T extends Object declared in class Foo | |
| 1 error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment