title: How to mark a Java method as "must use result" for static analysis purposes?
body: <p>When using GCC to compile C or C++, you can mark functions with <strong>attribute</strong>((warn_unused_result)) which will cause the compiler to complain if you invoke a function that returns something and then don't assign it to anything.</p>
  
  <p>I have some methods in a Java library I develop that have methods like this - calling them and then throwing away the result is always a bug. I would like API users to be able to identify such bugs via static analysis, such as with FindBugs or IntelliJ inspections.</p>
  
  <p>I am wondering if there is a method annotation that is commonly used to mark methods or functions as "must use result". FindBugs has some special case bug-finders for the standard library, but a general way would be useful.</p>