2017-02-16 73 views
0

我創建了一個活動註釋@Module,但我不希望生成的Java類用@Module註釋。Xtend:在代碼生成過程中刪除活動註釋

當我試圖在轉型階段,除去註釋,它來代替註釋掉的註釋(這將是罰款)​​,但保留在進口是應該去掉註釋

代碼:

override doTransform(MutableClassDeclaration annotatedClass, extension TransformationContext context) { 
    annotatedClass.removeAnnotation(annotatedClass.annotations.findFirst[annotationTypeDeclaration == Module.newTypeReference.type]) 
} 

生成類:

import my.package.Module; 

/* @Module */@SuppressWarnings("all") 
public class MyClass {} 

的Xtend版本:2.11

XBASE LIB GWT版本:2.9.2

的Xtend Eclipse插件版本:2.11

回答

0

我升級到Java 8,現在註釋移除代碼正常工作。

0

你能嘗試用Module.findTypeGlobally,而不是Module.newTypeReference.type

+0

同樣的結果。還是)感謝你的建議。 – Stinky

+0

有沒有辦法共享一個可重複的例子? –