eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
157 stars 124 forks source link

NPE in AST: Cannot read the array length because "this.arguments" is null #2828

Closed travkin79 closed 4 weeks ago

travkin79 commented 1 month ago

After installing the Eclipse Platform UI using the the Oomph installer using the link given here, I get a NullPointerException that occurs in the Error Log View.

Stacktrace:

java.lang.RuntimeException: Internal Error compiling /org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/FoldingTest.java
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.compile(ProcessTaskManager.java:167)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1570)
Caused by: java.lang.NullPointerException: Cannot read the array length because "this.arguments" is null
    at org.eclipse.jdt.internal.compiler.ast.MessageSend.isMissingTypeRelevant(MessageSend.java:1122)
    at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:998)
    at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:1126)
    at org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
    at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:725)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:713)
    at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:409)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:611)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1514)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1643)
    at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:666)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:924)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.compile(ProcessTaskManager.java:163)
    ... 5 more

Steps to reproduce

See this comment

jukzi commented 1 month ago

@stephan-herrmann that code was recently added by you f6fe3c8fee3d83b2478db25eb34781b62cab668b

cdietrich commented 1 month ago

same but different statement here

java.lang.RuntimeException: Internal Error compiling /org.eclipse.xtext.common.types.ui/src/org/eclipse/xtext/common/types/xtext/ui/JdtTypesProposalProvider.java
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.compile(ProcessTaskManager.java:167)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NullPointerException: Cannot read the array length because "this.arguments" is null
    at org.eclipse.jdt.internal.compiler.ast.AllocationExpression.isMissingTypeRelevant(AllocationExpression.java:544)
    at org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:508)
    at org.eclipse.jdt.internal.compiler.ast.ReturnStatement.resolve(ReturnStatement.java:362)
    at org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
    at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:725)
    at org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:128)
    at org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
    at org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:311)
    at org.eclipse.jdt.internal.compiler.ast.Statement.resolveWithBindings(Statement.java:498)
    at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveStatements(ASTNode.java:725)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:713)
    at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:409)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:611)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1514)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1643)
    at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:666)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:924)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.compile(ProcessTaskManager.java:163)
    ... 5 more
stephan-herrmann commented 1 month ago

Thanks for reporting and sorry for the (unnecessary) hassle.

Luckily (!!) the stack trace points to the exact problem even without a code example.