silverburgh
silverburgh

Reputation: 9569

How to disable eclipse annotation error

In eclipse, I get the following errors in my project:

The annotation @SuppressWarnings is disallowed for this location

Can you please tell me how can I turn those errors into warnings?

Thank you.


Look like it is a bug in eclipse3.6M5. This is the code which gives me error. But it works fine in eclipse3.6M4.

package java.lang.annotation;

/**
 * Defines a meta-annotation for indicating that an annotation is automatically
 * inherited.
 *
 * @since 1.5
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Inherited {
}

Upvotes: 2

Views: 13288

Answers (2)

Malcolm Featonby
Malcolm Featonby

Reputation: 579

Project -> Properties -> Java Compiler -> Errors/Warnings.

  • Choose Annotations.
  • Change "Unhandled token in '@SuppressWarnings':" to Ignore.

Rebuild your project and this irritant will go away. Dirty - but given that this masks other issues in the project and waists time probably worth the time saved.

Upvotes: 1

tangens
tangens

Reputation: 39733

If it's really a wrong location of the @SuppressWarnings then there is not much you can do. But why should you turn that off?

As any annotation you can use @SuppressWarnings only in front of a class, a variable declaration, a parameter or a method declaration. All other locations will give you a compile error.

Upvotes: 3

Related Questions