Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 172346 - [Use Supertype] Where Possible refactoring leads to a compilation error when applied to a class in a complex class hierarcy
[Use Supertype] Where Possible refactoring leads to a compilation error when ...
Status: RESOLVED DUPLICATE of bug 131406
Product: java
Classification: Unclassified
Component: Refactoring
6.x
PC Linux
: P3 (vote)
: 7.1
Assigned To: Ralph Ruijs
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-16 03:20 UTC by vilasshekharbj
Modified: 2011-09-08 10:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vilasshekharbj 2009-09-16 03:20:06 UTC
Apply the Use Super Type Where Possible refactoring to class A in the following code and choose class C as the super
type to be used:

interface B {
  public B m();
}
interface C {
  public C m();
}
class A implements C, B {
  public A m(){
    A a=null;
    return a;
  }
}

The refactoring correctly decides not to change the return type of A.m(), but incorrectly changes the type of A.m().a to
C without detecting that it is being returned and should be the same type as A.m(). This leads to the following code
that does not compile:

interface B {
  public B m();
}
interface C {
  public C m();
}
class A implements C, B {
  public A m(){
    C a=null;
    return a;
  }
}
Comment 1 Jan Pokorsky 2009-09-17 17:00:12 UTC
Thank you for the report. It is reproducible.
Comment 2 Jan Becicka 2011-08-02 08:41:58 UTC
another use supertype. thanks.
Comment 3 Ralph Ruijs 2011-09-08 10:02:33 UTC

*** This bug has been marked as a duplicate of bug 131406 ***


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo