Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-dev] ECJ producing broken class file [urgent]

Hello there, I am using ECJ to produce all my class files and it usually works perfectly.

However, I am now seeing it produce a broken class file. I really need to resolve this.

Here is the jar containing the broken file loadableUtils/utils.class: https://botcompany.de/files/1400532/ecj-anomaly.jar

When run in JDK 17, it gives:

~/dev/the-anomaly$ java -jar ecj-anomaly.jar
Exception in thread "main" java.lang.ClassFormatError: Duplicate entry in InnerClasses attribute in class file loadableUtils/utils

It's a big class file (almost a megabyte), maybe the bug only happens with huge classes.

Inspecting utils.class with BCEL, I do find that an entry of the InnerClasses attribute is duplicated.

The ECJ version I am using is 4.19 with a slight patch (allowing the var keyword at any source level). I am pretty confident the patch is not the problem.

In order to test the compilation yourself, you can just extract the jar file which includes sources and compile loadableUtils/utils.java having the other classes in path.

One more question I have is where to get the latest ECJ version? I got a bit confused by the Eclipse website(s). Is 4.19 the latest version?

Final note: I tried to fix the broken class file using BCEL but had some problem writing the class file back which ended up truncated.

My current workaround is to use javac.

So I am really looking forward to an ECJ fix.

Many greetings,
Stefan

--

Back to the top