Class AsmUtilCopy


  • public class AsmUtilCopy
    extends Object
    Copy of quarkus-core AsmUtil for some methods, with a tweak on the ARG_MAPPER (not name->String anymore) and methods for getting a class signature and knowing if a signature is required.
    • Constructor Summary

      Constructors 
      Constructor Description
      AsmUtilCopy()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String getGeneratedSubClassSignature​(org.jboss.jandex.ClassInfo superClass, org.jboss.jandex.Type superClassAsType)
      Returns the Java bytecode signature of a given Jandex Class using the given type argument mappings.
      static String getSignature​(org.jboss.jandex.MethodInfo method)
      Returns the Java bytecode signature of a given Jandex MethodInfo with no type argument mappings.
      static String getSignature​(org.jboss.jandex.MethodInfo method, Function<org.jboss.jandex.TypeVariable,​org.jboss.jandex.Type> typeArgMapper)
      Returns the Java bytecode signature of a given Jandex MethodInfo using the given type argument mappings.
      static boolean needsSignature​(org.jboss.jandex.MethodInfo method)
      Returns true if the given method has type parameters or if its return type or parameter types require a signature
    • Constructor Detail

      • AsmUtilCopy

        public AsmUtilCopy()
    • Method Detail

      • getSignature

        public static String getSignature​(org.jboss.jandex.MethodInfo method)
        Returns the Java bytecode signature of a given Jandex MethodInfo with no type argument mappings. For example, given this method:
         
         public class Foo<T> {
          public <R> List<R> method(int a, T t){...}
         }
         
         
        This will return <R:Ljava/lang/Object;>(ITT;)Ljava/util/List<TR;>;.
        Parameters:
        method - the method you want the signature for.
        Returns:
        a bytecode signature for that method.
      • getSignature

        public static String getSignature​(org.jboss.jandex.MethodInfo method,
                                          Function<org.jboss.jandex.TypeVariable,​org.jboss.jandex.Type> typeArgMapper)
        Returns the Java bytecode signature of a given Jandex MethodInfo using the given type argument mappings. For example, given this method:
         
         public class Foo<T> {
          public <R> List<R> method(int a, T t){...}
         }
         
         
        This will return <R:Ljava/lang/Object;>(ILjava/lang/Integer;)Ljava/util/List<TR;>; if your typeArgMapper contains T=Ljava/lang/Integer;.
        Parameters:
        method - the method you want the signature for.
        typeArgMapper - a mapping between type variables and their resolved type.
        Returns:
        a bytecode signature for that method.
      • getGeneratedSubClassSignature

        public static String getGeneratedSubClassSignature​(org.jboss.jandex.ClassInfo superClass,
                                                           org.jboss.jandex.Type superClassAsType)
        Returns the Java bytecode signature of a given Jandex Class using the given type argument mappings. For example, given this superclass:
         {@code
         public class Foo extends Bar implements List {
         }
         
        This will return <R:Ljava/lang/Object;>LFoo<TR;>;. {@code Bar} and {@code List} will be ignored, as they won't be part of the signature of the generated subclass. All will be as if the generated subclass was declared like this:
         {@code
         public class MyGeneratedClass extends Foo {
         }
         
        Parameters:
        superClass - the superclass of the type you want to generate the signature for.
        superClassAsType - the superclass as a Jandex Type.
        Returns:
        a bytecode signature for that class.
      • needsSignature

        public static boolean needsSignature​(org.jboss.jandex.MethodInfo method)
        Returns true if the given method has type parameters or if its return type or parameter types require a signature