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 98056

Summary: [Encapsulate fields] Encapsulate field on byte with unary operator yields compilation error
Product: java Reporter: kely_garcia <kely_garcia>
Component: RefactoringAssignee: Jan Pokorsky <jpokorsky>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description kely_garcia 2007-03-16 04:11:22 UTC
Build ID: 200609161800 (Netbeans 6.0 M3)

Steps To Reproduce:
Encapsulate field b on the following (field b can be of type: byte or short or 
char):
class A {
  byte b;

  void m() {
    b++;
  }
}

Yields the following refactored class:
class A {
  private byte b;

  void m() {
    setB(getB() + 1);
  }

    public byte getB() {
        return b;
    }

    public void setB(byte b) {
        this.b = b;
    }
}

Compilation error is the following: setB(byte) cannot be applied to (int)
Comment 1 Pavel Flaska 2007-03-23 09:05:23 UTC
Encapsulate field refactoring is not available in current builds. It has to be
brought back with fixes.
Comment 2 Jan Pokorsky 2007-08-30 10:45:59 UTC
fixed in

/cvs/refactoring/java/src/org/netbeans/modules/refactoring/java/plugins/EncapsulateFieldRefactoringPlugin.java
new revision: 1.6; previous revision: 1.5