nhatminhle / cofoja

Contracts for Java
GNU Lesser General Public License v3.0
151 stars 18 forks source link

Types.erasure() in Eclipse JDT gives a ClassCastException on NoType return type #20

Closed nhatminhle closed 9 years ago

nhatminhle commented 9 years ago

From nhat.min...@gmail.com on February 18, 2011 02:51:19

The following was reported by michail at http://fsteeg.com/2011/02/07/setting-up-contracts-for-java-in-eclipse/ :

Exception thrown by Java annotation processor com.google.java.contract.core.apt.AnnotationProcessor@1e63dcf java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.apt.model.NoTypeImpl cannot be cast to org.eclipse.jdt.internal.compiler.apt.model.TypeMirrorImpl at org.eclipse.jdt.internal.compiler.apt.model.TypesImpl.erasure(TypesImpl.java:198) at com.google.java.contract.core.apt.FactoryUtils.getDescriptor(FactoryUtils.java:190) at com.google.java.contract.core.apt.OverlayMap.getContract(OverlayMap.java:325) at com.google.java.contract.core.apt.TypeBuilder.visitExecutable(TypeBuilder.java:434) at com.google.java.contract.core.apt.TypeBuilder.visitExecutable(TypeBuilder.java:64) at org.eclipse.jdt.internal.compiler.apt.model.ExecutableElementImpl.accept(ExecutableElementImpl.java:59)

Win32 eclipse-java-helios-SR1-win32

Original issue: http://code.google.com/p/cofoja/issues/detail?id=15

nhatminhle commented 9 years ago

From nhat.min...@gmail.com on February 18, 2011 03:32:47

This bug is specific to my development branch. It should be fixed in today's build (2011-02-18). It has to do with the JDT having a separate incompatible NoType implementation that is used for constructors. Interestingly, there seems to be some duplication between their TypeMirror and NoType implementations: void methods seem to do just fine.

Status: Started

nhatminhle commented 9 years ago

From nhat.min...@gmail.com on February 18, 2011 07:11:56

User reported the issue was indeed fixed in today's snapshot.

Status: Fixed