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 64503

Summary: fail to refactor in default package
Product: java Reporter: pzgyuanf <pzgyuanf>
Component: UnsupportedAssignee: issues@java <issues>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description pzgyuanf 2005-09-16 06:58:55 UTC
Because the other day I couldn't access to the whole netbeans.org site, I have
posted this problem to use.mail.list. Maybe someone have filed it into the
Issuezilla for me. If so, just duplicated it please!

A embarrassed example: "Puzzle 67: All Strung Out" from [Java™ Puzzlers: Traps,
Pitfalls, and Corner Cases]By Joshua Bloch, Neal Gafter.

----------------------------------------------------
public class StrungOut {

    public static void main(String[] args) {

        String s = new String("Hello world");

        System.out.println(s);

    }

}



class String {

    private final java.lang.String s;



    public String(java.lang.String s) {

        this.s = s;

    }



    public java.lang.String toString() {

        return s;

    }

}
------------------------------------------------------------

In Nebeans, trying to Refactor | Rename the 'class String' to 'MyString' , you
can see the result.

Refactor ought to refactor all occurrences of String but those java.lang.String
to MyString, including the 'String[] args' one. 

BTW. other IDEs could do it correctly.

-pprun
Comment 1 Tomas Hurka 2005-09-16 14:50:45 UTC
The problem is that the classes are in default package. If you put them to any non-default package 
everything works fine.
Comment 2 Tomas Hurka 2005-09-16 15:09:04 UTC
Fixed in trunk.
Checking in PackageImpScope.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/PackageImpScope.java,v  <--  
PackageImpScope.java
new revision: 1.6; previous revision: 1.5
done
Comment 3 pzgyuanf 2005-09-16 15:35:57 UTC
Yep!
Comment 4 Quality Engineering 2007-09-20 10:55:09 UTC
Reorganization of java component