Discards unnecessary attributes, in particular,
CodeAttribute
s (method bodies) of the class, to minimize the memory footprint. After calling this method, the class is read only. It cannot be modified any more. Furthermore,
toBytecode()
,
writeFile()
,
toClass()
, or
instrument()
cannot be called. However, the method names and signatures in the class etc. are still accessible.
toBytecode()
, writeFile()
, and toClass()
internally call this method if automatic pruning is on.
According to some experiments, pruning does not really reduce memory consumption. Only about 20%. Since pruning takes time, it might not pay off. So the automatic pruning is off by default.
@see #stopPruning(boolean)
@see #detach()
@see ClassPool#doPruning
@see #toBytecode()
@see #toClass()
@see #writeFile()
@see #instrument(CodeConverter)
@see #instrument(ExprEditor)