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 204694

Summary: "Cannot inline public method which uses local accessors" when method used only in-class
Product: java Reporter: Jesse Glick <jglick>
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Jesse Glick 2011-11-04 15:52:31 UTC
https://svn.codehaus.org/mojo/trunk/mojo/nbm-maven-plugin/src/main/java/org/codehaus/mojo/nbm/ExamineManifest.java @14750 has

    public void setPublicPackages( boolean publicPackages )
    {
        this.publicPackages = publicPackages;
    }

which Find Usages confirms is used only within ExamineManifest itself. I asked to inline this method, since it is not intended to be called externally and would be easier to read if inlined, but got the error given in the subject line.

The Inline refactoring should only issue this error if the method is actually called from another class (other than a nested class). Even then the error should probably be made into a warning: if the field is accessible to the current caller, it is the user's decision whether to let that caller access the field directly; even if not currently accessible, it could be made accessible if that is the intent.
Comment 1 Ralph Ruijs 2012-02-23 16:13:20 UTC
changeset   : 610c1756da93
author      : Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date        : Thu Feb 23 17:10:49 CET 2012
summary     : Issue #204694 - "Cannot inline public method which uses local accessors" when method used only in-class
Comment 2 Quality Engineering 2012-02-25 10:44:06 UTC
Integrated into 'main-golden', will be available in build *201202250400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/610c1756da93
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: Issue #204694 - "Cannot inline public method which uses local accessors" when method used only in-class