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

changeset 962
ac62e33a99b0
parent 830
3cb09c560108
child 963
e2497b11a021
     1.1 --- a/src/jdk/internal/dynalink/beans/BeanLinker.java	Tue Aug 19 20:43:03 2014 +0100
     1.2 +++ b/src/jdk/internal/dynalink/beans/BeanLinker.java	Wed Aug 20 10:25:28 2014 +0200
     1.3 @@ -106,7 +106,7 @@
     1.4   * @author Attila Szegedi
     1.5   */
     1.6  class BeanLinker extends AbstractJavaLinker implements TypeBasedGuardingDynamicLinker {
     1.7 -    BeanLinker(Class<?> clazz) {
     1.8 +    BeanLinker(final Class<?> clazz) {
     1.9          super(clazz, Guards.getClassGuard(clazz), Guards.getInstanceOfGuard(clazz));
    1.10          if(clazz.isArray()) {
    1.11              // Some languages won't have a notion of manipulating collections. Exposing "length" on arrays as an
    1.12 @@ -119,7 +119,7 @@
    1.13      }
    1.14  
    1.15      @Override
    1.16 -    public boolean canLinkType(Class<?> type) {
    1.17 +    public boolean canLinkType(final Class<?> type) {
    1.18          return type == clazz;
    1.19      }
    1.20  
    1.21 @@ -129,8 +129,8 @@
    1.22      }
    1.23  
    1.24      @Override
    1.25 -    protected GuardedInvocationComponent getGuardedInvocationComponent(CallSiteDescriptor callSiteDescriptor,
    1.26 -            LinkerServices linkerServices, List<String> operations) throws Exception {
    1.27 +    protected GuardedInvocationComponent getGuardedInvocationComponent(final CallSiteDescriptor callSiteDescriptor,
    1.28 +            final LinkerServices linkerServices, final List<String> operations) throws Exception {
    1.29          final GuardedInvocationComponent superGic = super.getGuardedInvocationComponent(callSiteDescriptor,
    1.30                  linkerServices, operations);
    1.31          if(superGic != null) {
    1.32 @@ -166,7 +166,7 @@
    1.33      private static MethodHandle MAP_GUARD = Guards.getInstanceOfGuard(Map.class);
    1.34  
    1.35      private GuardedInvocationComponent getElementGetter(final CallSiteDescriptor callSiteDescriptor,
    1.36 -            final LinkerServices linkerServices, List<String> operations) throws Exception {
    1.37 +            final LinkerServices linkerServices, final List<String> operations) throws Exception {
    1.38          final MethodType callSiteType = callSiteDescriptor.getMethodType();
    1.39          final Class<?> declaredType = callSiteType.parameterType(0);
    1.40          final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
    1.41 @@ -247,7 +247,7 @@
    1.42                  CallSiteDescriptor.NAME_OPERAND);
    1.43      }
    1.44  
    1.45 -    private static Object convertKeyToInteger(String fixedKey, LinkerServices linkerServices) throws Exception {
    1.46 +    private static Object convertKeyToInteger(final String fixedKey, final LinkerServices linkerServices) throws Exception {
    1.47          try {
    1.48              if(linkerServices.canConvert(String.class, Number.class)) {
    1.49                  try {
    1.50 @@ -267,18 +267,18 @@
    1.51                      return Integer.valueOf(intIndex);
    1.52                  } catch(Exception|Error e) {
    1.53                      throw e;
    1.54 -                } catch(Throwable t) {
    1.55 +                } catch(final Throwable t) {
    1.56                      throw new RuntimeException(t);
    1.57                  }
    1.58              }
    1.59              return Integer.valueOf(fixedKey);
    1.60 -        } catch(NumberFormatException e) {
    1.61 +        } catch(final NumberFormatException e) {
    1.62              // key is not a number
    1.63              return null;
    1.64          }
    1.65      }
    1.66  
    1.67 -    private static MethodHandle convertArgToInt(MethodHandle mh, LinkerServices ls, CallSiteDescriptor desc) {
    1.68 +    private static MethodHandle convertArgToInt(final MethodHandle mh, final LinkerServices ls, final CallSiteDescriptor desc) {
    1.69          final Class<?> sourceType = desc.getMethodType().parameterType(1);
    1.70          if(TypeUtilities.isMethodInvocationConvertible(sourceType, Number.class)) {
    1.71              return mh;
    1.72 @@ -301,21 +301,21 @@
    1.73          private final MethodType methodType;
    1.74          private final Object fixedKey;
    1.75  
    1.76 -        Binder(LinkerServices linkerServices, MethodType methodType, Object fixedKey) {
    1.77 +        Binder(final LinkerServices linkerServices, final MethodType methodType, final Object fixedKey) {
    1.78              this.linkerServices = linkerServices;
    1.79              this.methodType = fixedKey == null ? methodType : methodType.insertParameterTypes(1, fixedKey.getClass());
    1.80              this.fixedKey = fixedKey;
    1.81          }
    1.82  
    1.83 -        /*private*/ MethodHandle bind(MethodHandle handle) {
    1.84 +        /*private*/ MethodHandle bind(final MethodHandle handle) {
    1.85              return bindToFixedKey(linkerServices.asType(handle, methodType));
    1.86          }
    1.87  
    1.88 -        /*private*/ MethodHandle bindTest(MethodHandle handle) {
    1.89 +        /*private*/ MethodHandle bindTest(final MethodHandle handle) {
    1.90              return bindToFixedKey(Guards.asType(handle, methodType));
    1.91          }
    1.92  
    1.93 -        private MethodHandle bindToFixedKey(MethodHandle handle) {
    1.94 +        private MethodHandle bindToFixedKey(final MethodHandle handle) {
    1.95              return fixedKey == null ? handle : MethodHandles.insertArguments(handle, 1, fixedKey);
    1.96          }
    1.97      }
    1.98 @@ -325,12 +325,12 @@
    1.99      private static MethodHandle CONTAINS_MAP = Lookup.PUBLIC.findVirtual(Map.class, "containsKey",
   1.100              MethodType.methodType(boolean.class, Object.class));
   1.101  
   1.102 -    private static MethodHandle findRangeCheck(Class<?> collectionType) {
   1.103 +    private static MethodHandle findRangeCheck(final Class<?> collectionType) {
   1.104          return Lookup.findOwnStatic(MethodHandles.lookup(), "rangeCheck", boolean.class, collectionType, Object.class);
   1.105      }
   1.106  
   1.107      @SuppressWarnings("unused")
   1.108 -    private static final boolean rangeCheck(Object array, Object index) {
   1.109 +    private static final boolean rangeCheck(final Object array, final Object index) {
   1.110          if(!(index instanceof Number)) {
   1.111              return false;
   1.112          }
   1.113 @@ -347,7 +347,7 @@
   1.114      }
   1.115  
   1.116      @SuppressWarnings("unused")
   1.117 -    private static final boolean rangeCheck(List<?> list, Object index) {
   1.118 +    private static final boolean rangeCheck(final List<?> list, final Object index) {
   1.119          if(!(index instanceof Number)) {
   1.120              return false;
   1.121          }
   1.122 @@ -369,8 +369,8 @@
   1.123      private static MethodHandle PUT_MAP_ELEMENT = Lookup.PUBLIC.findVirtual(Map.class, "put",
   1.124              MethodType.methodType(Object.class, Object.class, Object.class));
   1.125  
   1.126 -    private GuardedInvocationComponent getElementSetter(CallSiteDescriptor callSiteDescriptor,
   1.127 -            LinkerServices linkerServices, List<String> operations) throws Exception {
   1.128 +    private GuardedInvocationComponent getElementSetter(final CallSiteDescriptor callSiteDescriptor,
   1.129 +            final LinkerServices linkerServices, final List<String> operations) throws Exception {
   1.130          final MethodType callSiteType = callSiteDescriptor.getMethodType();
   1.131          final Class<?> declaredType = callSiteType.parameterType(0);
   1.132  
   1.133 @@ -456,7 +456,7 @@
   1.134  
   1.135      private static MethodHandle COLLECTION_GUARD = Guards.getInstanceOfGuard(Collection.class);
   1.136  
   1.137 -    private GuardedInvocationComponent getLengthGetter(CallSiteDescriptor callSiteDescriptor) {
   1.138 +    private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
   1.139          assertParameterCount(callSiteDescriptor, 1);
   1.140          final MethodType callSiteType = callSiteDescriptor.getMethodType();
   1.141          final Class<?> declaredType = callSiteType.parameterType(0);
   1.142 @@ -486,7 +486,7 @@
   1.143          return null;
   1.144      }
   1.145  
   1.146 -    private static void assertParameterCount(CallSiteDescriptor descriptor, int paramCount) {
   1.147 +    private static void assertParameterCount(final CallSiteDescriptor descriptor, final int paramCount) {
   1.148          if(descriptor.getMethodType().parameterCount() != paramCount) {
   1.149              throw new BootstrapMethodError(descriptor.getName() + " must have exactly " + paramCount + " parameters.");
   1.150          }

mercurial