In the code, incorrect or incomplete type resolution causes correct code to be given a red underline and red analysis mark in the IntelliJ IDEA editor. The errors can be seen in the CoreMaps class, including its main method, even though it compiles and runs without error (under either JDK1.5 or JDK1.6). They are caused by the setup of the typesafe heterogeneous map in CoreAnnotation/TypesafeMap.
The code implements a version of the heterogeneous typesafe map idiom which Joshua Bloch has spoken about at many recent conferences. This version differs from an EnumMap by assuming a situation where there is a large (open) set of keys for which particular items will only have values for a sparse subset. Keys valid for an object are hence stored in an array.
On any get operation from the map, IDEA incorrectly reports an error of this type:
Inferred type 'CoreMaps.IntegerA' for type parameter 'KEY' is not within its bound; should implement TypeSafeMap.Key<CoreMap,java
.lang.Object>
but this error is wrong and reflects a failure to do type resolution.
The compiler/IDE needs to correctly bind the relevant type variables introduced in get's signature (VALUE, KEY) for each call to the method. The correct bindings are Integer and TypesafeMap.Key<CoreMap,Integer>). If those bindings are done correctly, then the method call compiles okay because the return type is an Integer and the KEY says it will return a Integer. In particular, if those bindings are right then "Object" - which shows up as part of the binding in IntelliJ's error message - should just never show up anywhere.