Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 108489 - [encapsulate field] Encap. field yields comp. error due to incompatible return type
[encapsulate field] Encap. field yields comp. error due to incompatible retur...
Status: RESOLVED WONTFIX
Product: java
Classification: Unclassified
Component: Refactoring
6.x
PC Windows XP
: P4 (vote)
: 6.x
Assigned To: Daniel Prusa
issues@java
:
: 108474 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
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
:


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


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