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 108474 - [encapsulate field] Encap. field results in change of behavior
Summary: [encapsulate field] Encap. field results in change of behavior
Status: RESOLVED DUPLICATE of bug 108489
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-29 00:03 UTC by kely_garcia
Modified: 2008-02-11 12:58 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 kely_garcia 2007-06-29 00:03:46 UTC
Build ID: 200609161800 (Netbeans 6.0 M3)

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

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

Yields the following refactored code:
public class A {
    private String theField;
    public static void main(  String[] args){
        B b=new B();
        b.setTheField("abcd");
    }

    public String getTheField() {
        return theField;
    }

    public void setTheField(String theField) {
        this.theField = theField;
    }
}
class B extends A {
    public void setTheField(  String theField){
        this.setTheField(theField);
    }
}

Running A before refactoring: ""
Running A after refactoring : Exception in thread "main" java.lang.StackOverflowError
	                                     at p1.B.setTheField(A.java:22)
Comment 1 Jan Becicka 2007-06-29 10:20:03 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-11 12:58:17 UTC
Similar problem to that reported in issue 108489.

*** This issue has been marked as a duplicate of 108489 ***