黑莓@Override符号错误
在 Eclipse 中,我做了:Source >清理,并按照这些规则进行清理:
- 将非静态访问更改为静态 使用声明类型的成员
- 将间接访问更改为静态 成员直接访问(访问 通过子类型)
- 删除未使用的导入
- 添加缺少的“@Override”注释
- 添加缺少的“@Deprecated”注释
- 删除不必要的强制转换
- 删除不必要的“$NON-NLS$”标签,
但我似乎无法再编译它。我收到以下错误:
预验证类 com.myapp.blackberry.Override 时出错 java/lang/NoClassDefFoundError:java/lang/annotation/Annotation 错误!:错误:预验证程序失败:C:\eclipse\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.29\components\bin\preverify.exe -d C:\DOCUME ... 打包项目myapp失败(耗时0.422秒)
当我将鼠标悬停在 @Override 上时,它给了我建议“Override 无法解析为类型”,
我不知道此时该怎么办。
In Eclipse, I did: Source > Clean up, and did a clean up according to these rules:
- Change non static accesses to static
members using declaring type - Change indirect accesses to static
members to direct accesses (accesses
through subtypes) - Remove unused imports
- Add missing '@Override' annotations
- Add missing '@Deprecated' annotations
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
but I can't seem to compile it anymore. I get the following error:
Error preverifying class com.myapp.blackberry.Override
java/lang/NoClassDefFoundError: java/lang/annotation/Annotation
Error!: Error: preverifier failed: C:\eclipse\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.29\components\bin\preverify.exe -d C:\DOCUME ...
Packaging project myapp failed (took 0.422 seconds)
When I hover over @Override, it gives me suggestion "Override cannot be resolved to a type"
I am not sure what to do at this point..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Blackberry 开发建立在 j2me 之上,它具有 Java 1.3 的语言特性。这意味着它不支持注释。您可以删除 @Override 注释,您的代码将正常工作。请记住,这些都是可选的,但无论如何都是推荐的。
我所做的就是写 //@Override 。当/如果将来添加注释时,将很容易进行正则表达式替换并删除注释标记。
Blackberry development is built on top of j2me, which has the language features of Java 1.3. This means it doesn't support annotations. You can remove the @Override annotations and your code will work. Remember these are optional although recommended anyways.
What I do, is write //@Override instead. When/If annotations are added in the future it will be easy to do a regex replace and remove the comment marks.
似乎不可能:
看来您必须不用注释了...
Seems to be impossible:
Seems you'll have to do without annotations...