src/jdk/internal/dynalink/linker/GuardedInvocation.java

changeset 962
ac62e33a99b0
parent 101
f8221ce53c2e
child 963
e2497b11a021
     1.1 --- a/src/jdk/internal/dynalink/linker/GuardedInvocation.java	Tue Aug 19 20:43:03 2014 +0100
     1.2 +++ b/src/jdk/internal/dynalink/linker/GuardedInvocation.java	Wed Aug 20 10:25:28 2014 +0200
     1.3 @@ -115,7 +115,7 @@
     1.4       * an unconditional invocation, although that is unusual.
     1.5       * @throws NullPointerException if invocation is null.
     1.6       */
     1.7 -    public GuardedInvocation(MethodHandle invocation, MethodHandle guard) {
     1.8 +    public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard) {
     1.9          this(invocation, guard, null);
    1.10      }
    1.11  
    1.12 @@ -129,7 +129,7 @@
    1.13       * @param switchPoint the optional switch point that can be used to invalidate this linkage.
    1.14       * @throws NullPointerException if invocation is null.
    1.15       */
    1.16 -    public GuardedInvocation(MethodHandle invocation, MethodHandle guard, SwitchPoint switchPoint) {
    1.17 +    public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard, final SwitchPoint switchPoint) {
    1.18          invocation.getClass(); // NPE check
    1.19          this.invocation = invocation;
    1.20          this.guard = guard;
    1.21 @@ -146,7 +146,7 @@
    1.22       * and the switch point are null, this represents an unconditional invocation, which is legal but unusual.
    1.23       * @throws NullPointerException if invocation is null.
    1.24       */
    1.25 -    public GuardedInvocation(MethodHandle invocation, SwitchPoint switchPoint, MethodHandle guard) {
    1.26 +    public GuardedInvocation(final MethodHandle invocation, final SwitchPoint switchPoint, final MethodHandle guard) {
    1.27          this(invocation, guard, switchPoint);
    1.28      }
    1.29      /**
    1.30 @@ -191,7 +191,7 @@
    1.31       * @param type the asserted type
    1.32       * @throws WrongMethodTypeException if the invocation and the guard are not of the expected method type.
    1.33       */
    1.34 -    public void assertType(MethodType type) {
    1.35 +    public void assertType(final MethodType type) {
    1.36          assertType(invocation, type);
    1.37          if(guard != null) {
    1.38              assertType(guard, type.changeReturnType(Boolean.TYPE));
    1.39 @@ -205,11 +205,11 @@
    1.40       * @param newGuard the new guard
    1.41       * @return a new guarded invocation with the replaced methods and the same switch point as this invocation.
    1.42       */
    1.43 -    public GuardedInvocation replaceMethods(MethodHandle newInvocation, MethodHandle newGuard) {
    1.44 +    public GuardedInvocation replaceMethods(final MethodHandle newInvocation, final MethodHandle newGuard) {
    1.45          return new GuardedInvocation(newInvocation, newGuard, switchPoint);
    1.46      }
    1.47  
    1.48 -    private GuardedInvocation replaceMethodsOrThis(MethodHandle newInvocation, MethodHandle newGuard) {
    1.49 +    private GuardedInvocation replaceMethodsOrThis(final MethodHandle newInvocation, final MethodHandle newGuard) {
    1.50          if(newInvocation == invocation && newGuard == guard) {
    1.51              return this;
    1.52          }
    1.53 @@ -223,7 +223,7 @@
    1.54       * @param newType the new type of the invocation.
    1.55       * @return a guarded invocation with the new type applied to it.
    1.56       */
    1.57 -    public GuardedInvocation asType(MethodType newType) {
    1.58 +    public GuardedInvocation asType(final MethodType newType) {
    1.59          return replaceMethodsOrThis(invocation.asType(newType), guard == null ? null : Guards.asType(guard, newType));
    1.60      }
    1.61  
    1.62 @@ -235,7 +235,7 @@
    1.63       * @param newType the new type of the invocation.
    1.64       * @return a guarded invocation with the new type applied to it.
    1.65       */
    1.66 -    public GuardedInvocation asType(LinkerServices linkerServices, MethodType newType) {
    1.67 +    public GuardedInvocation asType(final LinkerServices linkerServices, final MethodType newType) {
    1.68          return replaceMethodsOrThis(linkerServices.asType(invocation, newType), guard == null ? null :
    1.69              Guards.asType(linkerServices, guard, newType));
    1.70      }
    1.71 @@ -247,7 +247,7 @@
    1.72       * @param desc a call descriptor whose method type is adapted.
    1.73       * @return a guarded invocation with the new type applied to it.
    1.74       */
    1.75 -    public GuardedInvocation asType(CallSiteDescriptor desc) {
    1.76 +    public GuardedInvocation asType(final CallSiteDescriptor desc) {
    1.77          return asType(desc.getMethodType());
    1.78      }
    1.79  
    1.80 @@ -257,7 +257,7 @@
    1.81       * @param filters the argument filters
    1.82       * @return a filtered invocation
    1.83       */
    1.84 -    public GuardedInvocation filterArguments(int pos, MethodHandle... filters) {
    1.85 +    public GuardedInvocation filterArguments(final int pos, final MethodHandle... filters) {
    1.86          return replaceMethods(MethodHandles.filterArguments(invocation, pos, filters), guard == null ? null :
    1.87              MethodHandles.filterArguments(guard, pos, filters));
    1.88      }
    1.89 @@ -268,7 +268,7 @@
    1.90       * @param valueTypes the types of the values being dropped
    1.91       * @return an invocation that drops arguments
    1.92       */
    1.93 -    public GuardedInvocation dropArguments(int pos, List<Class<?>> valueTypes) {
    1.94 +    public GuardedInvocation dropArguments(final int pos, final List<Class<?>> valueTypes) {
    1.95          return replaceMethods(MethodHandles.dropArguments(invocation, pos, valueTypes), guard == null ? null :
    1.96              MethodHandles.dropArguments(guard, pos, valueTypes));
    1.97      }
    1.98 @@ -279,7 +279,7 @@
    1.99       * @param valueTypes the types of the values being dropped
   1.100       * @return an invocation that drops arguments
   1.101       */
   1.102 -    public GuardedInvocation dropArguments(int pos, Class<?>... valueTypes) {
   1.103 +    public GuardedInvocation dropArguments(final int pos, final Class<?>... valueTypes) {
   1.104          return replaceMethods(MethodHandles.dropArguments(invocation, pos, valueTypes), guard == null ? null :
   1.105              MethodHandles.dropArguments(guard, pos, valueTypes));
   1.106      }
   1.107 @@ -290,7 +290,7 @@
   1.108       * @param fallback the fallback method handle in case switchpoint is invalidated or guard returns false.
   1.109       * @return a composite method handle.
   1.110       */
   1.111 -    public MethodHandle compose(MethodHandle fallback) {
   1.112 +    public MethodHandle compose(final MethodHandle fallback) {
   1.113          return compose(fallback, fallback);
   1.114      }
   1.115  
   1.116 @@ -300,13 +300,13 @@
   1.117       * @param guardFallback the fallback method handle in case guard returns false.
   1.118       * @return a composite method handle.
   1.119       */
   1.120 -    public MethodHandle compose(MethodHandle switchpointFallback, MethodHandle guardFallback) {
   1.121 +    public MethodHandle compose(final MethodHandle switchpointFallback, final MethodHandle guardFallback) {
   1.122          final MethodHandle guarded =
   1.123                  guard == null ? invocation : MethodHandles.guardWithTest(guard, invocation, guardFallback);
   1.124          return switchPoint == null ? guarded : switchPoint.guardWithTest(guarded, switchpointFallback);
   1.125      }
   1.126  
   1.127 -    private static void assertType(MethodHandle mh, MethodType type) {
   1.128 +    private static void assertType(final MethodHandle mh, final MethodType type) {
   1.129          if(!mh.type().equals(type)) {
   1.130              throw new WrongMethodTypeException("Expected type: " + type + " actual type: " + mh.type());
   1.131          }

mercurial