Skip to content

Instantly share code, notes, and snippets.

@fearofcode
Created January 27, 2018 21:39
Show Gist options
  • Save fearofcode/b7708142dc28020b1d31c078834b4cd2 to your computer and use it in GitHub Desktop.
Save fearofcode/b7708142dc28020b1d31c078834b4cd2 to your computer and use it in GitHub Desktop.
Type erasure example
class WhatCouldGoWrong<T, U> {
T t;
U u;
public void set(T t) {
this.t = t;
}
public void set(U u) {
this.u = u;
}
}
/*
Error:(9, 17) java: name clash: set(U) and set(T) have the same erasure
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment