Class Signature


  • @Immutable
    public final class Signature
    extends java.lang.Object
    Represents the signature of a method, which is sometimes needed for selecting the correct method.
    • Field Detail

      • rtype

        private Type rtype
      • types

        private java.util.List<Type> types
      • signature

        private java.lang.String signature
    • Constructor Detail

      • Signature

        private Signature​(Type rtype,
                          java.util.List<Type> types)
    • Method Detail

      • returnType

        public Type returnType()
      • argTypes

        public java.util.List<Type> argTypes()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • signature

        public java.lang.String signature()
      • displayAsMethod

        public java.lang.String displayAsMethod()
      • displayAsMethod

        public java.lang.String displayAsMethod​(java.lang.String methodName)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • checkArgTypeCompatibility

        private void checkArgTypeCompatibility​(java.util.List<Type> atypes)
      • checkArgTypeCompatibility

        private boolean checkArgTypeCompatibility​(java.util.List<Type> atypes,
                                                  boolean throwsException)
      • getExprTypes

        static java.util.List<Type> getExprTypes​(java.util.List<Expression> exprs)
      • getClassInfo

        private static ClassInfo getClassInfo​(Type type)
      • checkCompatibility

        private void checkCompatibility​(Type targetType,
                                        java.lang.String ident,
                                        java.util.List<Expression> args,
                                        boolean isStaticMethod)
      • checkCompatibility

        public void checkCompatibility​(Type targetType,
                                       java.lang.String ident,
                                       java.util.List<Expression> args)
        Check whether the list of expression in args is statically compatible with this Signature. This means that args and this.types have the same length, and the type of each expression in args is assignment compatible with the corresponding types in this.types. Also, the targetType must actually contain a non-static method of the appropriate signature and name.
        Throws:
        java.lang.IllegalArgumentException - if args is not compatible with this.types.
      • checkStaticCompatibility

        public void checkStaticCompatibility​(Type targetType,
                                             java.lang.String ident,
                                             java.util.List<Expression> args)
        Check whether the list of expression in args is statically compatible with this Signature. This means that args and this.types have the same length, and the type of each expression in args is assignment compatible with the corresponding types in this.types. Also, the targetType must actually contain a static method of the appropriate signature and name.
        Throws:
        java.lang.IllegalArgumentException - if args is not compatible with this.types.
      • checkConstructorCompatibility

        public void checkConstructorCompatibility​(Type targetType,
                                                  java.util.List<Expression> args)
        Check whether the list of expression in args is statically compatible with this Signature. This means that args and this.types have the same length, and the type of each expression in args is assignment compatible with the corresponding types in this.types. Also, the targetType must actually contain a constructor of the appropriate signature and name.
        Throws:
        java.lang.IllegalArgumentException - if args is not compatible with this.types.
      • getMethods

        private static java.util.Set<MethodInfo> getMethods​(Type type,
                                                            java.lang.String ident,
                                                            boolean staticOnly)
      • getCompatibleMethods

        private static java.util.Set<MethodInfo> getCompatibleMethods​(java.util.Set<MethodInfo> methods,
                                                                      java.util.List<Type> argTypes)
      • sprintf

        private static java.lang.String sprintf​(java.lang.String format,
                                                java.lang.Object... args)
      • getCallTypeString

        private static java.lang.String getCallTypeString​(Signature.CallType ct,
                                                          java.lang.String ident)
      • getTypeListString

        private static java.lang.String getTypeListString​(java.util.List<Type> types)
      • getMethodListString

        private static java.lang.String getMethodListString​(java.util.Set<MethodInfo> mlist)
      • fromMethodCallUsingTypes

        private static Signature fromMethodCallUsingTypes​(Type type,
                                                          java.lang.String ident,
                                                          java.util.List<Type> types,
                                                          boolean isStaticCall)
      • fromMethodCall

        private static Signature fromMethodCall​(Type type,
                                                java.lang.String ident,
                                                java.util.List<Expression> exprs,
                                                boolean isStaticCall)
      • fromCall

        public static Signature fromCall​(Type type,
                                         java.lang.String ident,
                                         java.util.List<Expression> exprs)
      • fromCallUsingTypes

        public static Signature fromCallUsingTypes​(Type type,
                                                   java.lang.String ident,
                                                   java.util.List<Type> types)
      • fromStaticCall

        public static Signature fromStaticCall​(Type type,
                                               java.lang.String ident,
                                               java.util.List<Expression> exprs)
      • fromStaticCallUsingTypes

        public static Signature fromStaticCallUsingTypes​(Type type,
                                                         java.lang.String ident,
                                                         java.util.List<Type> types)
      • fromConstructorUsingTypes

        public static Signature fromConstructorUsingTypes​(Type type,
                                                          java.util.List<Type> types)