Skip to content

Commit 545483d

Browse files
authored
Do not emit restriction warning on inherited method (#4293)
Currently when we have a type A and it is accessible from package p1, but extends a type B (that is not accessible in package p2) calling any public method B.m() via A triggers a restriction warning. In the context of OSGi, where a caller has access to all public methods of A including inherited ones, this is undesired. See #4293 for a discussion about that topic.
1 parent 0933895 commit 545483d

File tree

3 files changed

+172
-143
lines changed

3 files changed

+172
-143
lines changed

org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MessageSend.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,10 @@ public TypeBinding resolveType(BlockScope scope) {
10021002
}
10031003
// abstract private methods cannot occur nor abstract static............
10041004
}
1005-
if (isMethodUseDeprecated(this.binding, scope, true, this))
1005+
TypeBinding declared = this.binding.declaringClass.erasure();
1006+
TypeBinding actual = this.actualReceiverType.erasure();
1007+
boolean isExplicitUse = TypeBinding.equalsEquals( declared, actual);
1008+
if (isMethodUseDeprecated(this.binding, scope, isExplicitUse, this))
10061009
scope.problemReporter().deprecatedMethod(this.binding, this);
10071010

10081011
TypeBinding returnType;

0 commit comments

Comments
 (0)