Lines 730-733
Link Here
|
730 |
} |
730 |
} |
731 |
} |
731 |
} |
732 |
|
732 |
|
|
|
733 |
/* |
734 |
* Ensures that a method in a subtype doesn't override the corresponding private method in the super type. |
735 |
* (regression test for bug 132191 IMethodBinding.overrides(IMethodBinding) returns true even if the given argument is private.) |
736 |
*/ |
737 |
public void test033() throws JavaModelException { |
738 |
IMethodBinding[] bindings = createMethodBindings( |
739 |
new String[] { |
740 |
"/P/p1/X.java", |
741 |
"package p1;\n" + |
742 |
"public class X {\n" + |
743 |
" private void foo() {\n" + |
744 |
" }\n" + |
745 |
"}", |
746 |
"/P/p1/Y.java", |
747 |
"package p1;\n" + |
748 |
"public class Y extends X {\n" + |
749 |
" void foo() {\n" + |
750 |
" }\n" + |
751 |
"}", |
752 |
}, |
753 |
new String[] { |
754 |
"Lp1/Y;.foo()V", |
755 |
"Lp1/X;.foo()V" |
756 |
}); |
757 |
assertTrue("Y#foo() should not override X#foo()", !bindings[0].overrides(bindings[1])); |
758 |
} |
759 |
|
760 |
/* |
761 |
* Ensures that a method in a subtype doesn't override the corresponding default method in the super type in a different package. |
762 |
* (regression test for bug 132191 IMethodBinding.overrides(IMethodBinding) returns true even if the given argument is private.) |
763 |
*/ |
764 |
public void test034() throws JavaModelException { |
765 |
IMethodBinding[] bindings = createMethodBindings( |
766 |
new String[] { |
767 |
"/P/p1/X.java", |
768 |
"package p1;\n" + |
769 |
"public class X {\n" + |
770 |
" void foo() {\n" + |
771 |
" }\n" + |
772 |
"}", |
773 |
"/P/p2/Y.java", |
774 |
"package p2;\n" + |
775 |
"public class Y extends p1.X {\n" + |
776 |
" void foo() {\n" + |
777 |
" }\n" + |
778 |
"}", |
779 |
}, |
780 |
new String[] { |
781 |
"Lp2/Y;.foo()V", |
782 |
"Lp1/X;.foo()V" |
783 |
}); |
784 |
assertTrue("Y#foo() should not override X#foo()", !bindings[0].overrides(bindings[1])); |
785 |
} |
786 |
|
733 |
} |
787 |
} |