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 172346 - [Use Supertype] Where Possible refactoring leads to a compilation error when applied to a class in a complex class hierarcy
Summary: [Use Supertype] Where Possible refactoring leads to a compilation error when ...
Status: RESOLVED DUPLICATE of bug 131406
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-16 03:20 UTC by vilasshekharbj
Modified: 2011-09-08 10:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


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 ***