Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361647 - StackOverflow when tryiing to open a xtend file
Summary: StackOverflow when tryiing to open a xtend file
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-21 09:14 EDT by Ingo Meyer CLA
Modified: 2017-09-19 18:17 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Meyer CLA 2011-10-21 09:14:53 EDT
Build Identifier: I20110603-0909

I have updated to 2.1.0.v201110201825 and when I now try to open a xtend file i get the following error:

java.lang.StackOverflowError
	at com.google.common.collect.ForwardingMap.get(ForwardingMap.java:68)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext.getBoundArgument(TypeArgumentContext.java:64)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:93)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitWildcardTypeReference(TypeArgumentContext.java:251)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitWildcardTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmWildcardTypeReferenceImplCustom.accept(JvmWildcardTypeReferenceImplCustom.java:60)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:106)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:99)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitWildcardTypeReference(TypeArgumentContext.java:251)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitWildcardTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmWildcardTypeReferenceImplCustom.accept(JvmWildcardTypeReferenceImplCustom.java:60)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:106)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:99)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitWildcardTypeReference(TypeArgumentContext.java:251)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitWildcardTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmWildcardTypeReferenceImplCustom.accept(JvmWildcardTypeReferenceImplCustom.java:60)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:106)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)



eclipse.buildId=I20110603-0909
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.modeling.product -showlocation
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.modeling.product -showlocation


The xtend file is quite big.
Any ideas?

Reproducible: Always
Comment 1 Sebastian Zarnekow CLA 2011-10-21 17:44:12 EDT
Please attach an example that reproduces the issue.
Comment 2 Sebastian Zarnekow CLA 2011-10-24 16:56:32 EDT
(In reply to comment #1)
> Please attach an example that reproduces the issue.

Any chance to get a repro?
Comment 3 Ingo Meyer CLA 2011-10-26 04:39:25 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Please attach an example that reproduces the issue.
> 
> Any chance to get a repro?

Sorry for the late reply. I was on a business trip.
Anyway I have outcomment'ed all code in a text editor and then slowly added the methods back in the xtend editor. It came to an error in code like this:

	/*
	 * Returns all attributes referencing an entity or a valueobject
	 *
	def allAttributesOfTypeValueObject	(ComplexDataType x) { x.allAttributesOfComplexType( true, false, false ) }
	def allAttributesOfTypeEntity		(ComplexDataType x) { x.allAttributesOfComplexType( false, true, false ) }
	def allAttributesOfTypeDto			(ComplexDataType x) { x.allAttributesOfComplexType( false, false, true ) }
	/**/
	
	def allAttributesOfComplexType (ComplexDataType x, boolean vo, boolean entity, boolean dto) {
		x.allAttributes.select( e |
				(vo		&& e.isRealValueObject) // and no dtos!
			||	(entity && e.isEntity)
			||	(dto	&& e.isDto)
		)
	}

Unfortunately the file is very big and has too many dependencies to our model.
But the error changed a little bit. Maybe it will say you anything:

An internal error occurred during: "Xtext validation".
java.lang.StackOverflowError
	at org.eclipse.emf.common.util.AbstractEList$EIterator.doNext(AbstractEList.java:709)
	at org.eclipse.emf.common.util.AbstractEList$EIterator.next(AbstractEList.java:696)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitWildcardTypeReference(TypeArgumentContext.java:207)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitWildcardTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmWildcardTypeReferenceImplCustom.accept(JvmWildcardTypeReferenceImplCustom.java:60)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:106)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:99)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitWildcardTypeReference(TypeArgumentContext.java:251)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitWildcardTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmWildcardTypeReferenceImplCustom.accept(JvmWildcardTypeReferenceImplCustom.java:60)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:106)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:1)
	at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImplCustom.accept(JvmParameterizedTypeReferenceImplCustom.java:59)
	at org.eclipse.xtext.common.types.util.AbstractTypeReferenceVisitorWithParameter.visit(AbstractTypeReferenceVisitorWithParameter.java:32)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$CopyingTypeReferenceVisitor.doVisitParameterizedTypeReference(TypeArgumentContext.java:99)
	at org.eclipse.xtext.common.types.util.TypeArgumentContext$1.doVisitParameterizedTypeReference(TypeArgumentContext.java:190)
Comment 4 Ingo Meyer CLA 2011-10-26 04:41:18 EDT
I forgot to say that the first of themethod gives the error. Very strange as the first three are almost the same...
Comment 5 Sebastian Zarnekow CLA 2011-10-26 04:43:52 EDT
I'll try to reproduce as soon as possible. Thanks for coming back to this one.
Comment 6 Ingo Meyer CLA 2011-10-26 04:59:19 EDT
I adopted the code for the domainmodell example.
Unfortunately it will be ok there:

	/*
	 * Returns all attributes referencing an entity or a valueobject
	 */
	def Iterable<Feature> allAttributesOfTypeValueObject	(Entity x) { x.allAttributesOfComplexType( true, false, false ) }
	def Iterable<Feature> allAttributesOfTypeEntity			(Entity x) { x.allAttributesOfComplexType( false, true, false ) }
	def Iterable<Feature> allAttributesOfTypeDto			(Entity x) { x.allAttributesOfComplexType( false, false, true ) }
	
	def Iterable<Feature> allAttributesOfComplexType (Entity x, boolean vo, boolean entity, boolean dto) {
		x.features.filter( e |
				(vo		&& e.isRealValueObject) // and no dtos!
			||	(entity && e.isEntity)
			||	(dto	&& e.isDto)
		)
	}
	
	def boolean isRealValueObject (Feature x) { true }
	def boolean isEntity (Feature x) { true }
	def boolean isDto (Feature x) { true }
Comment 7 Ingo Meyer CLA 2011-10-26 05:12:14 EDT
Sorry for the many post here.
I was wrong, the error depends also on some other methods.
In my domainmodel example I was successfull in reproducing the error with the following code:

	/*
	 * All cdts which are in the attribute tree of the given one.
	 */
	def Iterable<Entity> allRelatedComplexTypes (Entity x) {
		val directEntities		= newArrayList( x ).union( x.allComplexTypesFromAttributes( false, x.isEntity, x.isDto ) )
		val extendingEntities	= directEntities.map( e | e.allExtenders ).flatten
		
		directEntities.union( extendingEntities )
		.filter( e | !e.abstract )
	}
	
	/*
	 * Returns all attributes referencing an valueobject in a recursive way.
	 */
	def allValueObjectsFromAttributes (Entity x) { x.allComplexTypesFromAttributes( true, false, false ) }
	
	def allComplexTypesFromAttributes (Entity x, boolean vo, boolean entity, boolean dto) {
		x.internal_allComplexTypesFromAttributes( newArrayList, vo, entity, dto )
		.filter( e | e != null ).toSet.toList
	}
	
	def internal_allComplexTypesFromAttributes (Entity x, List<Entity> visited, boolean vo, boolean entity, boolean dto) {
		if (!visited.contains( x )) {
			visited.add( x )
			val vos = x.allAttributesOfTypeValueObject.map( e | e.complexType )
			vos.union( vos.map( e | e.internal_allComplexTypesFromAttributes( visited, vo, entity, dto ) ).flatten )
		}
	}
	
	/*
	 * Returns all attributes referencing an entity or a valueobject
	 */
	def Iterable<Feature> allAttributesOfTypeValueObject	(Entity x) { x.allAttributesOfComplexType( true, false, false ) }
	def Iterable<Feature> allAttributesOfTypeEntity			(Entity x) { x.allAttributesOfComplexType( false, true, false ) }
	def Iterable<Feature> allAttributesOfTypeDto			(Entity x) { x.allAttributesOfComplexType( false, false, true ) }
	
	def Iterable<Feature> allAttributesOfComplexType (Entity x, boolean vo, boolean entity, boolean dto) {
		x.features.filter( e |
				(vo		&& e.isRealValueObject) // and no dtos!
			||	(entity && e.isEntity)
			||	(dto	&& e.isDto)
		)
	}
	
	def boolean isValueObject		(Entity x) { true }
	def boolean isEntity			(Entity x) { true }
	def boolean isDto				(Entity x) { true }
	def boolean isAbstract			(Entity x) { true }
	
	def boolean isRealValueObject	(Feature x) { true }
	def boolean isEntity			(Feature x) { true }
	def boolean isDto				(Feature x) { true }

	def Entity getComplexType (Feature x) { null }

	def <T> Iterable<T> union (Iterable<T> a, Iterable<T> b) {
		Iterables::concat( a, b )
	}
Comment 8 Sebastian Zarnekow CLA 2011-10-26 05:16:58 EDT
Thanks a lot, I can reproduce the problem.
Comment 9 Sebastian Zarnekow CLA 2011-10-26 07:28:27 EDT
Pushed to master. 

Thanks for your help, Ingo.
Comment 10 Karsten Thoms CLA 2017-09-19 18:08:18 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 11 Karsten Thoms CLA 2017-09-19 18:17:47 EDT
Closing all bugs that were set to RESOLVED before Neon.0