I did some work with annotation processing, and it would be really helpful to warn the user about using certain annotated methods. This basically creates a custom version of the annotation @Deprecated. I thought a good place to start might be the actual annotation handler for @Deprecated, but I can't find it .: _
@Deprecated
(Note that this is similar, but not the same as How to deliberately trigger a custom java compiler warning message? )
Thank!
. API , ( ). API . , . @Deprecated, , , " ".
, . , . - :
try { doWork(workUnit, 15, Style.STRICT); } catch (MakeSureYouOverrodeEverythingYouWantedToFirst warning) { ; // will never actually reach here, but you have been warned! }
, , , . , , ( ), .
, , !
, .
, null varargs.
Checker Framework (, ) ( ).
https://checkerframework.org/
.
, , , . , . , , , .
javac, OpenJDK. , .
, , FindBugs PMD, .
Source: https://habr.com/ru/post/1779874/More articles:C ++, a function that loads text ignores the last few lines with only some .txt files - c ++Текст холста на холсте Android и изменение текста впоследствии - androidNeed help developing a cake sorting algorithm in Java - javaIs there a function to find all lowercase letters in a character vector? - rmatplotlib MemoryError on pcolorfast - pythonMemoryError when starting Numpy Meshgrid - pythonAre HTML files loaded in the BlackBerry browser? - htmlIn C ++, how does the expression "* pointer ++" work? - c ++PHP: imagemagick creates an empty image with conversion - phpHow to extract number from HTML range using jQuery? - jqueryAll Articles