• <i id='E9K0K'><tr id='E9K0K'><dt id='E9K0K'><q id='E9K0K'><span id='E9K0K'><b id='E9K0K'><form id='E9K0K'><ins id='E9K0K'></ins><ul id='E9K0K'></ul><sub id='E9K0K'></sub></form><legend id='E9K0K'></legend><bdo id='E9K0K'><pre id='E9K0K'><center id='E9K0K'></center></pre></bdo></b><th id='E9K0K'></th></span></q></dt></tr></i><div id='E9K0K'><tfoot id='E9K0K'></tfoot><dl id='E9K0K'><fieldset id='E9K0K'></fieldset></dl></div>

      <small id='E9K0K'></small><noframes id='E9K0K'>

      <legend id='E9K0K'><style id='E9K0K'><dir id='E9K0K'><q id='E9K0K'></q></dir></style></legend>
      1. <tfoot id='E9K0K'></tfoot>
          <bdo id='E9K0K'></bdo><ul id='E9K0K'></ul>

        制作“课堂"瞬态或可序列化但该类是可序列化的

        时间:2024-05-09
      2. <i id='Q4bDU'><tr id='Q4bDU'><dt id='Q4bDU'><q id='Q4bDU'><span id='Q4bDU'><b id='Q4bDU'><form id='Q4bDU'><ins id='Q4bDU'></ins><ul id='Q4bDU'></ul><sub id='Q4bDU'></sub></form><legend id='Q4bDU'></legend><bdo id='Q4bDU'><pre id='Q4bDU'><center id='Q4bDU'></center></pre></bdo></b><th id='Q4bDU'></th></span></q></dt></tr></i><div id='Q4bDU'><tfoot id='Q4bDU'></tfoot><dl id='Q4bDU'><fieldset id='Q4bDU'></fieldset></dl></div>

            <tbody id='Q4bDU'></tbody>
          <tfoot id='Q4bDU'></tfoot>

                • <bdo id='Q4bDU'></bdo><ul id='Q4bDU'></ul>

                  <small id='Q4bDU'></small><noframes id='Q4bDU'>

                  <legend id='Q4bDU'><style id='Q4bDU'><dir id='Q4bDU'><q id='Q4bDU'></q></dir></style></legend>
                  本文介绍了制作“课堂"瞬态或可序列化但该类是可序列化的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  SonarQube 5.1 在查看我的代码后标记了许多关键问题.然而,类本身和字段中引用的类也是可序列化的.被引用的类通过一个类继承了可序列化的接口.

                  SonarQube 5.1 marks a lot of critical issues after reviewing my code. However the class itself and the referenced class in the field is also serializable. The referenced class inherits the serializable interface through a class.

                  这是我的例子

                  public class A implements Serializable {
                       private B b;  // -> Sonarcube markes this field as not serialzable
                  }
                  

                  而B类定义如下

                  public class B extends C {
                   ....
                  }
                  

                  而C类定义如下

                  public abstract class C extends D {
                   ....
                  }
                  

                  并且定义了D类

                  public abstract class D implements Serializable {
                    ....
                  }
                  

                  在同一个项目上运行 FindBugs 不会发现这些问题.我不确定它是 sonarcube 中的错误还是我的代码有其他问题(C、D 类中的其他字段或其他)

                  Running FindBugs on the same project does not see these problems. I am not sure if it is a bug in sonarcube or is my code has some other problems (other fields in the classes C,D or something else)

                  有人知道吗?

                  推荐答案

                  可能是因为没有正确提供二进制文件.我的 SonarQube 配置有类似的问题,然后我发现实现 Serializable 的类位于不同的模块和/或外部库中.

                  It is probably because the binary files are not provided correctly. I had a similar issue with my SonarQube configuration, then I discovered that the classes that implement Serializable are in different modules and/or in an external library.

                  sonar.java.binariessonar.java.libraries 设置正确的值允许 SonarQube 定位二进制文件并正确确定类是否可序列化.

                  Setting correct values for sonar.java.binaries and sonar.java.libraries allow SonarQube to locate the binaries and correctly determine whether or not the classes are serializable.

                  这篇关于制作“课堂"瞬态或可序列化但该类是可序列化的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:不好的做法 - 类定义 compareTo(...) 并使用 Object.equals() 下一篇:API 与 SonarQube 5.6 和 Java Analyzer 4.0 与 Findbugs 3.3 或 Cob

                  相关文章

                      <i id='vEth4'><tr id='vEth4'><dt id='vEth4'><q id='vEth4'><span id='vEth4'><b id='vEth4'><form id='vEth4'><ins id='vEth4'></ins><ul id='vEth4'></ul><sub id='vEth4'></sub></form><legend id='vEth4'></legend><bdo id='vEth4'><pre id='vEth4'><center id='vEth4'></center></pre></bdo></b><th id='vEth4'></th></span></q></dt></tr></i><div id='vEth4'><tfoot id='vEth4'></tfoot><dl id='vEth4'><fieldset id='vEth4'></fieldset></dl></div>
                      • <bdo id='vEth4'></bdo><ul id='vEth4'></ul>
                    1. <legend id='vEth4'><style id='vEth4'><dir id='vEth4'><q id='vEth4'></q></dir></style></legend>

                      <small id='vEth4'></small><noframes id='vEth4'>

                      <tfoot id='vEth4'></tfoot>