-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
6
-
Cause Known
-
generic, x86
-
generic, windows_xp
###@###.### 2004-04-14
J2SE Version (please include all output from java -version flag):
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b44)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b46, mixed mode, sharing)
Does this problem occur on J2SE 1.3.x or 1.4.x? Yes / No (pick one)
no
Operating System Configuration Information (be specific):
WinXP
Hardware Configuration Information (be specific):
Dell Optiplex
Bug Description:
@Override triggers a compiler error as expected, but the message is not
very helpful.
Steps to Reproduce (be specific):
During some code-generation I miss-implemented hashcode as follows:
@Override
public int hashCode(Object o)
{
int result = 0;
result = result * 31 + ( (brand != null) ? brand.hashCode() : 0);
result = result * 31 + ( (manufacturer != null) ? manufacturer.hashCode() : 0);
return result;
}
The compiler prints the error message:
src2\datamodel\coffee\Coffee.java:90: method does not override a method
from its superclass
@Override
^
1 error
It would have been helpfull if the error message included the
name/signature of the method that @Override had been applied to e.g.:
src2\datamodel\coffee\Coffee.java:90: method hashcode(Object) does not
override a method from its superclass
@Override
J2SE Version (please include all output from java -version flag):
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b44)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b46, mixed mode, sharing)
Does this problem occur on J2SE 1.3.x or 1.4.x? Yes / No (pick one)
no
Operating System Configuration Information (be specific):
WinXP
Hardware Configuration Information (be specific):
Dell Optiplex
Bug Description:
@Override triggers a compiler error as expected, but the message is not
very helpful.
Steps to Reproduce (be specific):
During some code-generation I miss-implemented hashcode as follows:
@Override
public int hashCode(Object o)
{
int result = 0;
result = result * 31 + ( (brand != null) ? brand.hashCode() : 0);
result = result * 31 + ( (manufacturer != null) ? manufacturer.hashCode() : 0);
return result;
}
The compiler prints the error message:
src2\datamodel\coffee\Coffee.java:90: method does not override a method
from its superclass
@Override
^
1 error
It would have been helpfull if the error message included the
name/signature of the method that @Override had been applied to e.g.:
src2\datamodel\coffee\Coffee.java:90: method hashcode(Object) does not
override a method from its superclass
@Override
- duplicates
-
JDK-6196694 Please improve @Override diagnostics
-
- Closed
-