This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 251561 - Change method signature to match overriden method
Summary: Change method signature to match overriden method
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Blocks: 246477
  Show dependency tree
Reported: 2015-04-01 13:46 UTC by Svata Dedic
Modified: 2015-10-02 14:48 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Svata Dedic 2015-04-01 13:46:08 UTC
Sometimes a class is changed to extend some superclass, but already defines a method with similar but conflicting signature which prevents the correct method stub to be generated. Or a type parameter for the superclass is changed after the class is coded, which results in different method parameter/return types for overriding methods - see issue #246477 for detailed description.

IDE could change signatures of methods which conflict with overridable members of superclass to correct ones. The hint could watch out errors like:
"XXX in Y cannot implement XXX<E> in ListModel
  return type Object is not compatible with String
  where E is a type-variable:

"name clash: add(Object) in JavaApplication1 and add(E) in AbstractList have the same erasure, yet neither overrides the other
  where E is a type-variable:
    E extends Object declared in class AbstractList"

+ @Override annotation, which indicate the method WAS intended to override the parent, but the intention failed for some reason. The hint should be also presented for class name, as at the same time, the class header will likely produce an error that some abstract methods are not implemented.