javaannotationswarnings

Generate compiler warning with user defined annotation


Is it possible for make the compiler generate a warning when it encounters a user defined annotaion? Something similar to the @Deprecated annotation?


Solution

  • Based on your original question and comments, I assume you're trying to do the following:

    I don't believe you can mark the code with a compiler warning. The @Deprecated tag is baked into the compiler. A more common way of indicating a method is incomplete is by throwing an exception:

    throw new UnsupportedOperationException("Not implemented yet");

    The effect isn't realized until runtime, but the other developers should be unit testing their code.

    As for identifying the incomplete code I would still refer back to my original comment. Use the TODO comment tag and Eclipse will build a task list for you. If your list is cluttered with auto-generated code that hasn't been cleaned up, you can use FIXME, XXX, or define your own. You should then be able to filter your list.