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 222741 - NullPointerException at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.isAlreadyInResult
Summary: NullPointerException at org.netbeans.modules.groovy.refactoring.rename.Rename...
Status: RESOLVED FIXED
Alias: None
Product: groovy
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-26 09:17 UTC by Martin Janicek
Modified: 2012-11-27 02:56 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 195683


Attachments
stacktrace (1.21 KB, text/plain)
2012-11-26 09:18 UTC, Martin Janicek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Janicek 2012-11-26 09:17:59 UTC
Build: NetBeans IDE Dev (Build 20121121-a0d218e90fbf)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.2-b06, Java(TM) SE Runtime Environment, 1.6.0_27-b07
OS: Linux

User Comments:
mjanicek: Trying to refactor class name in file with multiple inner subclasses




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.isAlreadyInResult(RenameRefactoringPlugin.java:120)
   at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.addModificationToResult(RenameRefactoringPlugin.java:101)
   at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.collectModifications(RenameRefactoringPlugin.java:95)
   at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.refactorResults(RenameRefactoringPlugin.java:81)
   at org.netbeans.modules.groovy.refactoring.findusages.FindUsagesPlugin.prepare(FindUsagesPlugin.java:85)
   at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare2(AbstractRefactoring.java:437)
Comment 1 Martin Janicek 2012-11-26 09:18:01 UTC
Created attachment 128376 [details]
stacktrace
Comment 2 Martin Janicek 2012-11-26 09:20:27 UTC
Reproducible test case:

Superclass x = new Superclass()

class Superclass {
}

..rename refactoring on Superclass and the NPE shows up
Comment 3 Martin Janicek 2012-11-26 10:17:22 UTC
Ok, this is happening only in cases where the file name is the same as class declared inside. This is generally problem and makes groovy compiler complains about duplicate definition of the class.
I'll improve the code to get rid of the exception but the refactoring won't work in this special case anyway.
Comment 4 Martin Janicek 2012-11-26 10:22:47 UTC
Fixed in: web-main #ee8e34360cd5
Comment 5 Quality Engineering 2012-11-27 02:56:51 UTC
Integrated into 'main-golden', will be available in build *201211270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ee8e34360cd5
User: Martin Janicek <mjanicek@netbeans.org>
Log: #222741 - NullPointerException at org.netbeans.modules.groovy.refactoring.rename.RenameRefactoringPlugin.isAlreadyInResult