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 - Duplicate static imports on class rename
Summary: Duplicate static imports on class rename
Status: RESOLVED DUPLICATE of bug 254955
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-18 22:23 UTC by matthies
Modified: 2016-02-21 21:41 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 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 ***