Exemple #1
0
 @BeforeClass
 public static void setUpProject() throws Exception {
   IResourcesSetupUtil.cleanWorkspace();
   final IWorkspace workspace = ResourcesPlugin.getWorkspace();
   final IWorkspaceDescription description = workspace.getDescription();
   boolean _isAutoBuilding = description.isAutoBuilding();
   BuildAffectionTest.wasAutoBuilding = _isAutoBuilding;
   description.setAutoBuilding(false);
   workspace.setDescription(description);
   WorkbenchTestHelper.createPluginProject(WorkbenchTestHelper.TESTPROJECT_NAME);
 }
Exemple #2
0
 private IFile createClientProjectFile(final String name, final CharSequence content) {
   try {
     IFile _xblockexpression = null;
     {
       IProject _createPluginProject = WorkbenchTestHelper.createPluginProject("test.client");
       this.clientProject = _createPluginProject;
       IJavaProject _create = JavaCore.create(this.clientProject);
       IProject _project = this.workbenchTestHelper.getProject();
       IJavaProject _create_1 = JavaCore.create(_project);
       JavaProjectSetupUtil.addProjectReference(_create, _create_1);
       Path _path = new Path((("test.client/src/" + name) + ".xtend"));
       String _string = content.toString();
       _xblockexpression = IResourcesSetupUtil.createFile(_path, _string);
     }
     return _xblockexpression;
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
 @Test
 public void testCompileWithJava5() {
   try {
     this.workbenchTestHelper.tearDown();
     WorkbenchTestHelper.createPluginProject(
         WorkbenchTestHelper.TESTPROJECT_NAME, JavaVersion.JAVA5);
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("package mypackage");
     _builder.newLine();
     _builder.append("class B implements A {");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("override a() {");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     _builder.append("interface A {");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("def void a()");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     final IFile xtendFile =
         this.workbenchTestHelper.createFile("mypackage/OverrideTest.xtend", _builder.toString());
     IResourcesSetupUtil.waitForBuild();
     this.assertNoErrors(xtendFile);
     IProject _project = xtendFile.getProject();
     final String content = this.getJavaFileContent("xtend-gen/mypackage/B.java", _project);
     boolean _contains = content.contains("@Override");
     Assert.assertFalse("@Override annotation was generated, but it shouldn\'t.", _contains);
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
 /** https://bugs.eclipse.org/bugs/show_bug.cgi?id=439925 */
 @Test
 public void testClassLoaderSeesAllUpstreamProjects() {
   try {
     IProject _createPluginProject = WorkbenchTestHelper.createPluginProject("macroProject");
     final IJavaProject macroProject = JavaCore.create(_createPluginProject);
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("package annotation");
     _builder.newLine();
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.AbstractClassProcessor");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.Active");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.TransformationContext");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration");
     _builder.newLine();
     _builder.newLine();
     _builder.append("@Active(MyAAProcessor)");
     _builder.newLine();
     _builder.append("annotation MyAA {");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("class MyAAProcessor extends AbstractClassProcessor {");
     _builder.newLine();
     _builder.append("\t");
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "override doTransform(MutableClassDeclaration annotatedClass, extension TransformationContext context) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append(
         "val comment = getClass.getClassLoader.loadClass(\"mylib.Lib\").newInstance.toString");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("annotatedClass.docComment = comment");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     this.newSource(macroProject, "annotation/MyAA.xtend", _builder.toString());
     this.addExportedPackage(macroProject, "annotation");
     IProject _createPluginProject_1 = WorkbenchTestHelper.createPluginProject("libProject");
     final IJavaProject libProject = JavaCore.create(_createPluginProject_1);
     StringConcatenation _builder_1 = new StringConcatenation();
     _builder_1.append("package mylib");
     _builder_1.newLine();
     _builder_1.newLine();
     _builder_1.append("class Lib {");
     _builder_1.newLine();
     _builder_1.append("\t");
     _builder_1.append("override String toString() {");
     _builder_1.newLine();
     _builder_1.append("\t\t");
     _builder_1.append("return \"HUNKELDUNKEL\"");
     _builder_1.newLine();
     _builder_1.append("\t");
     _builder_1.append("}");
     _builder_1.newLine();
     _builder_1.append("}");
     _builder_1.newLine();
     this.newSource(libProject, "mylib/Lib.xtend", _builder_1.toString());
     this.addExportedPackage(libProject, "mylib");
     IResourcesSetupUtil.waitForAutoBuild();
     IProject _createPluginProject_2 =
         WorkbenchTestHelper.createPluginProject(
             "userProject",
             "com.google.inject",
             "org.eclipse.xtend.lib",
             "org.eclipse.xtend.core.tests",
             "org.eclipse.xtext.xbase.lib",
             "org.eclipse.xtend.ide.tests.data",
             "org.junit",
             "macroProject",
             "libProject");
     final IJavaProject userProject = JavaCore.create(_createPluginProject_2);
     StringConcatenation _builder_2 = new StringConcatenation();
     _builder_2.append("package client");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("@annotation.MyAA");
     _builder_2.newLine();
     _builder_2.append("class SomeClass {");
     _builder_2.newLine();
     _builder_2.append("}");
     _builder_2.newLine();
     this.newSource(userProject, "client/A.xtend", _builder_2.toString());
     IResourcesSetupUtil.cleanBuild();
     NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
     IResourcesSetupUtil.waitForBuild(_nullProgressMonitor);
     IResourcesSetupUtil.assertNoErrorsInWorkspace();
     IResource _file = IResourcesSetupUtil.file("userProject/xtend-gen/client/SomeClass.java");
     InputStream _contents = ((IFile) _file).getContents();
     InputStreamReader _inputStreamReader = new InputStreamReader(_contents);
     final String javaCode = CharStreams.toString(_inputStreamReader);
     boolean _contains = javaCode.contains("HUNKELDUNKEL");
     Assert.assertTrue(_contains);
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
 @Test
 public void testStaticInitializers() {
   try {
     IProject _createPluginProject = WorkbenchTestHelper.createPluginProject("macroProject");
     final IJavaProject macroProject = JavaCore.create(_createPluginProject);
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("package annotation");
     _builder.newLine();
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.AbstractClassProcessor");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.Active");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.TransformationContext");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.declaration.Visibility");
     _builder.newLine();
     _builder.newLine();
     _builder.append("@Active(MyAAProcessor)");
     _builder.newLine();
     _builder.append("annotation MyAA {");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("class MyAAProcessor extends AbstractClassProcessor {");
     _builder.newLine();
     _builder.append("\t");
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "override doTransform(MutableClassDeclaration annotatedClass, extension TransformationContext context) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("annotatedClass.addField(\'CONSTANT_INT\') [");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("type = primitiveInt");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("visibility = Visibility.PUBLIC");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("constantValueAsInt = 42");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("]");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("annotatedClass.addField(\'CONSTANT_LONG\') [");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("type = primitiveLong");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("visibility = Visibility.PUBLIC");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("constantValueAsLong = 42");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("]");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("annotatedClass.addField(\'CONSTANT_FLOAT\') [");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("type = primitiveFloat");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("visibility = Visibility.PUBLIC");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("constantValueAsFloat = 42.34f");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("]");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("annotatedClass.addField(\'CONSTANT_DOUBLE\') [");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("type = primitiveDouble");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("visibility = Visibility.PUBLIC");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("constantValueAsDouble = 42.11d");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("]");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("annotatedClass.addField(\'CONSTANT_CHAR\') [");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("type = primitiveChar");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("visibility = Visibility.PUBLIC");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("constantValueAsChar = \'\\n\'");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("]");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("annotatedClass.addField(\'CONSTANT_STRING\') [");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("type = string");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("visibility = Visibility.PUBLIC");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("constantValueAsString = \"\\n\\t\\\\all\"");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("]");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     this.newSource(macroProject, "annotation/MyAA.xtend", _builder.toString());
     IProject _project = macroProject.getProject();
     WorkbenchTestHelper.addExportedPackages(_project, "annotation");
     IResourcesSetupUtil.waitForBuild();
     IProject _createPluginProject_1 =
         WorkbenchTestHelper.createPluginProject(
             "userProject",
             "com.google.inject",
             "org.eclipse.xtend.lib",
             "org.eclipse.xtend.core.tests",
             "org.eclipse.xtext.xbase.lib",
             "org.eclipse.xtend.ide.tests.data",
             "org.junit",
             "macroProject");
     final IJavaProject userProject = JavaCore.create(_createPluginProject_1);
     StringConcatenation _builder_1 = new StringConcatenation();
     _builder_1.append("package client");
     _builder_1.newLine();
     _builder_1.newLine();
     _builder_1.append("@SuppressWarnings(client.sub.B.CONSTANT_STRING)");
     _builder_1.newLine();
     _builder_1.append("class A {");
     _builder_1.newLine();
     _builder_1.append("}");
     _builder_1.newLine();
     this.newSource(userProject, "client/A.xtend", _builder_1.toString());
     StringConcatenation _builder_2 = new StringConcatenation();
     _builder_2.append("package client.sub");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("import annotation.MyAA");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("@MyAA");
     _builder_2.newLine();
     _builder_2.append("class B {");
     _builder_2.newLine();
     _builder_2.append("}");
     _builder_2.newLine();
     this.newSource(userProject, "client/sub/B.xtend", _builder_2.toString());
     IResourcesSetupUtil.cleanBuild();
     IResourcesSetupUtil.waitForBuild();
     IProject _project_1 = userProject.getProject();
     IResource _findMember = _project_1.findMember("xtend-gen/client/sub/B.java");
     final IFile file = ((IFile) _findMember);
     final String contents = WorkbenchTestHelper.getContentsAsString(file);
     StringConcatenation _builder_3 = new StringConcatenation();
     _builder_3.append("package client.sub;");
     _builder_3.newLine();
     _builder_3.newLine();
     _builder_3.append("import annotation.MyAA;");
     _builder_3.newLine();
     _builder_3.newLine();
     _builder_3.append("@MyAA");
     _builder_3.newLine();
     _builder_3.append("@SuppressWarnings(\"all\")");
     _builder_3.newLine();
     _builder_3.append("public class B {");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.append("public final static int CONSTANT_INT = 42;");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.append("public final static long CONSTANT_LONG = 42L;");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.append("public final static float CONSTANT_FLOAT = 42.34f;");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.append("public final static double CONSTANT_DOUBLE = 42.11d;");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.append("public final static char CONSTANT_CHAR = \'\\n\';");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.newLine();
     _builder_3.append("  ");
     _builder_3.append("public final static String CONSTANT_STRING = \"\\n\\t\\\\all\";");
     _builder_3.newLine();
     _builder_3.append("}");
     _builder_3.newLine();
     String _string = _builder_3.toString();
     Assert.assertEquals(_string, contents);
     IResourcesSetupUtil.assertNoErrorsInWorkspace();
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
 @Test
 public void testBug461761() {
   try {
     IProject _createPluginProject = WorkbenchTestHelper.createPluginProject("macroProject");
     final IJavaProject macroProject = JavaCore.create(_createPluginProject);
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("package annotation");
     _builder.newLine();
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.AbstractClassProcessor");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.Active");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.RegisterGlobalsContext");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration");
     _builder.newLine();
     _builder.append("import static extension com.google.common.io.Files.append");
     _builder.newLine();
     _builder.newLine();
     _builder.append("@Active(DItemMiniProcessor)");
     _builder.newLine();
     _builder.append("annotation DItemMini {");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("class DItemMiniProcessor extends AbstractClassProcessor {");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "override doRegisterGlobals(ClassDeclaration annotatedClass, extension RegisterGlobalsContext context) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("registerClass(annotatedClass.qualifiedName + \"Item\")");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     this.newSource(macroProject, "annotation/DItemMini.xtend", _builder.toString());
     IProject _project = macroProject.getProject();
     WorkbenchTestHelper.addExportedPackages(_project, "annotation");
     IResourcesSetupUtil.waitForBuild();
     IProject _createPluginProject_1 =
         WorkbenchTestHelper.createPluginProject(
             "userProject",
             "com.google.inject",
             "org.eclipse.xtend.lib",
             "org.eclipse.xtend.core.tests",
             "org.eclipse.xtext.xbase.lib",
             "org.eclipse.xtend.ide.tests.data",
             "org.junit",
             "macroProject");
     final IJavaProject userProject = JavaCore.create(_createPluginProject_1);
     StringConcatenation _builder_1 = new StringConcatenation();
     _builder_1.append("package client");
     _builder_1.newLine();
     _builder_1.append("@annotation.DItemMini");
     _builder_1.newLine();
     _builder_1.append("class UserCode{");
     _builder_1.newLine();
     _builder_1.append("\t");
     _builder_1.append("UserCodeItem item");
     _builder_1.newLine();
     _builder_1.append("}");
     _builder_1.newLine();
     this.newSource(userProject, "client/UserCode.xtend", _builder_1.toString());
     IResourcesSetupUtil.waitForBuild();
     IResourcesSetupUtil.assertNoErrorsInWorkspace();
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
 @Ignore(
     "It fails because JDT doesn\'t provide annotation values of annotation.MyClass. For some unknown reason the binding is set to null which makes JDT filtering them out.")
 @Test
 public void testBug461761_03() {
   try {
     IProject _createPluginProject = WorkbenchTestHelper.createPluginProject("macroProject");
     final IJavaProject macroProject = JavaCore.create(_createPluginProject);
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("package annotation");
     _builder.newLine();
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.AbstractClassProcessor");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.Active");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.RegisterGlobalsContext");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.declaration.*");
     _builder.newLine();
     _builder.newLine();
     _builder.append("@Active(DItemMiniProcessor)");
     _builder.newLine();
     _builder.append("annotation DItemMini {");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("MyEnum[] enumVals = #[MyEnum.VAL1]");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("Class<?> someType = MyEnum");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("class DItemMiniProcessor extends AbstractClassProcessor {");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "override doRegisterGlobals(ClassDeclaration annotatedClass, extension RegisterGlobalsContext context) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append(
         "val annotationRef = (findUpstreamType(\"annotation.MyClass\") as ClassDeclaration).annotations.head");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("val suffix = annotationRef.getValue(\"someType\") as TypeReference");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append(
         "val enums = annotationRef.getValue(\"enumVals\") as EnumerationValueDeclaration[]");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append(
         "registerClass(annotatedClass.qualifiedName + suffix.simpleName + enums.map[simpleName].join)");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     this.newSource(macroProject, "annotation/DItemMini.xtend", _builder.toString());
     StringConcatenation _builder_1 = new StringConcatenation();
     _builder_1.append("package annotation");
     _builder_1.newLine();
     _builder_1.newLine();
     _builder_1.append("enum MyEnum {");
     _builder_1.newLine();
     _builder_1.append("\t");
     _builder_1.append("VAL1, VAL2");
     _builder_1.newLine();
     _builder_1.append("}");
     _builder_1.newLine();
     this.newSource(macroProject, "annotation/StaticFeatures.xtend", _builder_1.toString());
     StringConcatenation _builder_2 = new StringConcatenation();
     _builder_2.append("package annotation;");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("import static annotation.MyEnum.*;");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("@DItemMini(enumVals={VAL2, VAL2}, someType=String.class) ");
     _builder_2.newLine();
     _builder_2.append("public class MyClass {");
     _builder_2.newLine();
     _builder_2.append("}");
     _builder_2.newLine();
     this.newSource(macroProject, "annotation/MyClass.java", _builder_2.toString());
     IProject _project = macroProject.getProject();
     WorkbenchTestHelper.addExportedPackages(_project, "annotation");
     IResourcesSetupUtil.waitForBuild();
     IProject _createPluginProject_1 =
         WorkbenchTestHelper.createPluginProject(
             "userProject",
             "com.google.inject",
             "org.eclipse.xtend.lib",
             "org.eclipse.xtend.core.tests",
             "org.eclipse.xtext.xbase.lib",
             "org.eclipse.xtend.ide.tests.data",
             "org.junit",
             "macroProject");
     final IJavaProject userProject = JavaCore.create(_createPluginProject_1);
     StringConcatenation _builder_3 = new StringConcatenation();
     _builder_3.append("package client");
     _builder_3.newLine();
     _builder_3.newLine();
     _builder_3.append("import annotation.*");
     _builder_3.newLine();
     _builder_3.append("import static annotation.MyEnum.VAL2");
     _builder_3.newLine();
     _builder_3.newLine();
     _builder_3.append("@DItemMini");
     _builder_3.newLine();
     _builder_3.append("class Processed {");
     _builder_3.newLine();
     _builder_3.append("\t");
     _builder_3.append("ProcessedStringVAL2VAL1 field");
     _builder_3.newLine();
     _builder_3.append("}");
     _builder_3.newLine();
     this.newSource(userProject, "client/UserCode.xtend", _builder_3.toString());
     IResourcesSetupUtil.waitForBuild();
     IResourcesSetupUtil.assertNoErrorsInWorkspace();
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
 @Test
 public void testBug461761_02() {
   try {
     IProject _createPluginProject = WorkbenchTestHelper.createPluginProject("macroProject");
     final IJavaProject macroProject = JavaCore.create(_createPluginProject);
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("package annotation");
     _builder.newLine();
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.AbstractClassProcessor");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.Active");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.RegisterGlobalsContext");
     _builder.newLine();
     _builder.append("import org.eclipse.xtend.lib.macro.declaration.*");
     _builder.newLine();
     _builder.newLine();
     _builder.append("@Active(DItemMiniProcessor)");
     _builder.newLine();
     _builder.append("annotation DItemMini {");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("MyEnum[] enumVals = #[MyEnum.VAL1]");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("Class<?> someType = MyEnum");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("class DItemMiniProcessor extends AbstractClassProcessor {");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "override doRegisterGlobals(ClassDeclaration annotatedClass, extension RegisterGlobalsContext context) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append(
         "val suffix = annotatedClass.annotations.head.getValue(\"someType\") as TypeReference");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append(
         "val enums = annotatedClass.annotations.head.getValue(\"enumVals\") as EnumerationValueDeclaration[]");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append(
         "registerClass(annotatedClass.qualifiedName + suffix.simpleName + enums.map[simpleName].join)");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     this.newSource(macroProject, "annotation/DItemMini.xtend", _builder.toString());
     StringConcatenation _builder_1 = new StringConcatenation();
     _builder_1.append("package annotation");
     _builder_1.newLine();
     _builder_1.newLine();
     _builder_1.append("enum MyEnum {");
     _builder_1.newLine();
     _builder_1.append("\t");
     _builder_1.append("VAL1, VAL2");
     _builder_1.newLine();
     _builder_1.append("}");
     _builder_1.newLine();
     this.newSource(macroProject, "annotation/StaticFeatures.xtend", _builder_1.toString());
     IProject _project = macroProject.getProject();
     WorkbenchTestHelper.addExportedPackages(_project, "annotation");
     IResourcesSetupUtil.waitForBuild();
     IProject _createPluginProject_1 =
         WorkbenchTestHelper.createPluginProject(
             "userProject",
             "com.google.inject",
             "org.eclipse.xtend.lib",
             "org.eclipse.xtend.core.tests",
             "org.eclipse.xtext.xbase.lib",
             "org.eclipse.xtend.ide.tests.data",
             "org.junit",
             "macroProject");
     final IJavaProject userProject = JavaCore.create(_createPluginProject_1);
     StringConcatenation _builder_2 = new StringConcatenation();
     _builder_2.append("package client");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("import annotation.*");
     _builder_2.newLine();
     _builder_2.append("import static annotation.MyEnum.VAL2");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("@DItemMini");
     _builder_2.newLine();
     _builder_2.append("class Defaults {");
     _builder_2.newLine();
     _builder_2.append("\t");
     _builder_2.append("DefaultsMyEnumVAL1 field");
     _builder_2.newLine();
     _builder_2.append("}");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("@DItemMini(enumVals=#[VAL2, MyEnum.VAL1], someType=typeof(Defaults))");
     _builder_2.newLine();
     _builder_2.append("class Explicit {");
     _builder_2.newLine();
     _builder_2.append("\t");
     _builder_2.append("ExplicitDefaultsVAL2VAL1 field");
     _builder_2.newLine();
     _builder_2.append("}");
     _builder_2.newLine();
     _builder_2.newLine();
     _builder_2.append("@DItemMini(someType=Object)");
     _builder_2.newLine();
     _builder_2.append("class Mixed {");
     _builder_2.newLine();
     _builder_2.append("\t");
     _builder_2.append("MixedObjectVAL1 field");
     _builder_2.newLine();
     _builder_2.append("}");
     _builder_2.newLine();
     this.newSource(userProject, "client/UserCode.xtend", _builder_2.toString());
     IResourcesSetupUtil.waitForBuild();
     IResourcesSetupUtil.assertNoErrorsInWorkspace();
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }