Den sön 5 aug. 2018 kl 20:45 skrev Geertjan Wielenga
<[email protected]>:

> For me that works fine too without a problem. If you provide step by step
> instructions from beginning to end of what one must do to see the problem
> you describe, that will help.
>
> Gj
>
>
Well, I followed your steps and it failed. :)

That made me poking around a bit and it looks to me that it is related to
nbjavac.
The steps I take in order to reproduce it, or not, is to start netbeans
with java 10 and with/without a user profile containing nbjavac.
#Fails
/usr/local/netbeans-9.0/bin/netbeans --jdkhome /usr/lib/jvm/java-10-jdk/
--userdir /tmp/nb-with-nbjavac
#Is ok
/usr/local/netbeans-9.0/bin/netbeans --jdkhome /usr/lib/jvm/java-10-jdk/
--userdir /tmp/nb-without-nbjavac

Since I'm normally on java 8 I also have nbjavac installed and therefor
always have this problem.

public class FailingRenameWithNbJavac {

    public static void main(String[] args) {
        new FailingRenameWithNbJavac();
    }

    public FailingRenameWithNbJavac() {
        //The error does not happen without the line below being present.
        sayHello("world");
    }

    private void sayHello(String name) {
        System.out.println("hello " + name);
    }
}


After the first rename from sayHello to sayBye there is an editor hint on
the calling line in the constructor saying:
cannot find symbol
  symbol:   method sayBye(String)
  location: class FailingRenameWithNbJavac
----
(Alt-Enter shows hints)

After the second attempt, renaming sayBye to sayWhat in the unsaved file I
get the message and the output below.

On Java 10 however, the error message ("Cannot refactor this object") is
readable as a dialog, as opposed to the Java 8 unreadable message ("Cannot
perform instant rename here") in the status bar.

INFO [org.netbeans.modules.bugtracking.BugtrackingManager]: Loading stored
repositories took 178 millis.
INFO [org.netbeans.api.java.source.ElementHandle]: Resolved type is null
for kind = CLASS
INFO [org.netbeans.api.java.source.ElementHandle]: Cannot resolve:
ElementHandle[kind=CLASS; sigs=FailingRenameWithNbJavac$sayBye ]
INFO [org.netbeans.api.java.source.TreePathHandle]: Cannot resolve:
TreePathHandle[delegate:TreeDelegate[kind:IDENTIFIER,
enclosingElement:ElementHandle[kind=CONSTRUCTOR;
sigs=FailingRenameWithNbJavac <init> ()V ],
file:/home/pata/git/java/JavaApplication1/src/FailingRenameWithNbJavac.java@a9c89905
:6398fe27]]
INFO [org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider]:
doRename: TreePathHandle[delegate:TreeDelegate[kind:IDENTIFIER,
enclosingElement:ElementHandle[kind=CONSTRUCTOR;
sigs=FailingRenameWithNbJavac <init> ()V ],
file:/home/pata/git/java/JavaApplication1/src/FailingRenameWithNbJavac.java@a9c89905
:6398fe27]]
java.lang.NullPointerException: selected
        at
org.netbeans.modules.refactoring.java.ui.RenameRefactoringUI$2.create(RenameRefactoringUI.java:424)
        at
org.netbeans.modules.refactoring.java.ui.ContextAnalyzer$1.createRefactoringUI(ContextAnalyzer.java:94)
        at
org.netbeans.modules.refactoring.java.ui.ContextAnalyzer$TextComponentTask.run(ContextAnalyzer.java:355)
        at
org.netbeans.modules.refactoring.java.ui.ContextAnalyzer$TextComponentTask.run(ContextAnalyzer.java:280)
        at
org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:501)
        at
org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
        at
org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:130)
        at
org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:114)
        at
org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
        at
org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
        at
org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
        at
org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
        at
org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
        at
org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
        at
org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
        at
org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:81)
        at
org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:451)
        at
org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:422)
        at
org.netbeans.modules.refactoring.java.ui.ContextAnalyzer$TextComponentTask.run(ContextAnalyzer.java:362)
        at
org.netbeans.modules.refactoring.java.ui.UIUtilities.lambda$runWhenScanFinished$0(UIUtilities.java:1186)
        at
org.netbeans.api.java.source.ui.ScanDialog.runWhenScanFinished(ScanDialog.java:133)
        at
org.netbeans.modules.refactoring.java.ui.UIUtilities.runWhenScanFinished(UIUtilities.java:1181)
        at
org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider.doFullRename(RefactoringActionsProvider.java:128)
        at
org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider.doRename(RefactoringActionsProvider.java:75)
        at
org.netbeans.modules.refactoring.api.impl.ActionsImplementationFactory.doRename(ActionsImplementationFactory.java:66)
        at
org.netbeans.modules.refactoring.spi.impl.RenameAction.performAction(RenameAction.java:52)
        at
org.netbeans.modules.refactoring.spi.impl.RefactoringGlobalAction$ContextAction.actionPerformed(RefactoringGlobalAction.java:172)
        at
org.netbeans.modules.java.editor.rename.InstantRenamePerformer.doFullRename(InstantRenamePerformer.java:259)
        at
org.netbeans.modules.java.editor.rename.InstantRenamePerformer.invokeInstantRename(InstantRenamePerformer.java:242)
        at
org.netbeans.modules.java.editor.rename.InstantRenameAction.actionPerformed(InstantRenameAction.java:37)
        at
org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:322)
        at
java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1810)
        at
java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2900)
        at
java.desktop/javax.swing.JComponent.processKeyBindings(JComponent.java:2948)
        at
java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2862)
        at java.desktop/java.awt.Component.processEvent(Component.java:6366)
        at java.desktop/java.awt.Container.processEvent(Container.java:2261)
        at
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4966)
        at
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2319)
        at
java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
        at
java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1950)
        at
java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:871)
        at
java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1140)
        at
java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1010)
        at
java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:836)
        at
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4847)
        at
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2319)
        at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
        at
java.desktop/java.awt.Component.dispatchEvent(Component.java:4798)
        at
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
        at java.desktop/java.awt.EventQueue.access$600(EventQueue.java:97)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
        at java.base/java.security.AccessController.doPrivileged(Native
Method)
        at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
        at java.base/java.security.AccessController.doPrivileged(Native
Method)
        at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at
java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at
org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
        at
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Reply via email to