Error "Cyclic linking detected" in editor window [message #1563697] |
Wed, 14 January 2015 10:46 |
Jonathan Koscielny Messages: 14 Registered: August 2013 |
Junior Member |
|
|
My DSL uses Xbase for referencing JVM types. Therefore I need to customize the "XImportSectionNamespaceScopeProvider" to find/build the correct XimportSection. Now I have an unexpected behavior of the editor and of the model. My DSL file currently looks like this:
delta MyDelta {
adds {
package my.pkg;
import java.util.List;
public class MyClass
implements List
{
}
}
modifies my.pkg.MyClass { // (1)
adds import java.util.ArrayList; // (2)
adds superclass ArrayList<String>;
}
}
and the corresponding grammar fragment looks like this:
Delta:
'delta' dName=ValidID '{' deltaActions+=DeltaAction* '}';
DeltaAction:
AddsUnit | ModifiesUnit | RemovesUnit;
AddsUnit:
{AddsUnit} 'adds' '{' unit=JavaCompilationUnit? '}';
ModifiesUnit:
'modifies' unit=[ClassOrInterface|QualifiedName] '{'
modifiesPackage=ModifiesPackage?
modifiesImports+=ModifiesImport*
modifiesSuperclass=ModifiesInheritance?
'}';
ModifiesPackage:
'modifies' 'package' name=QualifiedName ';';
ModifiesImport:
AddsImport | RemovesImport;
AddsImport:
'adds' importDecl=XImportDeclaration;
RemovesImport:
'removes' importDecl=XImportDeclaration;
JavaCompilationUnit:
=> (annotations+=Annotation*
'package' name=QualifiedName EOL)?
importSection=XImportSection?
typeDeclarations+=ClassOrInterfaceDeclaration;
ClassOrInterfaceDeclaration:
annotations+=Annotation* modifiers+=Modifier* classOrInterface=ClassOrInterface;
ClassOrInterface:
ClassDeclaration | InterfaceDeclaration | EnumDeclaration | AnnotationTypeDeclaration;
ClassDeclaration:
'class' name=QualifiedName typeParameters=TypeParameters?
('extends' superClass=JvmTypeReference)?
('implements' interfaces=Typelist)?
body=ClassBody;
My extended XImportSectionNamespaceScopeProvider works fine and its result is as it should be, mostly. But there is a strange behaviour of the dsl editor or validation:
I am currently working on providing the namespace scope for a ModifiesUnit. To do that, I use the reference to ClassOrInterface to copy its XImportSection and add all added import declarations. Here, I don't know what is going internally! There are two mysterias things going on!
1.) If I request the refernced ClassOrInterface, the editor shows the follwoing error on the qualified name at (1): "Cyclic linking detected : ModifiesUnit.unit->ModifiesUnit.unit" My question is: what does it mean? Why does this error occur?
I also figured out a strange thing there: I store the ClassOrInterface in a local variable and then print it to the command line. The output is the following:
org.deltaj.scoping.deltaJ.impl.ClassOrInterfaceImpl@4642f064 (eProxyURI: platform:/resource/Test/src/My.dj#xtextLink_::0.0.0.1.1::0::/2)
org.deltaj.scoping.deltaJ.impl.ClassDeclarationImpl@1c70366 (name: MyClass)
Why do I get two references there? I think this could rely on the ParserRule ClassOrInterface which only is an abstract super rule of ClassDeclaration. But why is Xtext not able to resolve the reference for the ClassOrInterface?
2.) In some cases, the attribute importDecl of the XImportDeclaration at (2) seems to be empty, but it never is.
I asked this question on stackoverflow, too. See https://stackoverflow.com/questions/27944517/error-cyclic-linking-detected-in-editor-window
[Updated on: Wed, 14 January 2015 15:14] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04558 seconds