Community
Participate
Working Groups
Right now in apt, we can return the kind TypeKind.ERROR for types which are not instances of javax.lang.model.type.ErrorType. This seems to be inconsistent. When the user gets a type mirror with the kind TypeKind.ERROR, he/she can expect that type mirror to be successfully cast to the type javax.lang.model.type.ErrorType. We need to be more consistent in the way we handle error types in the apt type system. The compiler bindings are tagged with the bit org.eclipse.jdt.internal.compiler.lookup.TagBits.HasMissingType now that we better support missing/unresolved types.
I'll take care of this. I need to review all usage of TypeKind.ERROR and how the error type instances are being instantiated. We also need to make sure that any method declared on javax.lang.model.type.DeclaredType can be invoked on an error type without any errors.
Created attachment 193576 [details] Proposed fix
Created attachment 193835 [details] Proposed fix + regression test Updated regression tests. This is using ProcessingEnvironment.getSourceVersion() to switch between old implementation and new implementation for error types as interfaces. Tests are passing on JDK6 and JDK7.
Walter, I'll release this for M7 so that we get a more consistent handling of error types inside the apt model.
Released for 3.7M7.