Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

force warning in java

I'd like a mechanism to throw a compile-time warning manually. I'm using it to flag unfinished code so I can't possibly forget about it later. @Deprecated is close but warns at caller site, not at creation site. I'm using eclipse. Something like #Warning in C#.

like image 205
Dustin Getz Avatar asked May 19 '10 18:05

Dustin Getz


2 Answers

Why not just add a flag in the source code like //TODO: or something? And then just search for all occurances of TODO in the file? You could even have some special flag too like FINISHME or something.

If you have hundreds of TODOs in your project from the team, you can filter by a string e.g. your initials in the Task pane's top-right menus.

like image 54
Mitch Dempsey Avatar answered Oct 07 '22 00:10

Mitch Dempsey


A lot better than using the deprecated annotation in my humble opinion the suppresswarnings annotation.

@SuppressWarnings("XXX")

can be annotated almost everywhere and as long as XXX is not a valid warning you will get a warning from eclipse about that.

like image 30
Daniel Hofmann Avatar answered Oct 07 '22 01:10

Daniel Hofmann