Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error - IncompatibleClassChangeError #156

Closed
lombokissues opened this issue Jul 14, 2015 · 8 comments
Closed

Compile error - IncompatibleClassChangeError #156

lombokissues opened this issue Jul 14, 2015 · 8 comments

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 83)

@lombokissues
Copy link
Author

👤 arothkopf@usa.com   🕗 Dec 09, 2009 at 20:28 UTC

What steps will reproduce the problem?
Not sure. Just used Getter and Setter tags.
1.From Eclipse, in an ant-based project, launch the ANT build, which
contains several classes with @ Getter and @ Setter tags. It may be because
the tags are on non-final protected fields. The tags have no parameters.

What is the expected output? What do you see instead?
Expected compilation in ANT (in Eclipse the class compiles).
Instead build failed with exception (see below).

What version of the product are you using? On what operating system?
0.91 on Windows XP. Eclipse Galileo.

Please provide any additional information below.

Note that I have another project with Lombok in eclipse which compiles just
fine in ANT.

[javac] error: Lombok annotation handler class 

lombok.javac.handlers.HandleSetter failed on GenerationManager.java:
java.lang.IncompatibleClassChangeError: Expected non-static field
com.sun.tools.javac.code.Symtab.voidType
[javac] java.lang.IncompatibleClassChangeError: Expected non-static
field com.sun.tools.javac.code.Symtab.voidType
[javac] at
lombok.javac.handlers.HandleSetter.createSetter(HandleSetter.java:143)
[javac] at
lombok.javac.handlers.HandleSetter.createSetterForField(HandleSetter.java:1
17)
[javac] at
lombok.javac.handlers.HandleSetter.handle(HandleSetter.java:89)
[javac] at
lombok.javac.HandlerLibrary$AnnotationHandlerContainer.handle(HandlerLibrar
y.java:76)
[javac] at
lombok.javac.HandlerLibrary.handleAnnotation(HandlerLibrary.java:180)
[javac] at
lombok.javac.apt.Processor$AnnotationVisitor.visitAnnotationOnField(Process
or.java:123)
[javac] at lombok.javac.JavacNode.traverse(JavacNode.java:106)
[javac] at
lombok.javac.JavacAST.traverseChildren(JavacAST.java:119)
[javac] at lombok.javac.JavacNode.traverse(JavacNode.java:71)
[javac] at
lombok.javac.JavacAST.traverseChildren(JavacAST.java:119)
[javac] at lombok.javac.JavacNode.traverse(JavacNode.java:66)
[javac] at
lombok.javac.JavacAST.traverseChildren(JavacAST.java:119)
[javac] at lombok.javac.JavacNode.traverse(JavacNode.java:61)
[javac] at lombok.javac.JavacAST.traverse(JavacAST.java:114)
[javac] at lombok.javac.apt.Processor.process(Processor.java:101)
[javac] at
com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(Jav
acProcessingEnvironment.java:624)
[javac] at
com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunPro
cs(JavacProcessingEnvironment.java:553)
[javac] at
com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(Java
cProcessingEnvironment.java:698)
[javac] at
com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:
981)
[javac] at
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:353)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:279)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:270)
[javac] at com.sun.tools.javac.Main.compile(Main.java:69)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
[javac] at java.lang.reflect.Method.invoke(Unknown Source)
[javac] at
org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
[javac] at
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065)
[javac] at
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
[javac] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[javac] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown
Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
[javac] at java.lang.reflect.Method.invoke(Unknown Source)
[javac] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[javac] at org.apache.tools.ant.Task.perform(Task.java:348)
[javac] at org.apache.tools.ant.Target.execute(Target.java:357)
[javac] at
org.apache.tools.ant.Target.performTasks(Target.java:385)
[javac] at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[javac] at
org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[javac] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.
java:41)
[javac] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTarget
s(EclipseDefaultExecutor.java:32)
[javac] at
org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[javac] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRun
ner.java:423)
[javac] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRu
nner.java:137)

@lombokissues
Copy link
Author

👤 gabor.lontay   🕗 Dec 14, 2009 at 13:09 UTC

We experiment the same on WinXP with maven 2.1.1, java 1.6.0_17 b4.
In all other environments the projects is built ok.

@lombokissues
Copy link
Author

👤 reinierz   🕗 Dec 15, 2009 at 06:56 UTC

This appears to be some sort of incompatibility between different versions of the javac compiler.
Unfortunately, all the versions I have access to don't suffer from this problem. I also have 1.6.0_17b4 so
that's weird. Are you SURE that's the compiler that's being used by whatever tools is triggering this (in gabor's
case, maven). Maven does not just grab your path-standard java (the one you get when you just type 'java'). It
does more magic. For arothkop, I believe the jvm used to fire up an ant build is configured in the "run
configurations..." section when you click on the arrow right next to the 'run tool' button.

This bug would be bordering on the impossible if you're actually seeing these on compile runs with java
1.6.0_17b4.

Once you've found the real JVM being used to compile here, or even if it really is your 1.6.0_17b4, find that
JDK on your harddisk, and use THAT JDK's bin dir to find the 'javap' tool. Run THAT javap like so:

javap -classpath path\to\this\JDKs\tools.jar com.sun.tools.javac.code.Symtab

you'll get a dump of the structure of the Symtab class. Here is the relevant part when I do this on my java
1.6.0_17b4:

public final com.sun.tools.javac.code.Type byteType;
public final com.sun.tools.javac.code.Type charType;
public final com.sun.tools.javac.code.Type shortType;
public final com.sun.tools.javac.code.Type intType;
public final com.sun.tools.javac.code.Type longType;
public final com.sun.tools.javac.code.Type floatType;
public final com.sun.tools.javac.code.Type doubleType;
public final com.sun.tools.javac.code.Type booleanType;
public final com.sun.tools.javac.code.Type botType;
public final com.sun.tools.javac.code.Type$JCNoType voidType;

note how there's a public final non-static field named 'voidType'. Your stack trace is complaining that this
field doesn't exist. Possibly it's been turned into a static field. Possibly it's been renamed. Possibly it's been
moved. Possibly it's just gone. I can't fix this until I know what happened to it.

@lombokissues
Copy link
Author

👤 gabor.lontay   🕗 Dec 15, 2009 at 10:46 UTC

Thanks for the fast answer, you were absolutely right.
JDK which is used by maven is:
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)

javap Output (voidtype is static):

Compiled from "Symtab.java"
public class com.sun.tools.javac.code.Symtab extends java.lang.Object{
protected static final com.sun.tools.javac.util.Context$Key symtabKey;
public static final com.sun.tools.javac.code.Type byteType;
public static final com.sun.tools.javac.code.Type charType;
public static final com.sun.tools.javac.code.Type shortType;
public static final com.sun.tools.javac.code.Type intType;
public static final com.sun.tools.javac.code.Type longType;
public static final com.sun.tools.javac.code.Type floatType;
public static final com.sun.tools.javac.code.Type doubleType;
public static final com.sun.tools.javac.code.Type booleanType;
public static final com.sun.tools.javac.code.Type botType;
public static final com.sun.tools.javac.code.Type$JCNoType voidType;
public final com.sun.tools.javac.code.Symbol$PackageSymbol rootPackage;
public final com.sun.tools.javac.code.Symbol$PackageSymbol unnamedPackage;
public final com.sun.tools.javac.code.Symbol$TypeSymbol noSymbol;
public final com.sun.tools.javac.code.Symbol$ClassSymbol errSymbol;
public final com.sun.tools.javac.code.Type errType;
public final com.sun.tools.javac.code.Type unknownType;
public final com.sun.tools.javac.code.Symbol$ClassSymbol arrayClass;
public final com.sun.tools.javac.code.Symbol$MethodSymbol arrayCloneMethod;
public final com.sun.tools.javac.code.Symbol$ClassSymbol boundClass;
public final com.sun.tools.javac.code.Symbol$ClassSymbol methodClass;
public final com.sun.tools.javac.code.Type objectType;
public final com.sun.tools.javac.code.Type classType;
public final com.sun.tools.javac.code.Type classLoaderType;
public final com.sun.tools.javac.code.Type stringType;
public final com.sun.tools.javac.code.Type stringBufferType;
public final com.sun.tools.javac.code.Type stringBuilderType;
public final com.sun.tools.javac.code.Type cloneableType;
public final com.sun.tools.javac.code.Type serializableType;
public final com.sun.tools.javac.code.Type throwableType;
public final com.sun.tools.javac.code.Type errorType;
public final com.sun.tools.javac.code.Type illegalArgumentExceptionType;
public final com.sun.tools.javac.code.Type exceptionType;
public final com.sun.tools.javac.code.Type runtimeExceptionType;
public final com.sun.tools.javac.code.Type classNotFoundExceptionType;
public final com.sun.tools.javac.code.Type noClassDefFoundErrorType;
public final com.sun.tools.javac.code.Type noSuchFieldErrorType;
public final com.sun.tools.javac.code.Type assertionErrorType;
public final com.sun.tools.javac.code.Type cloneNotSupportedExceptionType;
public final com.sun.tools.javac.code.Type annotationType;
public final com.sun.tools.javac.code.Symbol$TypeSymbol enumSym;
public final com.sun.tools.javac.code.Type listType;
public final com.sun.tools.javac.code.Type collectionsType;
public final com.sun.tools.javac.code.Type comparableType;
public final com.sun.tools.javac.code.Type arraysType;
public final com.sun.tools.javac.code.Type iterableType;
public final com.sun.tools.javac.code.Type iteratorType;
public final com.sun.tools.javac.code.Type annotationTargetType;
public final com.sun.tools.javac.code.Type overrideType;
public final com.sun.tools.javac.code.Type retentionType;
public final com.sun.tools.javac.code.Type deprecatedType;
public final com.sun.tools.javac.code.Type suppressWarningsType;
public final com.sun.tools.javac.code.Type inheritedType;
public final com.sun.tools.javac.code.Type proprietaryType;
public final com.sun.tools.javac.code.Symbol$VarSymbol lengthVar;
public final com.sun.tools.javac.code.Symbol$OperatorSymbol nullcheck;
public final com.sun.tools.javac.code.Symbol$MethodSymbol enumFinalFinalize;
public final com.sun.tools.javac.code.Type[] typeOfTag;
public final com.sun.tools.javac.util.Name[] boxedName;
public final java.util.Map classes;
public final java.util.Map packages;
public final com.sun.tools.javac.code.Symbol$ClassSymbol predefClass;
public static com.sun.tools.javac.code.Symtab
instance(com.sun.tools.javac.util.Context);
public void initType(com.sun.tools.javac.code.Type,
com.sun.tools.javac.code.Symbol$ClassSymbol);
public void initType(com.sun.tools.javac.code.Type, java.lang.String);
public void initType(com.sun.tools.javac.code.Type, java.lang.String,
java.lang.String);
protected com.sun.tools.javac.code.Symtab(com.sun.tools.javac.util.Context)
throws com.sun.tools.javac.code.Symbol$CompletionFailure;
static {};
}

@lombokissues
Copy link
Author

👤 reinierz   🕗 Dec 15, 2009 at 11:23 UTC

Excellent sleuthing work, Gabor. That explains a thing or two. We should nevertheless try to be compatible with
this. Can you guys test this one for me?

Download this git latest build: https://projectlombok.org/downloads/lombok-0.9.2-HEAD.jar

and give it a spin. Does it solve the problem? If so, we can scratch this one from the list on the eve of the 0.9.2
release :)

@lombokissues lombokissues added the accepted The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues
Copy link
Author

👤 gabor.lontay   🕗 Dec 15, 2009 at 12:18 UTC

I have downloaded the 0.9.2 jar and the compilation error messages were gone,
everything is working fine. Thanks for the great work!

@lombokissues
Copy link
Author

👤 reinierz   🕗 Dec 15, 2009 at 19:24 UTC

w00t. rolled out in the official v0.9.2 - hailbunny release, which is online now at projectlombok.org!

@lombokissues lombokissues removed the accepted The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues
Copy link
Author

End of migration

lianhaijun pushed a commit to lianhaijun/lombok that referenced this issue May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant