JDK-4030368 : Illegal hiding by inherited method names is not diagnosed.
Type:Bug
Component:tools
Sub-Component:javac
Affected Version:1.1
Priority:P3
Status:Closed
Resolution:Fixed
OS:solaris_2.5
CPU:sparc
Submitted:1997-02-05
Updated:1997-10-23
Resolved:1997-10-23
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The following code should fail to compile, but it compiles silently:
//JCK test innr005, bug #
class InheritHideBug {
static class S {
void m() { }
}
void m() { }
class C extends S {
{
m(); // BAD
}
}
}
Comments
CONVERTED DATA
BugTraq+ Release Management Values
COMMIT TO FIX:
generic
FIXED IN:
1.1.1
INTEGRATED IN:
1.1.1
14-06-2004
EVALUATION
Typo in MethodExpression.checkValue
11-06-2004
PUBLIC COMMENTS
It is confusing to programmers when a simple name matches both an inherited
super class member and a declaration in an enclosing scope. Java 1.1 requires
such names to be explicitly qualified. However, the compiler lets ambiguous
method references through without a diagnostic. (They resolve to the inherited
method.)
<p>
Here is a test which exhibits the bug. It should fail to compile, but doesn't.
<pre>
class InheritHideBug {
static class S {
void m() { }
}
void m() { }
class C extends S {
{
m(); // BAD
}
}
}
</pre>