Skip to content

Instantly share code, notes, and snippets.

@jsyeo
Created August 20, 2015 07:55
Show Gist options
  • Save jsyeo/7fd641de62807dc50f83 to your computer and use it in GitHub Desktop.
Save jsyeo/7fd641de62807dc50f83 to your computer and use it in GitHub Desktop.
Type Erasure of Generic Method
public class Main {
public static void main(String[] args) {
Rectangle r = new Rectangle();
vulnerableDrawShape(r);
}
static <T extends Shape> void vulnerableDrawShape(T shape) {
}
}
class Rectangle extends Shape {
}
class Circle extends Shape {
}
class Shape {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment