Question

Sun's CodeModel is able to generate List<? extends Number> by using model.ref(List.class).narrow(model.ref(Number.class).wildcard()).

However, I've searched the documentation and couldn't find a way to generate List<? super Number>.

Any help would be appreciated.

Was it helpful?

Solution

This cannot be done as far as I see.

You can track this issue https://java.net/jira/browse/CODEMODEL-11

Also see the comment at line 52 here http://searchcode.com/codesearch/view/20492343. It's a TODO.

If it's any help, maybe you can accomplish what you are trying to do by generating a List of a concrete super type, like model.ref(List.class).narrow(model.ref(Number.class)._extends()).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top