[2061/JDK1.5b2] Bad class file format error when using an annotation
Hi,
Trying to use annotations but getting an error:
Error: Bad class file format:
C:\Documents and Settings\Matt\IdeaProjects\Test\classes\TestAnnotations.class
Information: Compilation completed with 1 errors and 0 warnings
The annotation class is:
public @interface Transactional {
boolean autoCommit() default true;
}
the test class is:
public class TestAnnotations {
private int value;
public TestAnnotations(int value) {
this.value = value;
}
@Transactional public void setValue(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
The installation is:
-fresh install of #2061
-no imported settings
-fresh installation of JDK1.5beta2
-project language level set to 1.5
Couldn't find anything about this in the tracker. Is this a bug? Or
have I done something wrong (this is my first go at Pallada/JDK1.5)?
Regards,
Matt
/**
Created by IntelliJ IDEA.
User: Matt
Date: 30-May-2004
Time: 14:16:41
To change this template use File | Settings | File Templates.
*/
public @interface Transactional {
boolean autoCommit() default true;
}
/**
Created by IntelliJ IDEA.
User: Matt
Date: 30-May-2004
Time: 14:15:36
To change this template use File | Settings | File Templates.
*/
public class TestAnnotations {
private int value;
public TestAnnotations(int value) {
this.value = value;
}
@Transactional public void setValue(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
Please sign in to leave a comment.
Between some CAP builds, class files were not compatible, and you had to recompile your applications to run under a new build. This might be your problem.
Hi Keith,
Keith Lea wrote:
Do you mean EAP builds?
I installed #2061 fresh and wrote these files with it. They were never
compiled by a previous build of IDEA.
Regards,
Matt
No, I mean CAP pre-release builds of JDK 1.5. It looks like that's not your problem though, it's probably something wrong with IDEA.
Keith Lea wrote:
I wonder what could be wrong with IDEA making javac generate a class file it could not parse later?
--
Maxim Shafirov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Maxim Shafirov (JetBrains) wrote:
>> No, I mean CAP pre-release builds of JDK 1.5. It looks like that's not
>> your problem though, it's probably something wrong with IDEA.
Is there something I can add to my OP that will help figure this out?
Regards,
Matt
Matt Mower wrote:
>> Keith Lea wrote:
>>
>>> No, I mean CAP pre-release builds of JDK 1.5. It looks like that's
>>> not your problem though, it's probably something wrong with IDEA.
>>
>>
>> I wonder what could be wrong with IDEA making javac generate a class
>> file it could not parse later?
>>
Could you please validate that the problem persists (disappears) when compiling that code outside of the IDEA. I mean
compile the annotation class only and then the "client" class adding annotation class into the compiler's classpath.
--
Maxim Shafirov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Maxim Shafirov (JetBrains) wrote:
I dropped into command prompt window, set path to JDK1.5-beta2, changed
to the directory where the java source files are located.
I was then able to do:
javac -g Transactional.java
javac -g TestAnnotations.java
without error. Using 'fc' I was able to verify that the .class files
were identical to those being generated building using IDEA.
Regards,
Matt
Hi,
-source -target javac parameters mismatch ? Those have changed between
jdk1.5b1 and jdk1.5b2.
Sincerely,
ToMiC
"Matt Mower" <matt@evectors.com> wrote in message
news:c9dhoo$cc3$1@is.intellij.net...
>
>
>
>
>
>
Toader Mihai Claudiu wrote:
I'm not passing any additional parameters to javac (in the IDEA compiler
configuration dialog) and I suspect IDEA is not supplying any since the
.class files produced by IDEA and those produced on the cmd line using
javac -g were identical.
I'm still trying to work out, based upon Maxims comment, if this is
something I am doing wrong, a problem in IDEA, or an incompatibility
between IDEA and JDK1.5beta2.
Regards,
Matt
IDEA supplies additional parameters to the javac command line.
You will be able to see the exact command line that is executed if you enable logging in /bin/log.xml file by adding this: ]]>
--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"
Eugene Zhuravlev (JetBrains) wrote:
Here is the result of doing that:
2004-05-31 14:09:54,951 DEBUG -
ompiler.BackendCompilerWrapper - C:\Program
Files\Java\jdk1.5.0\bin\javaw.exe -Xmx128m -classpath C:\Program
Files\Java\jdk1.5.0\lib\tools.jar;C:\java\pallada2061\lib\idea_rt.jar
com.intellij.rt.compiler.JavacRunner "java version "1.5.0-beta2""
com.sun.tools.javac.Main -source 1.5 -verbose -classpath C:\Program
Files\Java\jdk1.5.0\jre\lib\charsets.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\deploy.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\javaws.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\jce.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\jsse.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\plugin.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\rt.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\ext\dnsns.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\ext\localedata.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\ext\sunjce_provider.jar;C:\Program
Files\Java\jdk1.5.0\jre\lib\ext\sunpkcs11.jar;C:\Documents and
Settings\Matt\IdeaProjects\Test\classes -sourcepath "" -d C:\Documents
and Settings\Matt\IdeaProjects\Test\classes -g -deprecation
@C:\DOCUME1\Matt\LOCALS1\Temp\javac43894.tmp
Regards,
Matt
I've done a little investigation and found out that the code generated by javac contradicts with the specification of the class file
format for annotations. So when IDEA parses the generated class file (according to the specification), you get the error.
It is unclear if this is a specification change or a javac bug introduced recently (this worked in previous JDK 1.5 beta builds).
The latest class file format specs I checked were unchanged in this area, so I suspect that this is a javac bug.
Submitted a bug to Sun.
--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"
Eugene Zhuravlev (JetBrains) wrote:
Thanks Eugene.
Matt
Does it have an assigned bug number that I can track?
Here's the reply fom Sun:
Thank you for reporting this issue.
This issue is related to Bug ID: 5020908, which covers all the primitive types as well as boolean. Thank you for providing
additional information for our investigation.
You can review this bug and look for related issues on the Java Developer Connection Bug Database at:
http://developer.java.sun.com/developer/bugParade/
and
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5020908
--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"
"Kohsuke Kawaguchi" <no_mail@jetbrains.com> wrote in message news:23901467.1086830380448.JavaMail.itn@is.intellij.net...
The actual prblem is that this bug covers jsr-175/jsr-202 spec, and not
beta2 implementation. Thus without having a spec, we do not know how the
information is encoded in classfile.
"Eugene Zhuravlev (JetBrains)" <jeka@intellij.com> wrote in message
news:caunqm$7ht$1@is.intellij.net...
>
>
types as well as boolean. Thank you for providing
>
Connection Bug Database at:
>
>
>
news:23901467.1086830380448.JavaMail.itn@is.intellij.net...
>
>
Hi!
I'n new to Java and IntelliJ (been vworking with DotNet for some years now), so I apologize in advance for any stupid questions I might ask, and please treat me as a complete newbie when answering.... :o)
I'm struggeling with the discussed issue on my machine, and I can't seem to get rid of all the "Bad class file format" -errors when compiling.
I'm supposed to extend som functionality in an existing project which was developed on JDK 1.4.2 and Tomcat 5.0.
I got this successfully up and running (without any compile errors) on my machine, and all was good until it crashed and I had to format and reinstall everything. (The crash had nothing to do with the JavaVM or IntelliJ by the way.)
Whith the main software up and running for the second time, I installed Tomcat 5.5 and JDK 1.5 and tried to run the project. As this didn't work I uninstalled Tomcat 5.5 and "downgraded" it to version 5.0. Now I was able to run and debug the project, and all seemed fine. But when I try to add or change a class-file and compile, the error-messages pops up! I've uninstalled JDK 1.5, installed 1.4.2 and set all references accordingly, but with no luck.
After fiddling around with this for a while, I found out the following pattern/workaround:
- first I change some class-file
- I build the project or module, and receive the error
- Then I have to rebuild the project (and receive a whole bunch of "Bad file format"-errors)
- At this point I can finally build the project or module without any errors
Could anyone please help me out here??
Regards YonZo
ere is a small (and
http://www.replicahandbagss.com/handbags/louis-vuitton-handbag-replica-95017-white-1674-751.html ere is a small (and http://www.replicahandbagss.com/handbags/chanel-blue-chamois-35491-4566-3630.html ere is a small (and http://www.replicahandbagss.com/replica-handbags/prada-handbags.html ere is a small (and http://www.replicahandbagss.com/handbags/hermes-handbag-birkin-35-black-epsom-leather-herepbirk35blk-2070-1192.html ere is a small (and http://www.replicahandbagss.com/handbags/cambon-wallet-long-zip-black-4848-3943.html ere is a small (and http://www.replicahandbagss.com/replica-handbags/chloe-handbags.html
---
Original message URL: http://devnet.jetbrains.net/message/5269796#5269796
It sounds like you have some bad files on your classpath (either jars or class files). Have you tried deleting all locally generated code and rebuilding all using the target JDK? You may also have some version mismatches, but that usually generates a different error, but not sure about runtime versus compile time.