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 108489 - [encapsulate field] Encap. field yields comp. error due to incompatible return type
Summary: [encapsulate field] Encap. field yields comp. error due to incompatible retur...
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P4 blocker (vote)
Assignee: Daniel Prusa
URL:
Keywords:
: 108474 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-29 01:35 UTC by kely_garcia
Modified: 2009-11-02 11:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NPE stack trace (2.24 KB, text/plain)
2008-02-01 15:19 UTC, Daniel Prusa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kely_garcia 2007-06-29 01:35:46 UTC
Build ID: 200609161800 (Netbeans 6.0 M3)

Steps To Reproduce:
Encapsulate field f on the following: 

public class A {
    String f;
    public static void main(  String[] args){
        B b=new B();
        b.setF("abcd");
    }
}
class B extends A {
    public int setF(  String theField){
        this.f=theField;
        return 2;
    }
}

Yields the following refactored code:

public class A {
    private String f;
    public static void main(  String[] args){
        B b=new B();
        b.setF("abcd");
    }

    public String getF() {
        return f;
    }

    public void setF(String f) {
        this.f = f;
    }
}
class B extends A {
    public int setF(  String theField){
        this.setF(theField);
        return 2;
    }
}

The compilation error is: "setF(String) in B cannot override setF(String) in A; attempting to use incompatible return 
type"
Comment 1 Jan Becicka 2007-06-29 10:22:27 UTC
Valid for 5.5. Encapsulate fields not implemented in M10. Planned for beta1. Need to be reevaluated when implemented.
Should be resolved for 6.0
Comment 2 Daniel Prusa 2008-02-01 15:19:19 UTC
Created attachment 55917 [details]
NPE stack trace
Comment 3 Daniel Prusa 2008-02-01 15:19:57 UTC
NPE thrown when trying to reproduce this issue in nb 6.1 dev builds.
Comment 4 Daniel Prusa 2008-02-11 12:49:12 UTC
NPE no longer thrown, the reported problem reproducible. Refactoring could detect this kind of conflict and display a
warning.
Comment 5 Daniel Prusa 2008-02-11 12:58:16 UTC
*** Issue 108474 has been marked as a duplicate of this issue. ***
Comment 6 David Strupl 2009-03-31 15:57:17 UTC
Resolving all issues with milestone "future" as LATER. If you feel strongly that
it should be implemented please reopen and set the target milestone to "next".
Comment 7 Quality Engineering 2009-11-02 11:18:08 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX