Bug 100128 - [1.5][compiler] StackOverflow compiling GNU Classpath generics branch
Summary: [1.5][compiler] StackOverflow compiling GNU Classpath generics branch
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-15 03:34 EDT by Jeroen Frijters CLA
Modified: 2005-06-16 14:39 EDT (History)
2 users (show)

See Also:


Attachments
Apply patch on CaptureBinding (3.31 KB, patch)
2005-06-15 07:07 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Frijters CLA 2005-06-15 03:34:43 EDT
When compiling the generics branch of GNU Classpath (a free Java class library 
implementation) ecj dies with a StackOverflow:

----------
1. ERROR in ..\..\classpath-generics\java\util\EnumMap.java
 (at line 0)
        /* EnumMap.java - Map where keys are enum constants
        ^
Internal compiler error
java.lang.StackOverflowError
        at
org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.erasure(Typ
eVariableBinding.java:257)
        at
org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.erasure(Typ
eVariableBinding.java:257)
        at
org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.erasure(Typ
eVariableBinding.java:257)
        <... hunderds more deleted ...>
Comment 1 Jeroen Frijters CLA 2005-06-15 03:41:33 EDT
A snapshot of the GNU Classpath generics branch (ready to compile) is 
available here: http://www.frijters.net/bug100128.zip

Unzip and compile using:
ecj -1.5 -nowarn @src.lst
Comment 2 Philipe Mulet CLA 2005-06-15 06:37:24 EDT
+1 for RC3

Dani - pls cast a vote. You know how an Error is bad.
Comment 3 Dani Megert CLA 2005-06-15 07:00:18 EDT
+1 to fix this in 3.1 RC3.
Comment 4 Philipe Mulet CLA 2005-06-15 07:07:02 EDT
Created attachment 23158 [details]
Apply patch on CaptureBinding

I suspect issue arises due to capture creating a cyclic supertype (which
erasure is then falling into), as firstBound isn't protected for cycle
detection.
Comment 5 Philipe Mulet CLA 2005-06-15 07:07:48 EDT
Maxime - pls obtain a simpler testcase reproducing it.
Comment 6 Jeroen Frijters CLA 2005-06-15 10:53:21 EDT
Thanks! The patch seems to work.
Comment 7 Maxime Daniel CLA 2005-06-15 12:33:15 EDT
Shorter test case:
public class X<E>
{
  E[] m;
  public X()
  {
	X<? extends E> x = null;
	System.out.println(x.m.length);
  }
}
Comment 8 Philipe Mulet CLA 2005-06-15 12:34:31 EDT
Thanks for confirming. Also note that another issue got addressed within your
source lib (see bug 100147).
Comment 9 Philipe Mulet CLA 2005-06-15 12:37:27 EDT
Thanks Maxime. Added GenericTypeTest#test759.
Fixed
Comment 10 Olivier Thomann CLA 2005-06-16 14:38:58 EDT
Verified using N20050616-0010 + JDT/Core HEAD.
The attached project contains 3 compile errors, but no more internal compile errors.
Comment 11 Olivier Thomann CLA 2005-06-16 14:39:10 EDT
Verified using N20050616-0010 + JDT/Core HEAD