Created
January 27, 2018 21:39
-
-
Save fearofcode/b7708142dc28020b1d31c078834b4cd2 to your computer and use it in GitHub Desktop.
Type erasure example
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
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