diff options
| author | Mike Rennie | 2013-03-20 21:09:29 +0000 |
|---|---|---|
| committer | Mike Rennie | 2013-03-20 21:09:29 +0000 |
| commit | ceaa6dab7f98363efa6d80e9ca1eb5604ccd3af7 (patch) | |
| tree | 6983c33fbb1363b454526ed754e9c4b07f29a7ef | |
| parent | 9a85ce7ab94b831a0a11637eef35ba66b1e93dd0 (diff) | |
| download | eclipse.pde.ui-ceaa6dab7f98363efa6d80e9ca1eb5604ccd3af7.tar.gz eclipse.pde.ui-ceaa6dab7f98363efa6d80e9ca1eb5604ccd3af7.tar.xz eclipse.pde.ui-ceaa6dab7f98363efa6d80e9ca1eb5604ccd3af7.zip | |
Bug 403258 - Use problem...more tests for anonymous implements
4 files changed, 108 insertions, 1 deletions
diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/ClassUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/ClassUsageTests.java index 65a5e09257..8e81be1fd3 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/ClassUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/ClassUsageTests.java @@ -400,6 +400,44 @@ public class ClassUsageTests extends UsageTest { } /** + * Tests that the correct markers are created and placed for anonymous types + * that illegally implement interfaces + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=403258 + * @since 1.0.300 + * @throws Exception + */ + public void testAnonymousClassIllegaImplements1I() throws Exception { + x21(true); + } + + /** + * Tests that the correct markers are created and placed for local types + * that illegally implement interfaces, where there are more than one local type in the + * compilation unit indirectly implementing the same interface via the same proxy interface + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=403258 + * @since 1.0.300 + * @throws Exception + */ + public void testAnonymousClassIllegalImplements1F() throws Exception { + x21(false); + } + + private void x21(boolean inc) { + int indId = getProblemId(IApiProblem.ILLEGAL_IMPLEMENT, IApiProblem.ANONYMOUS_TYPE); + setExpectedProblemIds(new int[] {indId}); + setExpectedLineMappings(new LineMapping[] { + new LineMapping(25, indId, new String[] {"x.y.z.testC13.testC13()", "INoImpl2"}) + }); + setExpectedMessageArgs(new String[][] { + {"x.y.z.testC13.testC13()", "INoImpl2"} + }); + String typename = "testC13"; + deployUsageTest(typename, inc); + } + + /** * Tests an anonymous type defined in the return statement of a method illegally extending a * restricted type using a full build. * diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5ClassUsageTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5ClassUsageTests.java index 4ec88951ef..e7a1a44074 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5ClassUsageTests.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/usage/Java5ClassUsageTests.java @@ -606,4 +606,44 @@ public class Java5ClassUsageTests extends ClassUsageTests { String typename = "testC12"; deployUsageTest(typename, inc); } + + /** + * Tests that the correct markers are created and placed for anonymous types + * that illegally implement interfaces + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=403258 + * @since 1.0.300 + * @throws Exception + */ + public void testAnonymousClassIllegaImplements1I() throws Exception { + x20(true); + } + + /** + * Tests that the correct markers are created and placed for local types + * that illegally implement interfaces, where there are more than one local type in the + * compilation unit indirectly implementing the same interface via the same proxy interface + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=403258 + * @since 1.0.300 + * @throws Exception + */ + public void testAnonymousClassIllegalImplements1F() throws Exception { + x20(false); + } + + private void x20(boolean inc) { + int indId = getProblemId(IApiProblem.ILLEGAL_IMPLEMENT, IApiProblem.ANONYMOUS_TYPE); + setExpectedProblemIds(new int[] {indId, indId}); + setExpectedLineMappings(new LineMapping[] { + new LineMapping(25, indId, new String[] {"x.y.z.testC13.testC13()", "INoImpl2"}), + new LineMapping(19, indId, new String[] {"x.y.z.testC13.inner.method()", "INoImpl2"}) + }); + setExpectedMessageArgs(new String[][] { + {"x.y.z.testC13.testC13()", "INoImpl2"}, + {"x.y.z.testC13.inner.method()", "INoImpl2"} + }); + String typename = "testC13"; + deployUsageTest(typename, inc); + } } diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/tests/AbstractApiTest.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/tests/AbstractApiTest.java index 206f387878..60d7ae459e 100644 --- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/tests/AbstractApiTest.java +++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/tests/AbstractApiTest.java @@ -131,7 +131,7 @@ public class AbstractApiTest extends TestCase { } // TODO Instead of failing here, we let the test continue and just have a println() (Bug 368458) - ApiPlugin.DEBUG_WORKSPACE_DELTA_PROCESSOR = true; + //ApiPlugin.DEBUG_WORKSPACE_DELTA_PROCESSOR = true; // create project and import source IJavaProject jproject = ProjectUtils.createPluginProject(name, new String[] {PDE.PLUGIN_NATURE, ApiPlugin.NATURE_ID}); diff --git a/apitools/org.eclipse.pde.api.tools.tests/test-builder/usage/class/testC13.java b/apitools/org.eclipse.pde.api.tools.tests/test-builder/usage/class/testC13.java new file mode 100644 index 0000000000..5d7f8dd356 --- /dev/null +++ b/apitools/org.eclipse.pde.api.tools.tests/test-builder/usage/class/testC13.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2013 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package x.y.z; + +import i.INoImpl2; + +public class testC13 { + + class inner { + void method() { + INoImpl2 ini2inner = new INoImpl2() { + }; + } + } + + public testC13() { + INoImpl2 ini2 = new INoImpl2() { + }; + } + +} |
