Lines 1720-1725
Link Here
|
1720 |
MethodBinding foundProblem = null; |
1720 |
MethodBinding foundProblem = null; |
1721 |
Scope scope = this; |
1721 |
Scope scope = this; |
1722 |
int depth = 0; |
1722 |
int depth = 0; |
|
|
1723 |
// in 1.4 mode (inherited visible shadows enclosing) |
1724 |
CompilerOptions options; |
1725 |
boolean inheritedHasPrecedence = (options = compilerOptions()).complianceLevel >= ClassFileConstants.JDK1_4; |
1726 |
|
1723 |
done : while (true) { // done when a COMPILATION_UNIT_SCOPE is found |
1727 |
done : while (true) { // done when a COMPILATION_UNIT_SCOPE is found |
1724 |
switch (scope.kind) { |
1728 |
switch (scope.kind) { |
1725 |
case METHOD_SCOPE : |
1729 |
case METHOD_SCOPE : |
Lines 1751-1774
Link Here
|
1751 |
? ProblemReasons.NonStaticReferenceInConstructorInvocation |
1755 |
? ProblemReasons.NonStaticReferenceInConstructorInvocation |
1752 |
: ProblemReasons.NonStaticReferenceInStaticContext); |
1756 |
: ProblemReasons.NonStaticReferenceInStaticContext); |
1753 |
} |
1757 |
} |
1754 |
|
1758 |
if (inheritedHasPrecedence |
1755 |
if (receiverType == methodBinding.declaringClass |
1759 |
|| receiverType == methodBinding.declaringClass |
1756 |
|| ((foundProblem == null || foundProblem.problemId() != ProblemReasons.NotVisible) && compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) |
1760 |
|| (receiverType.getMethods(selector)) != Binding.NO_METHODS) { |
1757 |
|| (receiverType.getMethods(selector)) != Binding.NO_METHODS) { |
1761 |
// found a valid method in the 'immediate' scope (ie. not inherited) |
1758 |
// found a valid method in the 'immediate' scope (ie. not inherited) |
1762 |
// OR in 1.4 mode (inherited visible shadows enclosing) |
1759 |
// OR in 1.4 mode (inherited visible shadows enclosing) |
1763 |
// OR the receiverType implemented a method with the correct name |
1760 |
// OR the receiverType implemented a method with the correct name |
1764 |
// return the methodBinding if it is not declared in a superclass of the scope's binding (that is, inherited) |
1761 |
// return the methodBinding if it is not declared in a superclass of the scope's binding (that is, inherited) |
1765 |
if (foundProblem != null && foundProblem.problemId() != ProblemReasons.NotVisible) |
1762 |
if (foundProblem != null && foundProblem.problemId() != ProblemReasons.NotVisible) |
1766 |
return foundProblem; |
1763 |
return foundProblem; |
1767 |
if (depth > 0) { |
1764 |
if (depth > 0) { |
1768 |
invocationSite.setDepth(depth); |
1765 |
invocationSite.setDepth(depth); |
1769 |
invocationSite.setActualReceiverType(receiverType); |
1766 |
invocationSite.setActualReceiverType(receiverType); |
1770 |
} |
1767 |
} |
1771 |
return methodBinding; |
1768 |
return methodBinding; |
|
|
1769 |
} |
1772 |
} |
1770 |
|
1773 |
|
1771 |
if (foundProblem == null) { |
1774 |
if (foundProblem == null || foundProblem.problemId() == ProblemReasons.NotVisible) { |
|
|
1775 |
if (foundProblem != null) foundProblem = null; |
1772 |
// only remember the methodBinding if its the first one found |
1776 |
// only remember the methodBinding if its the first one found |
1773 |
// remember that private methods are visible if defined directly by an enclosing class |
1777 |
// remember that private methods are visible if defined directly by an enclosing class |
1774 |
if (depth > 0) { |
1778 |
if (depth > 0) { |
Lines 1813-1819
Link Here
|
1813 |
scope = scope.parent; |
1817 |
scope = scope.parent; |
1814 |
} |
1818 |
} |
1815 |
|
1819 |
|
1816 |
if (insideStaticContext && compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { |
1820 |
if (insideStaticContext && options.sourceLevel >= ClassFileConstants.JDK1_5) { |
1817 |
if (foundProblem != null) { |
1821 |
if (foundProblem != null) { |
1818 |
if (foundProblem.declaringClass != null && foundProblem.declaringClass.id == TypeIds.T_JavaLangObject) |
1822 |
if (foundProblem.declaringClass != null && foundProblem.declaringClass.id == TypeIds.T_JavaLangObject) |
1819 |
return foundProblem; // static imports lose to methods from Object |
1823 |
return foundProblem; // static imports lose to methods from Object |