1313import de .monticore .cdinterfaceandenum ._ast .ASTCDInterface ;
1414import de .monticore .generating .templateengine .GlobalExtensionManagement ;
1515import de .monticore .generating .templateengine .StringHookPoint ;
16+ import de .monticore .java .javadsl .JavaDSLMill ;
1617import de .monticore .java .javadsl ._ast .*;
1718import de .monticore .java .javadsl ._prettyprint .JavaDSLFullPrettyPrinter ;
1819import de .monticore .java .javadsl ._visitor .JavaDSLVisitor2 ;
@@ -98,15 +99,15 @@ public void visit(ASTClassDeclaration ast) {
9899 if (i instanceof ASTMCQualifiedType ) {
99100 interfaces .add (((ASTMCQualifiedType ) i ).getMCQualifiedName ().getQName ());
100101 } else {
101- interfaces .add (i . printType ( ));
102+ interfaces .add (printJavaDSLASTMCType ( i ));
102103 }
103104 }
104105 }
105106
106107 if (ast .isPresentSuperClass ()) {
107108 classBuilder = classBuilder
108109 .setCDExtendUsage (CDExtendUsageFacade .getInstance ()
109- .createCDExtendUsage (getMCType (ast .getSuperClass ()). printType ( )));
110+ .createCDExtendUsage (printJavaDSLASTMCType ( getMCType (ast .getSuperClass ()))));
110111 }
111112
112113 ASTCDClass cdClass = classBuilder .build ();
@@ -127,7 +128,7 @@ public void visit(ASTRecordDeclaration ast) {
127128 .createCDInterfaceUsage (
128129 ast .getImplementedInterfaceList ()
129130 .stream ()
130- .map (ASTMCType :: printType )
131+ .map (this :: printJavaDSLASTMCType )
131132 .toArray (String []::new )));
132133 }
133134
@@ -168,7 +169,7 @@ public void visit(ASTInterfaceDeclaration ast) {
168169 .createCDExtendUsage (
169170 ast .getExtendedInterfaceList ()
170171 .stream ()
171- .map (ASTMCType :: printType )
172+ .map (this :: printJavaDSLASTMCType )
172173 .toArray (String []::new )))
173174 .build ();
174175
@@ -185,7 +186,7 @@ public void visit(ASTEnumDeclaration ast) {
185186 .createCDInterfaceUsage (
186187 ast .getImplementedInterfaceList ()
187188 .stream ()
188- .map (ASTMCType :: printType )
189+ .map (this :: printJavaDSLASTMCType )
189190 .toArray (String []::new )))
190191 .build ();
191192
@@ -257,7 +258,7 @@ protected ASTMCType getMCType(ASTMCType mcType) {
257258 @ Override
258259 public void visit (ASTMethodDeclaration ast ) {
259260 ASTCDMethod method = CDMethodFacade .getInstance ().createMethod (
260- getModifier (ast .getMCModifierList ().stream ().map (m -> (ASTJavaModifier ) m ).collect (Collectors .toList ())),
261+ getModifier (ast .getMCModifierList ().stream ().filter ( m -> m instanceof ASTJavaModifier ). map (m -> (ASTJavaModifier ) m ).collect (Collectors .toList ())),
261262 ast .getName ());
262263
263264 if (ast .getMCReturnType ().isPresentMCType ()) {
@@ -399,4 +400,11 @@ protected ASTModifier getModifier(List<ASTJavaModifier> modifiers) {
399400 public ASTCDCompilationUnit getCompilationUnit () {
400401 return cdCompilationUnit ;
401402 }
403+
404+ public String printJavaDSLASTMCType (ASTMCType type ) {
405+ JavaDSLMill .init ();
406+ String printedType = type .printType ();
407+ CD4CodeMill .init ();
408+ return printedType ;
409+ }
402410}
0 commit comments