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.
Summary: | [67cat] NullPointerException at org.netbeans.api.java.source.ElementUtilities.isSynthetic | ||
---|---|---|---|
Product: | java | Reporter: | Michel Graciano <hmichel> |
Component: | Refactoring | Assignee: | Jan Pokorsky <jpokorsky> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | dbalek, hmichel, jiriprox, misterm, mmirilovic, sustaining |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://statistics.netbeans.org/exceptions/detail.do?id=152410 | ||
Issue Type: | DEFECT | Exception Reporter: | 152410 |
Attachments: |
stacktrace
stacktrace stacktrace |
Description
Michel Graciano
2009-06-09 20:38:33 UTC
Created attachment 83365 [details]
stacktrace
Build: NetBeans IDE 6.7 RC2 (Build 200906042131) VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03 OS: Linux, 2.6.27-14-generic, i386 User Comments: Stacktrace: java.lang.NullPointerException at org.netbeans.api.java.source.ElementUtilities.isSynthetic(ElementUtilities.java:174) at org.netbeans.modules.refactoring.java.plugins.ChangeParamsTransformer.visitCompilationUnit(ChangeParamsTransformer.java:83) at org.netbeans.modules.refactoring.java.plugins.ChangeParamsTransformer.visitCompilationUnit(ChangeParamsTransformer.java:70) at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:482) at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67) at org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin$TransformTask.run(JavaRefactoringPlugin.java:363) Created attachment 83366 [details]
stacktrace
Build: NetBeans IDE 6.7 RC2 (Build 200906042131) VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03 OS: Linux, 2.6.27-14-generic, i386 User Comments: Stacktrace: java.lang.NullPointerException at org.netbeans.api.java.source.ElementUtilities.isSynthetic(ElementUtilities.java:174) at org.netbeans.modules.refactoring.java.plugins.ChangeParamsTransformer.visitCompilationUnit(ChangeParamsTransformer.java:83) at org.netbeans.modules.refactoring.java.plugins.ChangeParamsTransformer.visitCompilationUnit(ChangeParamsTransformer.java:70) at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:482) at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67) at org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin$TransformTask.run(JavaRefactoringPlugin.java:363) Created attachment 83367 [details]
stacktrace
This should be fixed for FCS. Looks like this happens when code involved (methods to be refactored) are not compilable. *hmichel*, thanks for report ... I am sorry I can't reproduce it : tried Refactor | Change Parameters on not compilable method ... also other refactorings called on non-compilable code. *jiriprox*, please look at this as well. Also decreasing the priority ... please follow http://wiki.netbeans.org/BugPriorityGuidelines ChangeParamsTransformer should not pass null to ElementUtilities.isSynthetic(...). Reassigning. I followed the guidelines, since the feature doesn't work for that scenario, the problem is that I need to send to you this scenario... no workaround exists when it happens... I needed to change method without refactoring and fix all calls manually. I will try to figure out how to reproduce it and send it to you as soon as I can. Regards The refactoring passes what it gets. If you take a look at messages.log there is a broken TreePathHandle->Element translation again. What is really strange that the same TreePathHandle.resolveElement returns non-null value in a user action task in ChangeParametersPlugin.preCheck but it returns null in the modification task in ChangeParametersPlugin.prepare that follows the preCheck. hmichel: a reproducible scenario would be greatly welcome. I guess it could have something to do with method occurrences in several source roots (dependent projects?). Yes, I will try to reproduce it, but I think it is not so easy. I've used an free form project with several source roots. As soon as I can reproduce it I will attach it for you. Thanks Steps to reproduce: 1) have project A with class public class Util { public String test() { return ""; } } 2) have project B depending on A with class public class Main { class A extends Util { @Override public String test() { return ""; } } } 3) put caret over test in Main class 4) perform Change Method Parameter refactoring Thank you for steps. It is as I guessed. The refactoring source has to be the declaration from the topmost super class not the usage in order to ensure it is accessible from all classpaths of involved projects. Integrated into 'main-golden', will be available in build *200906120201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/2adda8f21fbd User: Jan Pokorsky <jpokorsky@netbeans.org> Log: #166810: fixing NPE; Element param of visitXXX methods may be null in case of several dependent source roots v. 200906160201 Justification of patch candidate: the exception occurs in very common scenario The fix has been ported into the release67_fixes repository. http://hg.netbeans.org/release67_fixes/rev/f5edcfa6a542 Product Version: NetBeans IDE 6.7.1 RC (Build 200907150227) Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16 System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb) Verified in 6.7.1 RC |