Java – generates compiler warnings using user-defined annotations

Is it possible for the compiler to generate warnings when encountering user-defined comments? Something like the @ deprecated annotation?

thank you

Solution

Based on your original questions and comments, I assume you are trying to do the following:

>Mark the code as incomplete (with compiler warnings) so that other developers do not use it. > Incomplete code will be identified later in the IDE

I don't believe you can mark code with compiler warnings@ The deprecated tag is baked into the compiler A more common way to indicate that a method is incomplete is to throw an exception:

Throw a new unsupported operationexception ("not yet implemented");

It won't work until runtime, but other developers should unit test their code

As for identifying incomplete code, I will still review my original comments Using todo annotation tags, eclipse will build a task list for you If your list is cluttered with automatically generated code but has not been cleaned up, you can use fixme, XXX or define your own code Then you should be able to filter your list

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>