java.lang.NullPointerException 在 org.eclipse.jdt.internal.compiler.codegen.CodeStream.newArray

java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.codegen.CodeStream.newArray

环境 jdk1.8 spring-工具套件 4

问题 由于 eclipse java 问题,无法调试项目。

关键字 codegen.TypeAnnotationCodeStream.newArray

详情

Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

Contains: Errors running builder 'Java Builder' on project 'goodslist'.
java.lang.NullPointerException
    at org.eclipse.jdt.internal.compiler.codegen.CodeStream.newArray(CodeStream.java:6096)
    at org.eclipse.jdt.internal.compiler.codegen.TypeAnnotationCodeStream.newArray(TypeAnnotationCodeStream.java:88)
    at org.eclipse.jdt.internal.compiler.ast.ArrayInitializer.generateCode(ArrayInitializer.java:82)
    at org.eclipse.jdt.internal.compiler.ast.ArrayInitializer.generateCode(ArrayInitializer.java:70)
    at org.eclipse.jdt.internal.compiler.ast.ReturnStatement.generateCode(ReturnStatement.java:224)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:344)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:281)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:578)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:648)
    at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:410)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:903)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:145)
    at java.lang.Thread.run(Thread.java:748)

这可能是你的问题吗? https://bugs.eclipse.org/bugs/show_bug.cgi?id=383624

错误报告中有很多文本,但它在少数情况下提到了 "org.eclipse.jdt.internal.compiler.codegen.CodeStream.newArray" 和 Nulls。

错误标记为已修复。也许仔细检查你的版本,你可能需要更新你的 Eclipse 版本...

日志中的关键信息是“ArrayInitializer”。

我的解决方案是转换下面的代码

  @Builder.Default
  private String[] attrValueIdPairs = {""};

  @Builder.Default
  private String[] attrValueIdPairs = new String[]{""};

eclipse 错误已解决。