Skip to content

Commit 7153d9b

Browse files
committed
Do not emit restriction warning on inherited method
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 inherited public method A.M triggers a restriction warning. This is undesired because as a caller I never access any restricted code here as A is inherit all public methods from B. See #4293 for a discussion about that topic.
1 parent 0bd1cc0 commit 7153d9b

3 files changed

Lines changed: 172 additions & 143 deletions

File tree

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)