Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 115424 Details for
Bug 247703
Removing internal superclass does not report error for removed methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed fix + regression tests
patch_247703.txt (text/plain), 19.70 KB, created by
Olivier Thomann
on 2008-10-17 12:49:25 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2008-10-17 12:49:25 EDT
Size:
19.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.api.tools.tests >Index: src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityInternalTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityInternalTests.java,v >retrieving revision 1.3 >diff -u -r1.3 ClassCompatibilityInternalTests.java >--- src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityInternalTests.java 17 Sep 2008 19:19:40 -0000 1.3 >+++ src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityInternalTests.java 17 Oct 2008 16:48:40 -0000 >@@ -30,8 +30,6 @@ > * Workspace relative path classes in bundle/project A > */ > protected static IPath WORKSPACE_CLASSES_PACKAGE_A = new Path("bundle.a/src/a/classes/internal"); >- >- protected static IPath WORKSPACE_CLASSES_PACKAGE_HIER = new Path("bundle.a/src/a/classes/hierarchy"); > > /** > * Package prefix for test classes >@@ -77,7 +75,7 @@ > protected String getTestingProjectName() { > return "classcompat"; > } >- >+ > /** > * Tests the removal of a constructor from a non-API class. > */ >@@ -86,15 +84,15 @@ > // no problems expected > performCompatibilityTest(filePath, incremental); > } >- >+ > public void testRemoveInternalConstructorI() throws Exception { > xRemoveInternalConstructor(true); > } >- >+ > public void testRemoveInternalConstructorF() throws Exception { > xRemoveInternalConstructor(false); > } >- >+ > /** > * Tests the removal of a method from a non-API class, subclassed by an API class. > */ >@@ -116,8 +114,7 @@ > } > > public void testRemoveInternalMethodI() throws Exception { >- // TODO: should be problem on existing API class >- // xRemoveInternalMethod(true); >+ xRemoveInternalMethod(true); > } > > public void testRemoveInternalMethodF() throws Exception { >Index: src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityHierarchyTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityHierarchyTests.java,v >retrieving revision 1.8 >diff -u -r1.8 ClassCompatibilityHierarchyTests.java >--- src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityHierarchyTests.java 17 Sep 2008 18:21:22 -0000 1.8 >+++ src/org/eclipse/pde/api/tools/builder/tests/compatibility/ClassCompatibilityHierarchyTests.java 17 Oct 2008 16:48:40 -0000 >@@ -110,7 +110,15 @@ > setExpectedMessageArgs(args); > performCompatibilityTest(filePath, incremental); > } >+ >+ public void testRemoveIntSuperClassWithMethodI() throws Exception { >+ xRemoveIntSuperClassWithMethod(true); >+ } > >+ public void testRemoveIntSuperClassWithMethodF() throws Exception { >+ xRemoveIntSuperClassWithMethod(false); >+ } >+ > public void testReduceHierarchyCtoAI() throws Exception { > xReduceHierarchyCtoA(true); > } >@@ -265,7 +273,7 @@ > // no problems expected > performCompatibilityTest(filePath, incremental); > } >- >+ > public void testAddInterfaceAI() throws Exception { > xAddInterfaceA(true); > } >@@ -318,17 +326,16 @@ > */ > private void xRemoveIntSuperClassWithMethod(boolean incremental) throws Exception { > IPath filePath = WORKSPACE_CLASSES_PACKAGE_A.append("RemoveIntSuperClassWithMethod.java"); >- // TODO: expect a removed method problem >+ int[] ids = new int[] { >+ getRemovedProblemId(IDelta.METHOD) >+ }; >+ setExpectedProblemIds(ids); >+ String[][] args = new String[1][]; >+ args[0] = new String[]{PACKAGE_PREFIX + "RemoveIntSuperClassWithMethod", "method()"}; >+ setExpectedMessageArgs(args); > performCompatibilityTest(filePath, incremental); > } > >- public void testRemoveIntSuperClassWithMethodI() throws Exception { >- xRemoveIntSuperClassWithMethod(true); >- } >- >- public void testRemoveIntSuperClassWithMethodF() throws Exception { >- xRemoveIntSuperClassWithMethod(false); >- } > > /* (non-Javadoc) > * @see org.eclipse.pde.api.tools.builder.tests.ApiBuilderTest#getDefaultProblemId() >Index: test-builder/baseline/bundle.a/src/a/classes/internal/RemoveInternalConstructor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.api.tools.tests/test-builder/baseline/bundle.a/src/a/classes/internal/RemoveInternalConstructor.java,v >retrieving revision 1.1 >diff -u -r1.1 RemoveInternalConstructor.java >--- test-builder/baseline/bundle.a/src/a/classes/internal/RemoveInternalConstructor.java 17 Sep 2008 17:01:27 -0000 1.1 >+++ test-builder/baseline/bundle.a/src/a/classes/internal/RemoveInternalConstructor.java 17 Oct 2008 16:48:40 -0000 >@@ -15,6 +15,6 @@ > */ > public class RemoveInternalConstructor { > >- public RemoveInternalConstructor() {} >+ public RemoveInternalConstructor(int i) {} > > } >Index: src/org/eclipse/pde/api/tools/comparator/tests/ClassDeltaTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/comparator/tests/ClassDeltaTests.java,v >retrieving revision 1.25 >diff -u -r1.25 ClassDeltaTests.java >--- src/org/eclipse/pde/api/tools/comparator/tests/ClassDeltaTests.java 17 Sep 2008 18:37:33 -0000 1.25 >+++ src/org/eclipse/pde/api/tools/comparator/tests/ClassDeltaTests.java 17 Oct 2008 16:48:40 -0000 >@@ -36,7 +36,7 @@ > public static Test suite() { > if (true) return new TestSuite(ClassDeltaTests.class); > TestSuite suite = new TestSuite(ClassDeltaTests.class.getName()); >- suite.addTest(new ClassDeltaTests("test138")); >+ suite.addTest(new ClassDeltaTests("test140")); > return suite; > } > >@@ -3229,4 +3229,49 @@ > assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); > assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); > assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); >- }} >\ No newline at end of file >+ } >+ /** >+ * Remove internal superclass that contains public method >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=247703 >+ */ >+ public void test139() { >+ deployBundles("test139"); >+ IApiProfile before = getBeforeState(); >+ IApiProfile after = getAfterState(); >+ IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); >+ assertNotNull("no api component", beforeApiComponent); >+ IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); >+ assertNotNull("no api component", afterApiComponent); >+ IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API); >+ assertNotNull("No delta", delta); >+ IDelta[] allLeavesDeltas = collectLeaves(delta); >+ assertEquals("Wrong size", 1, allLeavesDeltas.length); >+ IDelta child = allLeavesDeltas[0]; >+ assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); >+ assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); >+ assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); >+ assertFalse("Is compatible", DeltaProcessor.isCompatible(child)); >+ } >+ /** >+ * Remove internal superclass that contains public method >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=247703 >+ */ >+ public void test140() { >+ deployBundles("test140"); >+ IApiProfile before = getBeforeState(); >+ IApiProfile after = getAfterState(); >+ IApiComponent beforeApiComponent = before.getApiComponent(BUNDLE_NAME); >+ assertNotNull("no api component", beforeApiComponent); >+ IApiComponent afterApiComponent = after.getApiComponent(BUNDLE_NAME); >+ assertNotNull("no api component", afterApiComponent); >+ IDelta delta = ApiComparator.compare(beforeApiComponent, afterApiComponent, before, after, VisibilityModifiers.API); >+ assertNotNull("No delta", delta); >+ IDelta[] allLeavesDeltas = collectLeaves(delta); >+ assertEquals("Wrong size", 1, allLeavesDeltas.length); >+ IDelta child = allLeavesDeltas[0]; >+ assertEquals("Wrong kind", IDelta.REMOVED, child.getKind()); >+ assertEquals("Wrong flag", IDelta.METHOD, child.getFlags()); >+ assertEquals("Wrong element type", IDelta.CLASS_ELEMENT_TYPE, child.getElementType()); >+ assertTrue("Is compatible", DeltaProcessor.isCompatible(child)); >+ } >+} >\ No newline at end of file >Index: tests-deltas/class/test140/before/internal/p/Y.java >=================================================================== >RCS file: tests-deltas/class/test140/before/internal/p/Y.java >diff -N tests-deltas/class/test140/before/internal/p/Y.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test140/before/internal/p/Y.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+package internal.p; >+ >+public class Y { >+ private void bar() {} >+} >\ No newline at end of file >Index: tests-deltas/class/test139/after/p/X.java >=================================================================== >RCS file: tests-deltas/class/test139/after/p/X.java >diff -N tests-deltas/class/test139/after/p/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test139/after/p/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package p; >+ >+public class X {} >\ No newline at end of file >Index: tests-deltas/class/test140/resources/before/MANIFEST.MF >=================================================================== >RCS file: tests-deltas/class/test140/resources/before/MANIFEST.MF >diff -N tests-deltas/class/test140/resources/before/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test140/resources/before/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,10 @@ >+Manifest-Version: 1.0 >+Ant-Version: Apache Ant 1.7.0 >+Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.) >+Bundle-ManifestVersion: 2 >+Bundle-Name: deltatest Plug-in >+Bundle-SymbolicName: deltatest >+Bundle-Version: 1.0.0 >+Bundle-RequiredExecutionEnvironment: J2SE-1.4 >+Export-Package: p, >+ internal.p;x-internal:=true >Index: tests-deltas/class/test139/resources/after/META-INF/MANIFEST.MF >=================================================================== >RCS file: tests-deltas/class/test139/resources/after/META-INF/MANIFEST.MF >diff -N tests-deltas/class/test139/resources/after/META-INF/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test139/resources/after/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,10 @@ >+Manifest-Version: 1.0 >+Ant-Version: Apache Ant 1.7.0 >+Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.) >+Bundle-ManifestVersion: 2 >+Bundle-Name: deltatest Plug-in >+Bundle-SymbolicName: deltatest >+Bundle-Version: 2.0.0 >+Bundle-RequiredExecutionEnvironment: J2SE-1.4 >+Export-Package: p, >+ internal.p;x-internal:=true >Index: tests-deltas/class/test139/resources/before/.api_description >=================================================================== >RCS file: tests-deltas/class/test139/resources/before/.api_description >diff -N tests-deltas/class/test139/resources/before/.api_description >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test139/resources/before/.api_description 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<component name="deltatest"> >+<plugin id="deltatest" /> >+</component> >\ No newline at end of file >Index: tests-deltas/class/test140/before/p/X.java >=================================================================== >RCS file: tests-deltas/class/test140/before/p/X.java >diff -N tests-deltas/class/test140/before/p/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test140/before/p/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package p; >+ >+public class X extends internal.p.Y {} >\ No newline at end of file >Index: tests-deltas/class/test140/resources/after/.api_description >=================================================================== >RCS file: tests-deltas/class/test140/resources/after/.api_description >diff -N tests-deltas/class/test140/resources/after/.api_description >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test140/resources/after/.api_description 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<component name="deltatest"> >+<plugin id="deltatest" /> >+</component> >\ No newline at end of file >Index: tests-deltas/class/test139/before/p/X.java >=================================================================== >RCS file: tests-deltas/class/test139/before/p/X.java >diff -N tests-deltas/class/test139/before/p/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test139/before/p/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package p; >+ >+public class X extends internal.p.Y {} >\ No newline at end of file >Index: tests-deltas/class/test140/after/p/X.java >=================================================================== >RCS file: tests-deltas/class/test140/after/p/X.java >diff -N tests-deltas/class/test140/after/p/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test140/after/p/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package p; >+ >+public class X {} >\ No newline at end of file >Index: tests-deltas/class/test140/resources/after/META-INF/MANIFEST.MF >=================================================================== >RCS file: tests-deltas/class/test140/resources/after/META-INF/MANIFEST.MF >diff -N tests-deltas/class/test140/resources/after/META-INF/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test140/resources/after/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,10 @@ >+Manifest-Version: 1.0 >+Ant-Version: Apache Ant 1.7.0 >+Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.) >+Bundle-ManifestVersion: 2 >+Bundle-Name: deltatest Plug-in >+Bundle-SymbolicName: deltatest >+Bundle-Version: 2.0.0 >+Bundle-RequiredExecutionEnvironment: J2SE-1.4 >+Export-Package: p, >+ internal.p;x-internal:=true >Index: tests-deltas/class/test139/after/internal/p/Y.java >=================================================================== >RCS file: tests-deltas/class/test139/after/internal/p/Y.java >diff -N tests-deltas/class/test139/after/internal/p/Y.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test139/after/internal/p/Y.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package internal.p; >+ >+public class Y {} >\ No newline at end of file >Index: tests-deltas/class/test139/resources/before/MANIFEST.MF >=================================================================== >RCS file: tests-deltas/class/test139/resources/before/MANIFEST.MF >diff -N tests-deltas/class/test139/resources/before/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test139/resources/before/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,10 @@ >+Manifest-Version: 1.0 >+Ant-Version: Apache Ant 1.7.0 >+Created-By: 1.6.0_05-ea-b04 (Sun Microsystems Inc.) >+Bundle-ManifestVersion: 2 >+Bundle-Name: deltatest Plug-in >+Bundle-SymbolicName: deltatest >+Bundle-Version: 1.0.0 >+Bundle-RequiredExecutionEnvironment: J2SE-1.4 >+Export-Package: p, >+ internal.p;x-internal:=true >Index: tests-deltas/class/test140/after/internal/p/Y.java >=================================================================== >RCS file: tests-deltas/class/test140/after/internal/p/Y.java >diff -N tests-deltas/class/test140/after/internal/p/Y.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test140/after/internal/p/Y.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+package internal.p; >+ >+public class Y {} >\ No newline at end of file >Index: tests-deltas/class/test140/resources/before/.api_description >=================================================================== >RCS file: tests-deltas/class/test140/resources/before/.api_description >diff -N tests-deltas/class/test140/resources/before/.api_description >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test140/resources/before/.api_description 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<component name="deltatest"> >+<plugin id="deltatest" /> >+</component> >\ No newline at end of file >Index: tests-deltas/class/test139/resources/after/.api_description >=================================================================== >RCS file: tests-deltas/class/test139/resources/after/.api_description >diff -N tests-deltas/class/test139/resources/after/.api_description >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test139/resources/after/.api_description 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<component name="deltatest"> >+<plugin id="deltatest" /> >+</component> >\ No newline at end of file >Index: tests-deltas/class/test139/before/internal/p/Y.java >=================================================================== >RCS file: tests-deltas/class/test139/before/internal/p/Y.java >diff -N tests-deltas/class/test139/before/internal/p/Y.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ tests-deltas/class/test139/before/internal/p/Y.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+package internal.p; >+ >+public class Y { >+ public void bar() {} >+} >\ No newline at end of file >#P org.eclipse.pde.api.tools >Index: src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java,v >retrieving revision 1.70 >diff -u -r1.70 ApiAnalysisBuilder.java >--- src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java 14 Oct 2008 20:40:56 -0000 1.70 >+++ src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java 17 Oct 2008 16:48:40 -0000 >@@ -658,13 +658,13 @@ > continue; > } > updateMonitor(monitor, 0); >- if(changedtypes.contains(file)) { >+// if(changedtypes.contains(file)) { > cleanupUnsupportedTagMarkers(file); > updateMonitor(monitor, 0); > cleanupCompatibiltiyMarkers(file); > updateMonitor(monitor, 0); > cnames.add(type.getFullyQualifiedName()); >- } >+// } > try { > cleanupUsageMarkers(file); > updateMonitor(monitor, 0); >Index: src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java,v >retrieving revision 1.57 >diff -u -r1.57 ClassFileComparator.java >--- src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java 16 Oct 2008 20:20:52 -0000 1.57 >+++ src/org/eclipse/pde/api/tools/internal/comparator/ClassFileComparator.java 17 Oct 2008 16:48:40 -0000 >@@ -248,7 +248,20 @@ > String superTypeName = this.type1.getSuperclassName(); > String superTypeName2 = this.type2.getSuperclassName(); > if (!superTypeName.equals(superTypeName2)) { >- // we don't need to check the superclass if it has changed >+ // if the superclass has changed we need to look at visible members have been removed or moved >+ // to a different location >+ ClassFileResult pair = getType(superTypeName, this.component, this.apiProfile); >+ if (pair == null) return; >+ IClassFile superclassType1 = pair.getClassFile(); >+ IApiType typeStructure = TypeStructureCache.getTypeStructure(superclassType1, pair.getComponent()); >+ IApiMethod[] methods = typeStructure.getMethods(); >+ for (int i = 0, max = methods.length; i < max; i++) { >+ getDeltaForMethod(methods[i]); >+ } >+ IApiField[] fields = typeStructure.getFields(); >+ for (int i = 0, max = fields.length; i < max; i++) { >+ getDeltaForField(fields[i]); >+ } > return; > } > ClassFileResult pair = getType(superTypeName, this.component, this.apiProfile);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247703
:
112814
| 115424