Created
October 13, 2011 08:37
-
-
Save jharting/1283752 to your computer and use it in GitHub Desktop.
WELD-978
This file contains 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 Foo { | |
@Inject | |
private Event<Bar<? extends Number>> event; | |
public <T extends Number> void fireWithTypeVariable() { | |
event.fire(new Bar<T>()); // should throw IAE (If the runtime type of the event object contains a type variable, the container must throw an IllegalArgumentException.) | |
} | |
/* | |
* This should work using the specified type Bar<? extends Number> but we cannot distinguish from the example above due to | |
* type erasure (we never know if the type parameter did not happen to be a type variable) | |
*/ | |
public void fireWithoutTypeVariable() { | |
event.fire(new Bar<Integer>()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment