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 37859 Details for
Bug 132191
IMethodBinding.overrides(IMethodBinding) returns true even if the given argument is private.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch and regression test
132191.txt (text/plain), 3.41 KB, created by
Jerome Lanneluc
on 2006-04-06 06:04:37 EDT
(
hide
)
Description:
Proposed patch and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2006-04-06 06:04:37 EDT
Size:
3.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/CompatibilityRulesTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/CompatibilityRulesTests.java,v >retrieving revision 1.16 >diff -u -r1.16 CompatibilityRulesTests.java >--- src/org/eclipse/jdt/core/tests/dom/CompatibilityRulesTests.java 29 Mar 2006 04:03:06 -0000 1.16 >+++ src/org/eclipse/jdt/core/tests/dom/CompatibilityRulesTests.java 6 Apr 2006 09:57:36 -0000 >@@ -730,4 +730,58 @@ > } > } > >+ /* >+ * Ensures that a method in a subtype doesn't override the corresponding private method in the super type. >+ * (regression test for bug 132191 IMethodBinding.overrides(IMethodBinding) returns true even if the given argument is private.) >+ */ >+ public void test033() throws JavaModelException { >+ IMethodBinding[] bindings = createMethodBindings( >+ new String[] { >+ "/P/p1/X.java", >+ "package p1;\n" + >+ "public class X {\n" + >+ " private void foo() {\n" + >+ " }\n" + >+ "}", >+ "/P/p1/Y.java", >+ "package p1;\n" + >+ "public class Y extends X {\n" + >+ " void foo() {\n" + >+ " }\n" + >+ "}", >+ }, >+ new String[] { >+ "Lp1/Y;.foo()V", >+ "Lp1/X;.foo()V" >+ }); >+ assertTrue("Y#foo() should not override X#foo()", !bindings[0].overrides(bindings[1])); >+ } >+ >+ /* >+ * Ensures that a method in a subtype doesn't override the corresponding default method in the super type in a different package. >+ * (regression test for bug 132191 IMethodBinding.overrides(IMethodBinding) returns true even if the given argument is private.) >+ */ >+ public void test034() throws JavaModelException { >+ IMethodBinding[] bindings = createMethodBindings( >+ new String[] { >+ "/P/p1/X.java", >+ "package p1;\n" + >+ "public class X {\n" + >+ " void foo() {\n" + >+ " }\n" + >+ "}", >+ "/P/p2/Y.java", >+ "package p2;\n" + >+ "public class Y extends p1.X {\n" + >+ " void foo() {\n" + >+ " }\n" + >+ "}", >+ }, >+ new String[] { >+ "Lp2/Y;.foo()V", >+ "Lp1/X;.foo()V" >+ }); >+ assertTrue("Y#foo() should not override X#foo()", !bindings[0].overrides(bindings[1])); >+ } >+ > } >#P org.eclipse.jdt.core >Index: dom/org/eclipse/jdt/core/dom/MethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java,v >retrieving revision 1.74 >diff -u -r1.74 MethodBinding.java >--- dom/org/eclipse/jdt/core/dom/MethodBinding.java 29 Mar 2006 02:54:51 -0000 1.74 >+++ dom/org/eclipse/jdt/core/dom/MethodBinding.java 6 Apr 2006 09:57:38 -0000 >@@ -443,7 +443,10 @@ > LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment(); > if (lookupEnvironment == null) return false; > MethodVerifier methodVerifier = lookupEnvironment.methodVerifier(); >- return methodVerifier.doesMethodOverride(this.binding, superMethods[i]); >+ org.eclipse.jdt.internal.compiler.lookup.MethodBinding superMethod = superMethods[i]; >+ return !superMethod.isPrivate() >+ && !(superMethod.isDefault() && (superMethod.declaringClass.getPackage()) != this.binding.declaringClass.getPackage()) >+ && methodVerifier.doesMethodOverride(this.binding, superMethod); > } > } > return false;
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 132191
: 37859