| Summary: | StackOverflow when tryiing to open a xtend file | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Ingo Meyer <ingo.meyer> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sebastian.zarnekow |
| Version: | unspecified | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Ingo Meyer
Please attach an example that reproduces the issue. (In reply to comment #1) > Please attach an example that reproduces the issue. Any chance to get a repro? (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) I forgot to say that the first of themethod gives the error. Very strange as the first three are almost the same... I'll try to reproduce as soon as possible. Thanks for coming back to this one. 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 }
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 )
}
Thanks a lot, I can reproduce the problem. Pushed to master. Thanks for your help, Ingo. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |