1.1 --- a/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java Tue Feb 26 22:57:51 2013 +0530 1.2 +++ b/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java Wed Feb 27 15:20:26 2013 +0100 1.3 @@ -83,7 +83,6 @@ 1.4 1.5 package jdk.internal.dynalink.beans; 1.6 1.7 -import java.beans.Introspector; 1.8 import java.lang.invoke.MethodHandle; 1.9 import java.lang.invoke.MethodHandles; 1.10 import java.lang.invoke.MethodType; 1.11 @@ -136,16 +135,16 @@ 1.12 // Add the method as a property getter and/or setter 1.13 if(name.startsWith("get") && name.length() > 3 && method.getParameterTypes().length == 0) { 1.14 // Property getter 1.15 - setPropertyGetter(Introspector.decapitalize(name.substring(3)), introspector.unreflect( 1.16 + setPropertyGetter(decapitalize(name.substring(3)), introspector.unreflect( 1.17 getMostGenericGetter(method)), ValidationType.INSTANCE_OF); 1.18 } else if(name.startsWith("is") && name.length() > 2 && method.getParameterTypes().length == 0 && 1.19 method.getReturnType() == boolean.class) { 1.20 // Boolean property getter 1.21 - setPropertyGetter(Introspector.decapitalize(name.substring(2)), introspector.unreflect( 1.22 + setPropertyGetter(decapitalize(name.substring(2)), introspector.unreflect( 1.23 getMostGenericGetter(method)), ValidationType.INSTANCE_OF); 1.24 } else if(name.startsWith("set") && name.length() > 3 && method.getParameterTypes().length == 1) { 1.25 // Property setter 1.26 - addMember(Introspector.decapitalize(name.substring(3)), methodHandle, propertySetters); 1.27 + addMember(decapitalize(name.substring(3)), methodHandle, propertySetters); 1.28 } 1.29 } 1.30 1.31 @@ -170,6 +169,27 @@ 1.32 } 1.33 } 1.34 1.35 + private static String decapitalize(String str) { 1.36 + assert str != null; 1.37 + if(str.isEmpty()) { 1.38 + return str; 1.39 + } 1.40 + 1.41 + final char c0 = str.charAt(0); 1.42 + if(Character.isLowerCase(c0)) { 1.43 + return str; 1.44 + } 1.45 + 1.46 + // If it has two consecutive upper-case characters, i.e. "URL", don't decapitalize 1.47 + if(str.length() > 1 && Character.isUpperCase(str.charAt(1))) { 1.48 + return str; 1.49 + } 1.50 + 1.51 + final char c[] = str.toCharArray(); 1.52 + c[0] = Character.toLowerCase(c0); 1.53 + return new String(c); 1.54 + } 1.55 + 1.56 abstract FacetIntrospector createFacetIntrospector(); 1.57 1.58 void setPropertyGetter(String name, MethodHandle handle, ValidationType validationType) {