JDK-5031623 : error message should include name/signature of the method @Override been applied
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Rejected
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2004-04-14
  • Updated: 2025-05-05
  • Resolved: 2025-05-05
Related Reports
Duplicate :  
Description
###@###.### 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

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
17-07-2004

PUBLIC COMMENTS ...
17-07-2004

EVALUATION Yes, it should include the name/signature. ###@###.### 2004-04-14
14-04-2004