Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 108473 - [encapsulate field] Encap. field that has a getter yields comp. error
[encapsulate field] Encap. field that has a getter yields comp. error
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Refactoring
6.x
PC Windows XP
: P4 (vote)
: 7.2
Assigned To: Ralph Ruijs
issues@java
:
: 201141 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-28 23:55 UTC by kely_garcia
Modified: 2012-05-29 05:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

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

Steps To Reproduce:
Encapsulate field "theField" on the following:

public class A {
  String theField;
  public static void main(  String[] args){
    B b=new A().new B();
    System.out.println(b.getTheField());
  }
class B extends A {
    private String getTheField(){
      return theField;
    }
  }
}

Yields the following refactored code:
public class A {
    private String theField;
    public static void main(  String[] args){
        B b=new A().new B();
        System.out.println(b.getTheField());
    }
    class B extends A {
        private String getTheField(){
            return getTheField();
        }
    }

    public String getTheField() {
        return theField;
    }

    public void setTheField(String theField) {
        this.theField = theField;
    }
}

The compilation error is: "cannot override getTheField(); attempting to assign weaker access privileges"
Comment 1 Jan Becicka 2007-06-29 10:21:18 UTC
Valid for 5.5. Encapsulate fields not implemented in M10. Planned for beta1. Need to be reevaluated when implemented.
Comment 2 David Strupl 2009-03-31 15:54:48 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 3 Quality Engineering 2009-11-02 11:17:27 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX
Comment 4 Ralph Ruijs 2011-10-10 12:20:52 UTC
*** Bug 201141 has been marked as a duplicate of this bug. ***
Comment 5 Ralph Ruijs 2011-10-10 12:21:45 UTC
This is still valid in 7.0.1
Comment 6 Ralph Ruijs 2012-05-28 12:29:45 UTC
Changeset: ad655b14df3e
Author:    Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Date:      2012-05-28 14:25
Message:   
Issue #108473 - [encapsulate field] Encap. field that has a getter yields comp. error
Comment 7 Quality Engineering 2012-05-29 05:53:30 UTC
Integrated into 'main-golden', will be available in build *201205290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ad655b14df3e
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: Issue #108473 - [encapsulate field] Encap. field that has a getter yields comp. error


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