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

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

        <bdo id='ZlaLi'></bdo><ul id='ZlaLi'></ul>

      1. <legend id='ZlaLi'><style id='ZlaLi'><dir id='ZlaLi'><q id='ZlaLi'></q></dir></style></legend>

        Eclipse 中覆盖注释的错误

        时间:2023-09-28
          <tbody id='9nT48'></tbody>
      2. <tfoot id='9nT48'></tfoot>
      3. <small id='9nT48'></small><noframes id='9nT48'>

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

                • <bdo id='9nT48'></bdo><ul id='9nT48'></ul>
                  本文介绍了Eclipse 中覆盖注释的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  Eclipse 中的 @Override 注释有一个烦人的问题.通常,当我在新 PC 上导入工作项目时,Eclipse 会将一些 @Override 注释标记为错误.如果我删除注释一切都很好,Eclipse 还表明这些方法正在覆盖父方法,但添加 Override 注释会再次导致错误.我目前正在开发一个 Android 项目,所以它可能是 Android 的问题,而不是 Eclipse 的问题.

                  解决方案

                  这很可能是因为您在 Java 1.5 和 Java 1.6 之间切换.在 1.5 中,您无法使用 @Override 标记接口实现,但在 1.6 中可以.

                  通过 Google 快速搜索,可以很好地解释这两个版本之间的注释差异:http://www.techienuggets.com/CommentDetail?tx=38155

                  <块引用>

                  @Override 的语义不同JDK 1.5 和 JDK 1.6.在 JDK 1.5 中,不允许使用@Override 注释用于方法的实现在接口中声明,而它们在 JDK 1.6 中是允许的.更多信息,请参阅:

                  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5008260http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399361http://blogs.oracle.com/ahe/?entry=overridep>

                  事实上,描述覆盖注释未更新在 JDK API 文档中.这已经报告为错误:

                  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6501053bugdatabase/view_bug.do?bug_id=6501053

                  I have a annoying problem with @Override annotations in Eclipse. Often when i import working projects on a new PC, Eclipse marks some of the @Override annotations as wrong. If i remove the annotations everything is fine and Eclipse also indicates that the methods are overriding the parents methods but adding the Override annotation causes the error again. I am currently working on an Android project so it might be a problem with Android and not with Eclipse..

                  解决方案

                  This is most likely because you are switching between Java 1.5 and Java 1.6. In 1.5 you couldn't mark interface implementations with @Override, but you can in 1.6.

                  A quick Google search turned up this good explanation of the difference in this annotation between the two versions: http://www.techienuggets.com/CommentDetail?tx=38155

                  Semantics of @Override is different in JDK 1.5 and JDK 1.6. In JDK 1.5, the @Override annotation is not allowed for implementations of methods declared in an interface, while they are allowed in JDK 1.6. For more information, see:

                  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5008260 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399361 http://blogs.oracle.com/ahe/?entry=override

                  It is fact that the description of the Override annotation was not updated in the JDK API docs. This has been reported as a bug:

                  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6501053bugdatabase/view_bug.do?bug_id=6501053

                  这篇关于Eclipse 中覆盖注释的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 JAXB 中,如何使用 @XmlJavaTypeAdapters 注解? 下一篇:用于大输出的 Java 高级文本日志记录窗格

                  相关文章

                  最新文章

                • <legend id='D2uWc'><style id='D2uWc'><dir id='D2uWc'><q id='D2uWc'></q></dir></style></legend>

                      <bdo id='D2uWc'></bdo><ul id='D2uWc'></ul>
                  1. <tfoot id='D2uWc'></tfoot>

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

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