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..
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:
The deal is Java ME uses version 1.4 of Java Language Specification. You cannot use Java 5 language features.
Seems you'll have to do without annotations...
精彩评论