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 258058

Summary: Duplicate static imports on class rename
Product: java Reporter: matthies <matthies>
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description matthies 2016-02-18 22:23:13 UTC
When renaming a class with overloaded static imports, the renaming duplicates the static import declarations. Example:

Foo.java:

    package example;

    public class Foo
    {
        public static void foo(int n) { }
        public static void foo(long n) { }
    }

Example.java:

    package example;

    import static example.Foo.foo;

    public class Example
    {
        { foo(2); }
    }

Renaming the Example class results in a duplicate static import declaration:

    import static example.Foo.foo;
    import static example.Foo.foo;

Renaming the class again duplicates the imports again:

    import static example.Foo.foo;
    import static example.Foo.foo;
    import static example.Foo.foo;
    import static example.Foo.foo;

Things get really slow after a dozen renamings or so. ;)
Comment 1 Marian Petras 2016-02-21 21:41:44 UTC
Thank you for pointing at the precondition for the bad behaviour.

I am now resolving this as a duplicate of another bug. Please add your vote to it.

*** This bug has been marked as a duplicate of bug 254955 ***