You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should be a simple change. @snjeza's change is simply catching an error that failed the entire code action collection in the static initializer case.
[Trace - 2:41:03 PM] Received response 'textDocument/codeAction - (444)' in 69ms. Request failed: Internal error. (-32603).
Error data: "java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke \"org.eclipse.jdt.core.dom.MethodDeclaration.getParent()\" because the return value of \"org.eclipse.jdt.ls.core.internal.corext.refactoring.code.ExtractFieldRefactoring.getMethodDeclaration()\" is null
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.exec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.topLevelExec(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke \"org.eclipse.jdt.core.dom.MethodDeclaration.getParent()\" because the return value of \"org.eclipse.jdt.ls.core.internal.corext.refactoring.code.ExtractFieldRefactoring.getMethodDeclaration()\" is null
at org.eclipse.jdt.ls.core.internal.corext.refactoring.code.ExtractFieldRefactoring.getEnclosingTypeDeclaration(ExtractFieldRefactoring.java:888)
at org.eclipse.jdt.ls.core.internal.corext.refactoring.code.ExtractFieldRefactoring.checkInitialConditions(ExtractFieldRefactoring.java:315)
at org.eclipse.jdt.ls.core.internal.text.correction.RefactorProposalUtility.getExtractFieldProposal(RefactorProposalUtility.java:556)
at org.eclipse.jdt.ls.core.internal.text.correction.RefactorProposalUtility.getGenericExtractFieldProposal(RefactorProposalUtility.java:527)
at org.eclipse.jdt.ls.core.internal.corrections.RefactorProcessor.getExtractFieldProposal(RefactorProcessor.java:295)
at org.eclipse.jdt.ls.core.internal.corrections.RefactorProcessor.getProposals(RefactorProcessor.java:140)
at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:177)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda5(JDTLanguageServer.java:666)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambdabash(BaseJDTLanguageServer.java:75)
... 7 more
As shown in the picture below, refactor actions are not available in static init.
Environment
Steps To Reproduce
Hopefully, no logs are needed, reproducible in many environments.
Current Result
Refactor actions are not available in static init.
Expected Result
Refactor actions are available in static init.
Additional Informations
Compiled pictures of using refactor action on both places.
The text was updated successfully, but these errors were encountered: