views:

25

answers:

2

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..

+2  A: 

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.

Valchris
You should also remove the Annotation rules "Add missing @Override" and the "Add missing @Deprecated" rules as neither will work in BB dev.
Valchris
When I remove the @Override annotations, it still gives me the same error..
tpae
Actually, when I went project > clean code, it fixed it.. thanks!! :)
tpae
+1  A: 

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...

aioobe