Subscribed unsubscribe Subscribe Subscribe

Kengo's blog

Technical articles about original projects, JVM, Static Analysis and JavaScript.

How to use UserValue to implement FindBugs plugin

UserValue is a good way to mark local variable. By this marking, you can chase item or classify type of item.

To use operand stack, your detector should extend OprandStackDetector or its subclass.

And, this is key point, your detector should be annotated with @CustomUserValue to use UserValue. This marker annotation will help FindBugs to understand your detector and treat OprandStack correctly.

If you forget this annotation, you will find that your UserValue is lost in some case, especially around branching code (like if).