Package randoop.util

Class ClassFileConstants


  • public class ClassFileConstants
    extends Object
    Reads literals from a class file, including from the constant pool and from bytecodes that take immediate arguments.
    • Field Detail

      • bb

        static byte bb
        A byte value for testing.
      • d

        static double d
        A double value for testing.
      • f

        static float f
        A float value for testing.
      • ii

        static int ii
        An int value for testing.
      • ll

        static long ll
        A long value for testing.
      • s

        static short s
        A short value for testing.
      • c

        static char c
        A char value for testing.
    • Constructor Detail

      • ClassFileConstants

        public ClassFileConstants()
    • Method Detail

      • main

        public static void main​(String[] args)
                         throws IOException
        A simple driver program that prints output literals file format.
        Parameters:
        args - the command line arguments
        Throws:
        IOException - if an error occurs in writing the constants
        See Also:
        LiteralFileReader
      • getConstants

        public static ClassFileConstants.ConstantSet getConstants​(String classname,
                                                                  ClassFileConstants.ConstantSet result)
        Adds all the constants found in the given class into the given ConstantSet, and returns it.
        Parameters:
        classname - the name of the type
        result - the set of constants to which constants are added
        Returns:
        the set of constants with new constants of given type added
        See Also:
        getConstants(String)
      • doubleConstant

        static void doubleConstant​(Double value,
                                   ClassFileConstants.ConstantSet cs)
        Register a double constant in the given ConstantSet.
        Parameters:
        value - the double constant
        cs - the ConstantSet
      • floatConstant

        static void floatConstant​(Float value,
                                  ClassFileConstants.ConstantSet cs)
        Register a float constant in the given ConstantSet.
        Parameters:
        value - the float constant
        cs - the ConstantSet
      • integerConstant

        static void integerConstant​(Integer value,
                                    ClassFileConstants.ConstantSet cs)
        Register an integer constant in the given ConstantSet.
        Parameters:
        value - the integer constant
        cs - the ConstantSet
      • longConstant

        static void longConstant​(Long value,
                                 ClassFileConstants.ConstantSet cs)
        Register a long constant in the given ConstantSet.
        Parameters:
        value - the long constant
        cs - the ConstantSet
      • getNonreceiverTerms

        public static Set<NonreceiverTerm> getNonreceiverTerms​(Class<?> c)
        Return the set of NonreceiverTerms converted from constants for the given class.
        Parameters:
        c - the class
        Returns:
        a set of Nonreceiver terms for the given class
      • addToConstantMap

        private static void addToConstantMap​(ClassFileConstants.ConstantSet cs,
                                             MultiMap<Class<?>,​NonreceiverTerm> map)
        Add all constant values from the given ConstantSet as NonreceiverTerms to their corresponding class in the given map.
        Parameters:
        cs - the constant set
        map - the map to add to
      • constantSetToNonreceiverTerms

        private static Set<NonreceiverTerm> constantSetToNonreceiverTerms​(ClassFileConstants.ConstantSet cs)
        Convert a ConstantSet to a set of NonreceiverTerms.
        Parameters:
        cs - the ConstantSet
        Returns:
        a set of NonreceiverTerms