Skip to content
BenRomberg edited this page Aug 14, 2012 · 5 revisions

Compilation error when using ignored() or result()

When using return ignored(); or int result = result();, the following compilation error is being thrown: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds ...


Cause A: This is a bug in the Sun/Oracle Compiler up to Version 1.6.0 Update 24 [1, 2].

Solution A.1: Upgrade to (at least) Version 1.6.0 Update 25 or Version 1.7.0.
Solution A.2: Replace ignored() with a specific return-value or result() with result(Class<T> resultType).


Cause B: When using primitives, the 1.6.0 Sun/Oracle Compiler (all versions) does not consider auto-boxing [3].

Solution B.1: Upgrade to Version 1.7.0.
Solution B.2: Explicitly cast to the corresponding wrapper-type.
Solution B.3: Replace ignored() with a specific return-value or result() with result(Class<T> resultType).


[1] http://bugs.sun.com/view_bug.do?bug_id=6302954
[2] http://bugs.sun.com/view_bug.do?bug_id=6794295
[3] http://bugs.sun.com/view_bug.do?bug_id=6995200

contract-scan-package doesn't work for certain JAR files

Spring is having the same issue: you need to enable directory entries for all JAR files, see [1].

[1] http://stackoverflow.com/questions/4936295/auto-wiring-annotations-in-classes-from-dependent-jars