Skip to content

Instantly share code, notes, and snippets.

@kputnam
Created May 10, 2014 03:13
Show Gist options
  • Save kputnam/d8013e5f8a7496963d27 to your computer and use it in GitHub Desktop.
Save kputnam/d8013e5f8a7496963d27 to your computer and use it in GitHub Desktop.
Type parameter instantiation
package test;
public class Test {
public static class Generic<A, B> { }
public static class Instance extends Generic<String, String> { }
// OK
Class<? extends Generic<String, String>> w = Instance.class;
/**
* Test.java: error: incompatible types
* Class<Generic<String, String>> x = Generic.class;
* ^
* required: Class<Generic<String,String>>
* found: Class<Generic>
*/
Class<Generic<String, String>> x = Generic.class;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment