The ClassBuilder
API provides multiple ways to declare a method and its body, including withMethod
and
withMethodBody
. While they can be used in very similar ways, withMethodBody
reduces boilerplate code, lowers cognitive
complexity and improves maintainability.
Exceptions
The rule will not raise on calls where the method under construction is abstract (eg: using the flag ClassFile.ACC_ABSTRACT
).