Open gayanper opened 1 month ago
@mickaelistria @datho7561 seems like in the parsing cycle of the code select before rename and parsing cycle before running the rename refactoring provides JC nodes with symbol null.
Seems like the root cause is this which happens while resolving binding
java.lang.NullPointerException: Cannot invoke "javax.lang.model.element.Element.getKind()" because "elem" is null
java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "javax.lang.model.element.Element.getKind()" because "elem" is null
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:168)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:379)
at org.eclipse.jdt.core.dom.JavacBindingResolver.resolve(JavacBindingResolver.java:272)
at org.eclipse.jdt.core.dom.JavacBindingResolver.resolvePackage(JavacBindingResolver.java:732)
at org.eclipse.jdt.core.dom.PackageDeclaration.resolveBinding(PackageDeclaration.java:323)
at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.resolveBindings(JavacCompilationUnitResolver.java:406)
at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.resolveBindings(JavacCompilationUnitResolver.java:400)
at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.toCompilationUnit(JavacCompilationUnitResolver.java:459)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateASTCached(ASTParser.java:1263)
at org.eclipse.jdt.core.dom.ASTParser.lambda$0(ASTParser.java:1142)
at org.eclipse.jdt.internal.core.JavaModelManager.cacheZipFiles(JavaModelManager.java:5762)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1142)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:882)
at org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser.parse(RefactoringASTParser.java:85)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameAnalyzeUtil.analyzeLocalRenames(RenameAnalyzeUtil.java:419)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameAnalyzeUtil.analyzeLocalRenames(RenameAnalyzeUtil.java:402)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameLocalVariableProcessor.doCheckFinalConditions(RenameLocalVariableProcessor.java:289)
at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:51)
at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:227)
at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:163)
at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:82)
at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:116)
at org.eclipse.jdt.ls.core.internal.handlers.RenameHandler.rename(RenameHandler.java:92)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$22(JDTLanguageServer.java:863)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:690)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:527)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1458)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2034)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:189)
Caused by: java.lang.NullPointerException: Cannot invoke "javax.lang.model.element.Element.getKind()" because "elem" is null
at jdk.compiler/com.sun.tools.javac.model.JavacTypes.getOverriddenMethods(JavacTypes.java:337)
at jdk.javadoc/jdk.javadoc.internal.doclint.Env.setCurrent(Env.java:192)
at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.scan(Checker.java:167)
at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$2.visitDecl(DocLint.java:297)
at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitMethod(DocLint.java:448)
at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitMethod(DocLint.java:425)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:989)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:110)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:118)
at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:202)
at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitClass(DocLint.java:443)
at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitClass(DocLint.java:425)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:896)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:110)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:118)
at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:151)
at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitCompilationUnit(DocLint.java:469)
at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$DeclScanner.visitCompilationUnit(DocLint.java:425)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:625)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint$3.started(DocLint.java:308)
at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.started(ClientCodeWrapper.java:865)
at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.started(MultiTaskListener.java:120)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1347)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1328)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:404)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$analyze$1(JavacTaskImpl.java:379)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
... 30 more
Seems like this a is JDK EA bug, any plans that we could make this incubator run both with last released JDK and next EA version at the same time ? IN other words could we make the EA builds only for testing purpose on CI and make last released version as the dependency to run the LS.
I just removed the JDK-23 requirement from the vscode-java poc branch and point the ls.java-home to a JDK 22, this bug cannot be reproduced and LS runs perfectly fine. @fbricon Do you think we could remove the Java 23 requirement from the vscode-java-poc ?
@mickaelistria I'm assuming we can close this issue since it is a JDK bug.
@gayanper If you can reproduce this issue with plain Javac or with a simple demonstrator using only Javac APIs, please report it to https://bugs.java.com/
@gayanper If you can reproduce this issue with plain Javac or with a simple demonstrator using only Javac APIs, please report it to https://bugs.java.com/
This happens randomly, i tried running with plain javac and also with maven multiple times. I think we can check again once we have more stable build available. I can check a more recent EA build as well.
Try renaming the
names
, This to reproduce the statement must be in a overriden interface method which interface method doesn't have any documentation.