Deprecate in Java 1.6

deprecated, java, java-6, javadoc

Solution

You have to tell the compiler to use 1.6:

javac -source 1.6

Or equivalent for your IDE/build system (as others have suggested).

Problem

In Java 1.5, to deprecate a method you would: ``` @Deprecated int foo(int bar) { } ``` Compiling this in Java 1.6 results in the following: Syntax error, annotations are only available if source level is 1.5 Any ideas?

Original source