Skip to content

Compute Maxs and Frames Per Method Basis

In this MR, I added the setFlags method to the ClassWriter. This change allows the calculation of maxs, locals, and frames on a per-method basis. However, to preserve the existing ClassWriter API, I added another ClassWriter implementation named FlexibleClassWriter, which allows a developer to switch between different modes.

Of course, we could leave only the setFlags setter and use only it. But I'm afraid that if we do this, we won't be able to remove (or alter it somehow) it in the future. By using FlexibleClassWriter, we encapsulate the logic of changing flags, which is a bit safer. Moreover, in some cases, setters are considered anti-patterns.

Closes: #318013 (closed)

Edited by Vladimir Zakharov

Merge request reports

Loading