Bug 88562 - Internal compiler error when compiling GNU Classpath
Summary: Internal compiler error when compiling GNU Classpath
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-19 06:17 EST by Ziga Mahkovec CLA
Modified: 2005-03-31 10:23 EST (History)
1 user (show)

See Also:


Attachments
Patch to configure the Classpath source tree (1.65 KB, patch)
2005-03-19 06:18 EST, Ziga Mahkovec CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ziga Mahkovec CLA 2005-03-19 06:17:52 EST
When using the JDT/Core batch compiler to compile the GNU Classpath library, a
NullPointerException is thrown.  Unfortunately, I wasn't able to isolate a
simple autonomous test case.

Steps to reproduce:

1. Grab a snapshot of the Classpath source tree and unpack:

$ wget ftp://ftp.gnu.org/pub/gnu/classpath/classpath-0.14.tar.gz
$ tar zxf classpath-0.14.tar.gz; cd classpath-0.14

2. Apply the attached patch (conf.patch) to configure the source tree.  Note
that this step is only needed to make sure Configure.java is compilable. 
Normally, the ./configure script is run.

$ patch -p0 < conf.patch
$ mv gnu/classpath/Configuration.java.in \
  gnu/classpath/Configuration.java

3. Run the batch compiler.  GdkGraphics2D.java is causing the NPE, so we're
compiling it directly:

$ java -classpath jdtcore.jar \
  org.eclipse.jdt.internal.compiler.batch.Main \
  gnu/java/awt/peer/gtk/GdkGraphics2D.java

Actual Results:

1. ERROR in gnu/java/awt/peer/gtk/GdkGraphics2D.java
 (at line 0)
        /* GdkGraphics2D.java --
        ^
Internal compiler error
java.lang.NullPointerException
        at
org.eclipse.jdt.internal.compiler.ast.AllocationExpression.generateCode(AllocationExpression.java:91)
        at
org.eclipse.jdt.internal.compiler.ast.FieldDeclaration.generateCode(FieldDeclaration.java:120)
        at
org.eclipse.jdt.internal.compiler.ast.Clinit.generateCode(Clinit.java:216)
        at org.eclipse.jdt.internal.compiler.ast.Clinit.generateCode(Clinit.java:91)
        at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:561)
        at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:615)
        at
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:181)
        at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:516)
        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
        at
org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:2366)
        at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1106)
        at org.eclipse.jdt.internal.compiler.batch.Main.main(Main.java:1011)

Build Date & Platform:

eclipse-SDK-3.1M5a-linux-gtk
JRE: java-sun-1.5.0 (also reproduced using java-sun-1.4.2 and gij)

Additional Information:

This seems to be triggered by the first code block in the static initializer
(GdkGraphics2D.java, lines 102-104) -- commenting it out resolves the issue.
Comment 1 Ziga Mahkovec CLA 2005-03-19 06:18:53 EST
Created attachment 19017 [details]
Patch to configure the Classpath source tree
Comment 2 Philipe Mulet CLA 2005-03-20 04:33:54 EST
Reproduced once applying the patch and renaming Configuration.java.in into
Configuration.java, and using following .classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry
excluding="examples/|external/sax/|external/w3c_dom/|vm/reference/" kind="src"
path="classpath-0.14"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="src" path="classpath-0.14/examples"/>
	<classpathentry kind="src" path="classpath-0.14/external/sax"/>
	<classpathentry kind="src" path="classpath-0.14/external/w3c_dom"/>
	<classpathentry kind="src" path="classpath-0.14/vm/reference"/>
	<classpathentry kind="output" path="bin"/>
</classpath>
Comment 3 Philipe Mulet CLA 2005-03-20 15:06:26 EST
Simpler testcase:
public class X {
	static {
		if (true) throw new NullPointerException();
	}
	static Object o = new Object();
}
Comment 4 Philipe Mulet CLA 2005-03-20 15:14:44 EST
Needed to tag as unreachable field (static/non static) when flow info was not
reachable, so that they are not generated in the end.
Added InitializationTest#test185-186.
Fixed
Comment 5 David Audel CLA 2005-03-31 10:23:00 EST
Verified in I20050330-0500