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

时间:2019-04-28 08:21:00

标签: java eclipse spring-tool-suite lombok spring-tools-4

环境 jdk1.8 弹簧工具套件4

问题 由于Eclipse Java问题而无法调试项目。

关键字 codegen.TypeAnnotationCodeStream.newArray

详细信息

//this will always work and will save the state of the boxes


protected void onPause() {
        super.onPause();

        save(ctv1.isChecked());
        save(ctv2.isChecked());
        save(ctv3.isChecked());


}

protected void onResume() {
        super.onResume();


        ctv1.setChecked(load());
        ctv2.setChecked(load());
        ctv3.setChecked(load());
}


//when I add all of them, they are always either checked or unchecked
//it doesn't matter what combination of them I try, it seems that it is //always working with a couple of CTV's but fails with more than 5-6 of them



//this is how my onClickListener looks like

     CheckedTextView ctv1 = (CheckedTextView) findViewById(R.id.ctvFOX1);
      ctv1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              if (ctv1.isChecked()) {
                  ctv1.setChecked(false);


              }
              else {
                  ctv1.setChecked(true);

              }
          }
      });




//save and load methods


private void save(final boolean isChecked) {
    SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.putBoolean("check", isChecked);
    editor.apply();
}

private boolean load() {
    SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);
    return sharedPreferences.getBoolean("check", false);
    }

enter image description here

2 个答案:

答案 0 :(得分:0)

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

错误报告中有很多文字,但其中提到了“ org.eclipse.jdt.internal.compiler.codegen.CodeStream.newArray”和一些情况下的Null。

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

答案 1 :(得分:0)

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

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

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

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

日食错误已解决。