Class JavassistUtils


  • class JavassistUtils
    extends java.lang.Object
    • Constructor Detail

      • JavassistUtils

        JavassistUtils()
    • Method Detail

      • getTypeName

        private static java.lang.String getTypeName​(javassist.bytecode.SignatureAttribute.ClassType classType)
      • removeTypeArguments

        private static java.lang.String removeTypeArguments​(java.lang.String typeName)
      • internalNameToCanonicalName

        static java.lang.String internalNameToCanonicalName​(java.lang.String typeName)
      • extractParameterName

        static java.util.Optional<java.lang.String> extractParameterName​(javassist.CtBehavior method,
                                                                         int paramNumber)
        Returns the paramNumberth parameter of a method or constructor, if it is available.

        The name is not available, if

        • the method is abstract, i.e. explicitly declared as abstract or it is a non-default interface method
        • methods and constructors from jar files, which have been compiled without debug symbols

        The parameters are counted from 0, skipping the implicit this parameter of non-static methods.

        Parameters:
        method - the method to look into
        paramNumber - the number of the parameter to look for
        Returns:
        the found parameter name or empty, if the name is not available
      • getVariableName

        private static java.util.Optional<java.lang.String> getVariableName​(javassist.bytecode.LocalVariableAttribute attr,
                                                                            int pos)