Class MethodTypeResolution


  • public final class MethodTypeResolution
    extends java.lang.Object
    • Method Detail

      • checkSubtypeability

        public static boolean checkSubtypeability​(MethodType method,
                                                  MethodType subtypeableMethod)
      • selectMethodsFirstPhase

        public static java.util.List<MethodType> selectMethodsFirstPhase​(JavaTypeDefinition context,
                                                                         java.util.List<MethodType> methodsToSearch,
                                                                         ASTArgumentList argList)
        Look for methods be subtypeability. https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.2
      • produceInitialConstraints

        public static java.util.List<Constraint> produceInitialConstraints​(java.lang.reflect.Method method,
                                                                           ASTArgumentList argList,
                                                                           java.util.List<Variable> variables)
      • produceInitialBounds

        public static void produceInitialBounds​(java.lang.reflect.Method method,
                                                JavaTypeDefinition context,
                                                java.util.List<Variable> variables,
                                                java.util.List<Bound> initialBounds)
      • selectMethodsSecondPhase

        public static java.util.List<MethodType> selectMethodsSecondPhase​(java.util.List<MethodType> methodsToSearch,
                                                                          ASTArgumentList argList)
        Look for methods be method conversion. https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.3
      • selectMethodsThirdPhase

        public static java.util.List<MethodType> selectMethodsThirdPhase​(java.util.List<MethodType> methodsToSearch,
                                                                         ASTArgumentList argList)
        Look for methods considering varargs as well. https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.4
      • getBestMethodReturnType

        public static JavaTypeDefinition getBestMethodReturnType​(JavaTypeDefinition context,
                                                                 java.util.List<MethodType> methods,
                                                                 ASTArgumentList arguments)
        Searches a list of methods by trying the three phases of method overload resolution. https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2
      • selectMostSpecificMethod

        public static MethodType selectMostSpecificMethod​(java.util.List<MethodType> selectedMethods)
        Most specific method selection. https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.5
      • selectAmongMaximallySpecific

        public static MethodType selectAmongMaximallySpecific​(MethodType first,
                                                              MethodType second)
        Select maximally specific method. https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.5
      • getApplicableMethods

        public static java.util.List<MethodType> getApplicableMethods​(JavaTypeDefinition context,
                                                                      java.lang.String methodName,
                                                                      java.util.List<JavaTypeDefinition> typeArguments,
                                                                      int argArity,
                                                                      java.lang.Class<?> accessingClass)
        Looks for potentially applicable methods in a given type definition.
      • isMethodApplicable

        public static boolean isMethodApplicable​(java.lang.reflect.Method method,
                                                 java.lang.String methodName,
                                                 int argArity,
                                                 java.lang.Class<?> accessingClass,
                                                 java.util.List<JavaTypeDefinition> typeArguments)
        https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12.2.1 Potential applicability.
      • isMemberVisibleFromClass

        public static boolean isMemberVisibleFromClass​(java.lang.Class<?> classWithMember,
                                                       int modifiers,
                                                       java.lang.Class<?> accessingClass)
        Given a class, the modifiers of on of it's member and the class that is trying to access that member, returns true is the member is accessible from the accessingClass Class.
        Parameters:
        classWithMember - The Class with the member.
        modifiers - The modifiers of that member.
        accessingClass - The Class trying to access the member.
        Returns:
        True if the member is visible from the accessingClass Class.
      • isGeneric

        public static boolean isGeneric​(java.lang.reflect.Method method)
      • isGeneric

        public static boolean isGeneric​(java.lang.Class<?> clazz)
      • getArity

        public static int getArity​(java.lang.reflect.Method method)
      • isMethodConvertible

        public static boolean isMethodConvertible​(JavaTypeDefinition parameter,
                                                  JavaTypeDefinition argument)
        Method invocation conversion rules. https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.3
      • isSubtypeable

        public static boolean isSubtypeable​(java.lang.Class<?> parameter,
                                            java.lang.Class<?> argument)
      • isSubtypeable

        public static boolean isSubtypeable​(JavaTypeDefinition parameter,
                                            JavaTypeDefinition argument)
        Subtypeability rules. https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.10
      • getMethodExplicitTypeArugments

        public static java.util.List<JavaTypeDefinition> getMethodExplicitTypeArugments​(net.sourceforge.pmd.lang.ast.Node node)