Bug 103466 - Stack Overflow: Requesting Java AST from selection
Summary: Stack Overflow: Requesting Java AST from selection
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal with 2 votes (vote)
Target Milestone: 3.1.1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-12 06:12 EDT by Wolfgang Licht CLA
Modified: 2005-09-26 10:46 EDT (History)
0 users

See Also:


Attachments
Fix (1.15 KB, patch)
2005-08-22 11:23 EDT, Jerome Lanneluc CLA
no flags Details | Diff
Regression test (3.34 KB, patch)
2005-08-22 11:23 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Licht CLA 2005-07-12 06:12:00 EDT
The bug occurs in Eclipse 3.1, whereas in 3.0 everything is fine.

The error-message I get is "An internal error occurred during 'Requesting Java 
AST from selection'", resulting from the following stack-trace in the Eclipse-
log (Note that the stack overflow seems to result from a loop):

!ENTRY org.eclipse.core.runtime 4 2 2005-07-12 09:31:35.365
!MESSAGE An internal error occurred during: "Requesting Java AST from 
selection".
!STACK 0
java.lang.StackOverflowError
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo
(JavaElement.java:230)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo
(JavaElement.java:218)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.getKind
(PackageFragmentRoot.java:538)
	at org.eclipse.jdt.internal.core.PackageFragment.getKind
(PackageFragment.java:268)
	at org.eclipse.jdt.internal.core.PackageFragment.getClassFiles
(PackageFragment.java:177)
	at org.eclipse.jdt.internal.core.NameLookup.seekTypesInBinaryPackage
(NameLookup.java:793)
	at org.eclipse.jdt.internal.core.NameLookup.seekTypes
(NameLookup.java:769)
	at org.eclipse.jdt.internal.core.NameLookup.findType
(NameLookup.java:542)
	at org.eclipse.jdt.internal.core.NameLookup.findType
(NameLookup.java:501)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.find
(SearchableEnvironment.java:85)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.findType
(SearchableEnvironment.java:177)
	at org.eclipse.jdt.internal.core.CancelableNameEnvironment.findType
(CancelableNameEnvironment.java:50)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType
(LookupEnvironment.java:93)
	at 
org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve
(UnresolvedReferenceBinding.java:43)
	at 
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveUnresolvedType
(BinaryTypeBinding.java:92)
	at 
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.enclosingType
(BinaryTypeBinding.java:516)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.<init>
(BinaryTypeBinding.java:144)
	at 
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom
(LookupEnvironment.java:468)
	at 
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom
(LookupEnvironment.java:465)
	at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:190)

........ (many times the same) ........

	at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:190)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType
(LookupEnvironment.java:99)
	at 
org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve
(UnresolvedReferenceBinding.java:43)
	at 
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveUnresolvedType
(BinaryTypeBinding.java:92)
	at 
org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.enclosingType
(BinaryTypeBinding.java:516)
!SESSION 2005-07-12 09:31:44.729 -----------------------------------------------
eclipse.buildId=I20050627-1435
java.version=1.5.0_04
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments:  -os win32 -ws win32 -arch x86


The error happens when clicking anywhere in an editor-window containing the 
following code:

package dvl.tst;
import dev.etd.CAConfMsgSet.Helper;
public class AstTest    {
	public AstTest() { 
		Helper sec = new Helper();
		sec.get$1().get$2().get$3().getSfkpngPlaceString();
	}
}

where Helper has the following content (simplified to make tracking easier):

package dev.etd.CAConfMsgSet;
public class Helper {
  public void init() {
  }
  public static class $1 {
    public static class $2 {
      public static class $3 {
        public java.lang.String getSfkpngPlaceString() {
          return "String"; 
        }
      }
      $3 _$3;
      public $3 get$3() {
        if (_$3 == null) _$3 = new $3();
        return _$3;
      }
    }
    $2 _$2;
    public $2 get$2() {
      if (_$2 == null) {_$2 = new $2();}
      return _$2;
    }
  }
  $1 _$1;
  public $1 get$1() {
    if (_$1 == null) _$1 = new $1();
    return _$1;
  }
}

Please note that the error only happens when Helper-class is packaged in a jar-
file.

Setup for the test: Just the java-file above in the project plus the class-file 
packaged in a jar (nothing else).
Comment 1 Jerome Lanneluc CLA 2005-08-22 11:23:24 EDT
Created attachment 26343 [details]
Fix
Comment 2 Jerome Lanneluc CLA 2005-08-22 11:23:46 EDT
Created attachment 26344 [details]
Regression test
Comment 3 Philipe Mulet CLA 2005-09-01 06:06:05 EDT
+1 for 3.1.1
Comment 4 Jerome Lanneluc CLA 2005-09-01 07:24:59 EDT
Released fix and regression test in both HEAD and R3_1_maintenance branch.
Comment 5 David Audel CLA 2005-09-21 09:25:45 EDT
Verified in I20050920-0010 for 3.2M2
Comment 6 Olivier Thomann CLA 2005-09-26 10:46:25 EDT
Verified for 3.1.1 using M20050923-1430.