JDK-5092545 : Assertion failed in javac (ClassWriter.java:513)
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS:
    solaris_2.5.1,solaris_10,windows_2000 solaris_2.5.1,solaris_10,windows_2000
  • CPU: x86
  • Submitted: 2004-08-26
  • Updated: 2012-10-09
  • Resolved: 2004-09-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0u1 01Fixed
Related Reports
Duplicate :  
Description
Name: js151677			Date: 08/26/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b60)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b60, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Linux xxxx 2.6.8-1.521 #1 Mon Aug 16 09:01:18 EDT 2004 i686 athlon i386 GNU/Linux


EXTRA RELEVANT SYSTEM CONFIGURATION :
Fedora Core 2, though I doubt that it's relevant

A DESCRIPTION OF THE PROBLEM :
This bug was previously submitted as number 300781, but you requested that I resubmit with a compact test case.  It was difficult because this was distilled from a very large and complex class implementation, but I have reduced it more-or-less to its essence, submitted below in the "Source Code" section.  Thank you very much for the opportunity to help you resolve this bug.

Please note that this error occurs under 1.5-beta-2 as well as the latest beta-3 snapshot.

The steps to reproduce the error and the error output are listed in the appropriate sections below


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the code listed in the "Source Code" section, using the command:
javac source-code-file-name.java


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Either successful compilation or a diagnostic indicating the error in the source code
ACTUAL -
Failed assertion in javac (see general the "Error Messages" section for details)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.5.0-beta3). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.AssertionError: writePool D
	at com.sun.tools.javac.jvm.ClassWriter.writePool(ClassWriter.java:513)
	at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1333)
	at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1211)
	at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:325)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:474)
	at com.sun.tools.javac.main.Main.compile(Main.java:592)
	at com.sun.tools.javac.main.Main.compile(Main.java:544)
	at com.sun.tools.javac.Main.compile(Main.java:58)
	at com.sun.tools.javac.Main.main(Main.java:48)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
class A
    {
    void b ( ) { }
    }

class C < D extends A >
    {
    protected D a ;

    class E
	{
	public void f ( ) { a . b ( ) ; }
	}
    }

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I have developed none as yet.
(Incident Review ID: 300911) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.5.0_01 mustang FIXED IN: 1.5.0_01 INTEGRATED IN: 1.5.0_01
26-09-2004

PUBLIC COMMENTS This program causes javac to crash: interface A { void b (); } class C<D extends A> { D a; class E { public void f () { a.b(); // causes a javac assertion error: writePool D } } } Until this is fixed, this workaround can be applied: ((A)a).b() ###@###.### 2004-08-29
29-08-2004

WORK AROUND The problem is in the inner class. Here is a workaround, change: a.b() to: ((A)a).b() ###@###.### 2004-08-29
29-08-2004

EVALUATION Wonderful example from the submitter. Thanks! This is a real problem but I don't think we can fix this for Tiger. Perhaps an update release. I will search for a workaround. ###@###.### 2004-08-26
26-08-2004