negora opened a new issue, #4034:
URL: https://github.com/apache/netbeans/issues/4034

   ### Apache NetBeans version
   
   Apache NetBeans 13
   
   ### What happened
   
   When I try to generate a getter for a class field (and, optionally, also a 
setter), NetBeans shows the following error in the *Notifications* window:
   
   ```
   Cannot invoke "org.eclipse.lsp4j.WorkspaceEdit.getDocumentChanges()" because 
"edit" is null
   ```
   
   This is the stack trace:
   
   ```
   java.lang.NullPointerException: Cannot invoke 
"org.eclipse.lsp4j.WorkspaceEdit.getDocumentChanges()" because "edit" is null
        at 
org.netbeans.modules.lsp.client.Utils.applyWorkspaceEdit(Utils.java:94)
        at org.netbeans.modules.lsp.client.Utils.applyCodeAction(Utils.java:198)
        at 
org.netbeans.modules.lsp.client.bindings.LanguageClientImpl$DiagnosticFixList$CommandBasedFix.implement(LanguageClientImpl.java:299)
   [catch] at org.netbeans.modules.editor.hints.HintsUI$1.run(HintsUI.java:810)
        at 
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
        at 
org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
        at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
        at 
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
   ```
   
   
   ### How to reproduce
   
   Suppose that I've the following TypeScript source file:
   
   ```ts
   export class Student {
        private age: number;
   }
   ```
   
   When I open it in NetBeans, the editor shows an error saying this: *'age' is 
declared but its value is never read.* Then, if I do one of these things:
   
   * Option A
   1. Main menu
   2. Source
   3. Fix code...
   4. Generate 'get' and 'set' accessors
   
   * Bulb in editor's gutter
   1. Click
   2. Generate 'get' and 'set' accessors
   
   The error mentioned in the previous section is thrown.
   
   
   ### Did this work correctly in an earlier version?
   
   No
   
   ### Operating System
   
   Debian GNU/Linux 11.3 (Bullseye)
   
   ### JDK
   
   OpenJDK Runtime Environment (build 17.0.2+8-Debian-1deb11u1)
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   In NetBeans IDE 13, the same error was thrown when adding an `import` 
automatically, by choosing *Add import from <package>* in the bulb's menu. 
However, in version 14 RC 1 this seems to be fixed.
   
   In NetBeans IDE 14 RC1, this error also occurs when you select a piece of 
code and try to extract it into a method (or other kind of refactoring). In 
this case, we need to choose *Insert code...* instead of *Fix code...*, but the 
result is the same.
   
   
   ### Are you willing to submit a pull request?
   
   No
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to