Class ConstantInitializerToTagTransformer


  • public class ConstantInitializerToTagTransformer
    extends SceneTransformer
    This is the reverse operation of the ConstantValueToInitializerTransformer. We scan for <clinit> methods that initialize a final field with a constant value and create a ConstantValueTag from this value. Afterwards, the assignment in the <clinit> method is removed. If <clinit> runs empty, it is deleted as well.
    Author:
    Steven Arzt
    • Constructor Detail

      • ConstantInitializerToTagTransformer

        public ConstantInitializerToTagTransformer()
    • Method Detail

      • transformClass

        public void transformClass​(SootClass sc,
                                   boolean removeAssignments)
        Transforms the given class, i.e. scans for a <clinit> method and generates new constant value tags for all constant assignments to static final fields.
        Parameters:
        sc - The class to transform
        removeAssignments - True if the assignments inside the <clinit> method shall be removed, otherwise false