Java Code Examples for org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil#cleanBuild()
The following examples show how to use
org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil#cleanBuild() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaClasspathTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testJavaSourceLevelMismatch() throws Exception { IProject project = testHelper.getProject(); // create a fake java.util.List without type param IFolder folder = project.getFolder(new Path("src/java/util")); IResourcesSetupUtil.createFolder(folder.getFullPath()); IFile list = folder.getFile("List.xtend"); list.create(new StringInputStream("package java.util; class List {}"), true, null); IFile file = project.getFile("src/Foo.xtend"); if (!file.exists()) file.create(new StringInputStream(TEST_CLAZZ), true, null); IResourcesSetupUtil.cleanBuild(); IResourcesSetupUtil.waitForBuild(); markerAssert.assertErrorMarker(file, IssueCodes.JDK_NOT_ON_CLASSPATH); list.delete(true, null); IResourcesSetupUtil.cleanBuild(); IResourcesSetupUtil.waitForBuild(); markerAssert.assertNoErrorMarker(file); }
Example 2
Source File: ProjectImporter.java From n4js with Eclipse Public License 1.0 | 5 votes |
void importProjects() throws Exception { for (final File file : rootFolder.listFiles()) { if (file.exists() && file.isDirectory() && null != file.listFiles() && 0 < file.listFiles().length) { if (!newHashSet(file.list()).contains("_project")) { final N4JSProjectName projectName = new N4JSProjectName(file.getName()); LOG.info("Project \'" + projectName + "\' does not have .project file. Creating a temporary one on the fly..."); final File dotProject = new File(file, "_project"); assertTrue("Error while trying to create " + dotProject + " file for \'" + projectName + "\' project.", dotProject.createNewFile()); try (final PrintWriter pw = new PrintWriter(dotProject)) { pw.print(DotProjectContentProvider.getDotProjectContentForProject(projectName)); } dotProject.deleteOnExit(); LOG.info("Temporary .project file was successfully created for \'" + projectName + "\' project."); } LOG.info("Importing " + file.getName() + " into workspace..."); importProject(rootFolder, new N4JSProjectName(file.getName()), n4jsLibs); LOG.info("Project " + file.getName() + " was successfully imported into the workspace."); } else { LOG.warn("Skipped importing project from " + file + "."); } } LOG.info("Waiting for full-build to complete..."); IResourcesSetupUtil.cleanBuild(); // using full build after imports. LOG.info("Auto-build successfully completed."); }
Example 3
Source File: ClearCacheOnCleanPluginUITest.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Tests if the {@link MultiCleartriggerCache} is cleared when a 'Clean Build' is triggered. */ @Test public void testClearOnCleanBuild() throws CoreException { File prjDir = new File(PROBANDS); IProject project = ProjectTestsUtils.importProject(prjDir, PROJECT_NAME); IResource resourceABC = project.findMember("src/ABC.n4js"); IFile fileABC = ResourcesPlugin.getWorkspace().getRoot().getFile(resourceABC.getFullPath()); assertTrue(fileABC.exists()); IResourcesSetupUtil.fullBuild(); waitForAutoBuild(); syncExtAndBuild(); assertNoIssues(); // use key of API_IMPL_MAPPING SupplierWithPostAction testSupplier = new SupplierWithPostAction(); assertTrue(testSupplier.postActionTriggerCount == 0); cache.clear(MultiCleartriggerCache.CACHE_KEY_API_IMPL_MAPPING); // cache should be empty Object test = cache.get(testSupplier, MultiCleartriggerCache.CACHE_KEY_API_IMPL_MAPPING); assertTrue(testSupplier.postActionTriggerCount == 1); assertTrue("test".equals(test)); // cache should contain key cache.get(testSupplier, MultiCleartriggerCache.CACHE_KEY_API_IMPL_MAPPING); assertTrue(testSupplier.postActionTriggerCount == 1); assertTrue("test".equals(test)); // cleanBuild should clear the cache and set a new instance of ApiImplMappings IResourcesSetupUtil.cleanBuild(); waitForAutoBuild(); test = cache.get(testSupplier, MultiCleartriggerCache.CACHE_KEY_API_IMPL_MAPPING); assertTrue(test instanceof ApiImplMapping); }
Example 4
Source File: KeepLocalHistoryTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
public void assertCleanBuild(final int expectedLocalHistorySize) { try { IResourcesSetupUtil.cleanBuild(); this.assertGeneratedFiles(expectedLocalHistorySize); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 5
Source File: AbstractBuilderTest.java From n4js with Eclipse Public License 1.0 | 4 votes |
/***/ public void cleanBuild() throws CoreException { IResourcesSetupUtil.cleanBuild(); }
Example 6
Source File: JdtBasedProcessorProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
/** * https://bugs.eclipse.org/bugs/show_bug.cgi?id=439925 */ @Test public void testClassLoaderSeesAllUpstreamProjects() { try { final IJavaProject macroProject = JavaCore.create(WorkbenchTestHelper.createPluginProject("macroProject")); 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()); WorkbenchTestHelper.addExportedPackages(macroProject.getProject(), "annotation"); final IJavaProject libProject = JavaCore.create(WorkbenchTestHelper.createPluginProject("libProject")); 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()); WorkbenchTestHelper.addExportedPackages(libProject.getProject(), "mylib"); IResourcesSetupUtil.waitForBuild(); final IJavaProject userProject = JavaCore.create( WorkbenchTestHelper.createPluginProject("userProject", "com.google.inject", "org.eclipse.xtend.lib", "org.eclipse.xtext.xbase.lib", "org.eclipse.xtend.ide.tests.data", "org.junit", "macroProject", "libProject")); 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(); IResourcesSetupUtil.waitForBuild(); IResourcesSetupUtil.assertNoErrorsInWorkspace(); IResource _file = IResourcesSetupUtil.file("userProject/xtend-gen/client/SomeClass.java"); final String javaCode = WorkbenchTestHelper.getContentsAsString(((IFile) _file)); Assert.assertTrue(javaCode.contains("HUNKELDUNKEL")); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 7
Source File: JdtBasedProcessorProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Test public void testClassLoaderSeesAllUpstreamProjects_01() { try { final IJavaProject libProject = JavaCore.create(WorkbenchTestHelper.createPluginProject("libProject")); StringConcatenation _builder = new StringConcatenation(); _builder.append("package mylib"); _builder.newLine(); _builder.newLine(); _builder.append("class Lib {"); _builder.newLine(); _builder.append("\t"); _builder.append("override String toString() {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("return \"HUNKELDUNKEL\""); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("}"); _builder.newLine(); this.newSource(libProject, "mylib/Lib.xtend", _builder.toString()); WorkbenchTestHelper.addExportedPackages(libProject.getProject(), "mylib"); final IJavaProject macroProject = JavaCore.create(WorkbenchTestHelper.createPluginProject("macroProject", "com.google.inject", "org.eclipse.xtend.lib", "org.eclipse.xtext.xbase.lib", "org.eclipse.xtend.ide.tests.data", "org.junit", "libProject")); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("package annotation"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("import org.eclipse.xtend.lib.macro.AbstractClassProcessor"); _builder_1.newLine(); _builder_1.append("import org.eclipse.xtend.lib.macro.Active"); _builder_1.newLine(); _builder_1.append("import org.eclipse.xtend.lib.macro.TransformationContext"); _builder_1.newLine(); _builder_1.append("import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("@Active(MyAAProcessor)"); _builder_1.newLine(); _builder_1.append("annotation MyAA {"); _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("class MyAAProcessor extends AbstractClassProcessor {"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("override doTransform(MutableClassDeclaration annotatedClass, extension TransformationContext context) {"); _builder_1.newLine(); _builder_1.append("\t\t"); _builder_1.append("annotatedClass.docComment = new mylib.Lib().toString()"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("}"); _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); this.newSource(macroProject, "annotation/MyAA.xtend", _builder_1.toString()); WorkbenchTestHelper.addExportedPackages(macroProject.getProject(), "annotation"); IResourcesSetupUtil.waitForBuild(); final IJavaProject userProject = JavaCore.create( WorkbenchTestHelper.createPluginProject("userProject", "com.google.inject", "org.eclipse.xtend.lib", "org.eclipse.xtext.xbase.lib", "org.eclipse.xtend.ide.tests.data", "org.junit", "macroProject")); 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(); IResourcesSetupUtil.waitForBuild(); IResourcesSetupUtil.assertNoErrorsInWorkspace(); IResource _file = IResourcesSetupUtil.file("userProject/xtend-gen/client/SomeClass.java"); final String javaCode = WorkbenchTestHelper.getContentsAsString(((IFile) _file)); Assert.assertTrue(javaCode.contains("HUNKELDUNKEL")); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 8
Source File: JdtBasedProcessorProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Test public void testClassLoaderSeesAllDepsFromReferencedProjects() { try { final IJavaProject libProject = this.xtendProject("libProject"); StringConcatenation _builder = new StringConcatenation(); _builder.append("package mylib"); _builder.newLine(); _builder.newLine(); _builder.append("class Lib {"); _builder.newLine(); _builder.append("\t"); _builder.append("override String toString() {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("return \"HUNKELDUNKEL\""); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("}"); _builder.newLine(); this.newSource(libProject, "mylib/Lib.xtend", _builder.toString()); final IJavaProject macroProject = this.xtendProject("macroProject", this.xtendProject("inbetween", libProject)); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("package annotation"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("import org.eclipse.xtend.lib.macro.AbstractClassProcessor"); _builder_1.newLine(); _builder_1.append("import org.eclipse.xtend.lib.macro.Active"); _builder_1.newLine(); _builder_1.append("import org.eclipse.xtend.lib.macro.TransformationContext"); _builder_1.newLine(); _builder_1.append("import org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("@Active(MyAAProcessor)"); _builder_1.newLine(); _builder_1.append("annotation MyAA {"); _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("class MyAAProcessor extends AbstractClassProcessor {"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("override doTransform(MutableClassDeclaration annotatedClass, extension TransformationContext context) {"); _builder_1.newLine(); _builder_1.append("\t\t"); _builder_1.append("annotatedClass.docComment = new mylib.Lib().toString()"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("}"); _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); this.newSource(macroProject, "annotation/MyAA.xtend", _builder_1.toString()); IResourcesSetupUtil.waitForBuild(); final IJavaProject userProject = this.xtendProject("userProject", macroProject); 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(); IResourcesSetupUtil.waitForBuild(); IResourcesSetupUtil.assertNoErrorsInWorkspace(); IResource _file = IResourcesSetupUtil.file("userProject/xtend-gen/client/SomeClass.java"); final String javaCode = WorkbenchTestHelper.getContentsAsString(((IFile) _file)); Assert.assertTrue(javaCode.contains("HUNKELDUNKEL")); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 9
Source File: JdtBasedProcessorProviderTest.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Test public void testClassLoaderDoesNotSeeLocalClasses() { try { final IJavaProject macroProject = this.xtendProject("macroProject"); 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("try {"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("Class.forName(\"client.B\")"); _builder.newLine(); _builder.append("\t\t"); _builder.append("} catch (ClassNotFoundException e) {"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("annotatedClass.docComment = \'classnotfound\'"); _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()); IResourcesSetupUtil.waitForBuild(); final IJavaProject userProject = this.xtendProject("userProject", macroProject); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("package client;"); _builder_1.newLine(); _builder_1.append("public class B {}"); _builder_1.newLine(); this.newSource(userProject, "client/B.java", _builder_1.toString()); 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(); IResourcesSetupUtil.waitForBuild(); IResourcesSetupUtil.assertNoErrorsInWorkspace(); IResource _file = IResourcesSetupUtil.file("userProject/xtend-gen/client/SomeClass.java"); final String javaCode = WorkbenchTestHelper.getContentsAsString(((IFile) _file)); Assert.assertTrue(javaCode.contains("classnotfound")); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 10
Source File: Bug457681Test.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Test public void testDaBug_1() { try { final IJavaProject macroProject = JavaCore.create(WorkbenchTestHelper.createPluginProject("macroProject")); 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("if(annotatedClass.extendedClass.declaredSuperTypes.empty) {"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("annotatedClass.addError(\"Supertype must declare a supertype\")"); _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()); WorkbenchTestHelper.addExportedPackages(macroProject.getProject(), "annotation"); IResourcesSetupUtil.waitForBuild(); final IJavaProject userProject = JavaCore.create( WorkbenchTestHelper.createPluginProject("userProject", "com.google.inject", "org.eclipse.xtend.lib", "org.eclipse.xtext.xbase.lib", "org.eclipse.xtend.ide.tests.data", "org.junit", "macroProject")); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("package client"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("import client.sub.B"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("@SuppressWarnings(\"all\")"); _builder_1.newLine(); _builder_1.append("class A implements Cloneable {"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("public B sub"); _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.append("import client.A"); _builder_2.newLine(); _builder_2.newLine(); _builder_2.append("@MyAA"); _builder_2.newLine(); _builder_2.newLine(); _builder_2.append("class B extends A {"); _builder_2.newLine(); _builder_2.append("}"); _builder_2.newLine(); this.newSource(userProject, "client/sub/B.xtend", _builder_2.toString()); IResourcesSetupUtil.cleanBuild(); IResourcesSetupUtil.waitForBuild(); IResourcesSetupUtil.assertNoErrorsInWorkspace(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 11
Source File: Bug457681Test.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Test public void testDaBug_NoAnnotationOnA() { try { final IJavaProject macroProject = JavaCore.create(WorkbenchTestHelper.createPluginProject("macroProject")); 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("if(annotatedClass.extendedClass.declaredSuperTypes.empty) {"); _builder.newLine(); _builder.append("\t\t\t"); _builder.append("annotatedClass.addError(\"Supertype must declare a supertype\")"); _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()); WorkbenchTestHelper.addExportedPackages(macroProject.getProject(), "annotation"); IResourcesSetupUtil.waitForBuild(); final IJavaProject userProject = JavaCore.create( WorkbenchTestHelper.createPluginProject("userProject", "com.google.inject", "org.eclipse.xtend.lib", "org.eclipse.xtext.xbase.lib", "org.eclipse.xtend.ide.tests.data", "org.junit", "macroProject")); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("package client"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("import client.sub.B"); _builder_1.newLine(); _builder_1.newLine(); _builder_1.append("class A implements Cloneable {"); _builder_1.newLine(); _builder_1.append("\t"); _builder_1.append("public B sub"); _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.append("import client.A"); _builder_2.newLine(); _builder_2.newLine(); _builder_2.append("@MyAA"); _builder_2.newLine(); _builder_2.newLine(); _builder_2.append("class B extends A {"); _builder_2.newLine(); _builder_2.append("}"); _builder_2.newLine(); this.newSource(userProject, "client/sub/B.xtend", _builder_2.toString()); IResourcesSetupUtil.cleanBuild(); IResourcesSetupUtil.waitForBuild(); IResourcesSetupUtil.assertNoErrorsInWorkspace(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }