Skip to content

Commit abcd475

Browse files
committed
Adjust test001 to the changed behavior
1 parent cd423c5 commit abcd475

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,27 +167,35 @@ public void test001() throws CoreException {
167167
);
168168
// check the specifics of this test case
169169
src =
170-
"package p;\n" +
171-
"public class Y extends X2 {\n" +
172-
" void foobar() {\n" +
173-
" foo(); // accesses X1.foo, should trigger an error\n" +
174-
" bar(); // accesses X2.bar, OK\n" +
175-
" }\n" +
176-
"}";
170+
"""
171+
package p;
172+
public class Y extends X2 {
173+
void foobar() {
174+
foo(); // accesses foo as inherited method through X2, should not trigger an error
175+
((X1)this).foo(); // accesses X1.foo directly, should trigger an error
176+
bar(); // accesses X2.bar, OK
177+
}
178+
}""";
177179
this.problemRequestor = new ProblemRequestor(src);
178180
y = getWorkingCopy(
179181
"/P2/src/p/Y.java",
180182
src
181183
);
182184
assertProblems(
183185
"Unexpected problems value",
184-
"----------\n" +
185-
"1. ERROR in /P2/src/p/Y.java (at line 4)\n" +
186-
" foo(); // accesses X1.foo, should trigger an error\n" +
187-
" ^^^\n" +
188-
"Access restriction: The method \'X1.foo()\' is not API (restriction on required project \'P1\')\n" +
189-
"----------\n"
190-
);
186+
"""
187+
----------
188+
1. ERROR in /P2/src/p/Y.java (at line 5)
189+
((X1)this).foo(); // accesses X1.foo directly, should trigger an error
190+
^^
191+
Access restriction: The type 'X1' is not API (restriction on required project 'P1')
192+
----------
193+
2. ERROR in /P2/src/p/Y.java (at line 5)
194+
((X1)this).foo(); // accesses X1.foo directly, should trigger an error
195+
^^^
196+
Access restriction: The method 'X1.foo()' is not API (restriction on required project 'P1')
197+
----------
198+
""");
191199
} finally {
192200
if (x1 != null)
193201
x1.discardWorkingCopy();

0 commit comments

Comments
 (0)