Bug 100302 - StackOverflowError during completion
Summary: StackOverflowError during completion
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-15 16:32 EDT by Christopher G. Stach II CLA
Modified: 2005-06-16 14:57 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (5.54 KB, text/plain)
2005-06-16 09:04 EDT, David Audel CLA
no flags Details
Regression test (3.98 KB, text/plain)
2005-06-16 09:06 EDT, David Audel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher G. Stach II CLA 2005-06-15 16:32:43 EDT
private void processProperties(PropertiesList propertiesList) {
		Map map = propertiesList.getPropertyMap("MainMenu.button");

		for (Map.Entry entry : (Set<Map.Entry>) map.entrySet()) {
			Button button = new Button();
			button.setActionCommand((String) entry.());
			map.getKey();
		}
	}

Hitting Ctrl-SP while between: 'entry.' and '());' generates this error.

eclipse.buildId=I20050610-1757
java.version=1.5.0_03
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86

java.lang.StackOverflowError
at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2393)
at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2333)
at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2282)
at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2445)
at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2393)
at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2333)
at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2282)
at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2445)
at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2393)
at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2333)
at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2282)
at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2445)
at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2393)
[... ad nauseam ...]
Comment 1 Olivier Thomann CLA 2005-06-15 20:47:45 EDT
The local type binding of entry has the following type:

Entry#RAW[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
entry[pos: unused][id:1]

This could easily provoque a StackOverFlowError.

I will try to understand why we get this type binding.
Comment 2 Olivier Thomann CLA 2005-06-15 21:21:49 EDT
We have a bug in the assist parser where the dimension of the local entry is 235.

The problem occurs because of the cast expression with a generic type. If you
remove the generic type, it works.

Here is a simpler test case:

import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

public class X {
	private void processProperties(Map map) {
		for (Entry entry : (Set<Entry>) map.entrySet()) {
			entry.<code assist>
Comment 3 Olivier Thomann CLA 2005-06-16 08:52:27 EDT
The problem is that according to where the code is located in the unit, this
dimension will be too high and cause the StackOverFlowError.
Comment 4 Philipe Mulet CLA 2005-06-16 09:04:20 EDT
+1 for RC3

Dani: pls vote for it.
Comment 5 David Audel CLA 2005-06-16 09:04:56 EDT
Created attachment 23318 [details]
Proposed patch
Comment 6 David Audel CLA 2005-06-16 09:06:40 EDT
Created attachment 23319 [details]
Regression test
Comment 7 David Audel CLA 2005-06-16 09:13:29 EDT
position of '<' is in not correctly unstacked from intStack and
Signature.appendArrayTypeSignature() should not use a recursive algorithm to
append '['.
Comment 8 Dani Megert CLA 2005-06-16 09:22:00 EDT
+1 for 3.1 RC3
Comment 9 David Audel CLA 2005-06-16 10:18:27 EDT
Fix released and tests added
  GenericsCompletionParserTest#test0202() -> test0203()
Comment 10 Maxime Daniel CLA 2005-06-16 13:53:16 EDT
Verified using build N20050616-0010 + JDT Core HEAD.
Comment 11 Olivier Thomann CLA 2005-06-16 14:57:11 EDT
Verified using N20050616-0010 + JDT/Core HEAD