Skip to content

Instantly share code, notes, and snippets.

@jharting
Created October 13, 2011 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jharting/1283752 to your computer and use it in GitHub Desktop.
Save jharting/1283752 to your computer and use it in GitHub Desktop.
WELD-978
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