src/jdk/internal/dynalink/beans/ApplicableOverloadedMethods.java

changeset 404
18d467e94150
parent 101
f8221ce53c2e
child 952
6d5471a497fb
child 962
ac62e33a99b0
     1.1 --- a/src/jdk/internal/dynalink/beans/ApplicableOverloadedMethods.java	Wed Jul 03 14:08:00 2013 +0530
     1.2 +++ b/src/jdk/internal/dynalink/beans/ApplicableOverloadedMethods.java	Wed Jul 03 12:39:28 2013 +0200
     1.3 @@ -83,7 +83,6 @@
     1.4  
     1.5  package jdk.internal.dynalink.beans;
     1.6  
     1.7 -import java.lang.invoke.MethodHandle;
     1.8  import java.lang.invoke.MethodType;
     1.9  import java.util.LinkedList;
    1.10  import java.util.List;
    1.11 @@ -95,7 +94,7 @@
    1.12   * @author Attila Szegedi
    1.13   */
    1.14  class ApplicableOverloadedMethods {
    1.15 -    private final List<MethodHandle> methods;
    1.16 +    private final List<SingleDynamicMethod> methods;
    1.17      private final boolean varArgs;
    1.18  
    1.19      /**
    1.20 @@ -106,10 +105,10 @@
    1.21       * @param test applicability test. One of {@link #APPLICABLE_BY_SUBTYPING},
    1.22       * {@link #APPLICABLE_BY_METHOD_INVOCATION_CONVERSION}, or {@link #APPLICABLE_BY_VARIABLE_ARITY}.
    1.23       */
    1.24 -    ApplicableOverloadedMethods(final List<MethodHandle> methods, final MethodType callSiteType,
    1.25 +    ApplicableOverloadedMethods(final List<SingleDynamicMethod> methods, final MethodType callSiteType,
    1.26              final ApplicabilityTest test) {
    1.27          this.methods = new LinkedList<>();
    1.28 -        for(MethodHandle m: methods) {
    1.29 +        for(SingleDynamicMethod m: methods) {
    1.30              if(test.isApplicable(callSiteType, m)) {
    1.31                  this.methods.add(m);
    1.32              }
    1.33 @@ -122,7 +121,7 @@
    1.34       *
    1.35       * @return list of all methods.
    1.36       */
    1.37 -    List<MethodHandle> getMethods() {
    1.38 +    List<SingleDynamicMethod> getMethods() {
    1.39          return methods;
    1.40      }
    1.41  
    1.42 @@ -131,12 +130,12 @@
    1.43       *
    1.44       * @return a list of maximally specific methods.
    1.45       */
    1.46 -    List<MethodHandle> findMaximallySpecificMethods() {
    1.47 +    List<SingleDynamicMethod> findMaximallySpecificMethods() {
    1.48          return MaximallySpecific.getMaximallySpecificMethods(methods, varArgs);
    1.49      }
    1.50  
    1.51      abstract static class ApplicabilityTest {
    1.52 -        abstract boolean isApplicable(MethodType callSiteType, MethodHandle method);
    1.53 +        abstract boolean isApplicable(MethodType callSiteType, SingleDynamicMethod method);
    1.54      }
    1.55  
    1.56      /**
    1.57 @@ -144,8 +143,8 @@
    1.58       */
    1.59      static final ApplicabilityTest APPLICABLE_BY_SUBTYPING = new ApplicabilityTest() {
    1.60          @Override
    1.61 -        boolean isApplicable(MethodType callSiteType, MethodHandle method) {
    1.62 -            final MethodType methodType = method.type();
    1.63 +        boolean isApplicable(MethodType callSiteType, SingleDynamicMethod method) {
    1.64 +            final MethodType methodType = method.getMethodType();
    1.65              final int methodArity = methodType.parameterCount();
    1.66              if(methodArity != callSiteType.parameterCount()) {
    1.67                  return false;
    1.68 @@ -166,8 +165,8 @@
    1.69       */
    1.70      static final ApplicabilityTest APPLICABLE_BY_METHOD_INVOCATION_CONVERSION = new ApplicabilityTest() {
    1.71          @Override
    1.72 -        boolean isApplicable(MethodType callSiteType, MethodHandle method) {
    1.73 -            final MethodType methodType = method.type();
    1.74 +        boolean isApplicable(MethodType callSiteType, SingleDynamicMethod method) {
    1.75 +            final MethodType methodType = method.getMethodType();
    1.76              final int methodArity = methodType.parameterCount();
    1.77              if(methodArity != callSiteType.parameterCount()) {
    1.78                  return false;
    1.79 @@ -189,11 +188,11 @@
    1.80       */
    1.81      static final ApplicabilityTest APPLICABLE_BY_VARIABLE_ARITY = new ApplicabilityTest() {
    1.82          @Override
    1.83 -        boolean isApplicable(MethodType callSiteType, MethodHandle method) {
    1.84 -            if(!method.isVarargsCollector()) {
    1.85 +        boolean isApplicable(MethodType callSiteType, SingleDynamicMethod method) {
    1.86 +            if(!method.isVarArgs()) {
    1.87                  return false;
    1.88              }
    1.89 -            final MethodType methodType = method.type();
    1.90 +            final MethodType methodType = method.getMethodType();
    1.91              final int methodArity = methodType.parameterCount();
    1.92              final int fixArity = methodArity - 1;
    1.93              final int callSiteArity = callSiteType.parameterCount();

mercurial