135135
136136// TODO: superclass inheritance for JAXB XmlAccessorType
137137
138+ //BH 2020.06.22 -- 3.2.9.v1k fix for varargs not proper qualified arrays
138139//BH 2020.06.17 -- 3.2.9-v1j fix for functional interface this::privateMethod
139140//BH 2020.05.01 -- 3.2.9-v1i fix for nested lambda methods
140141//BH 2020.04.26 -- 3.2.9-v1h fix for inner classes of interfaces duplicated; fix for api.js inner class method names unqualified
@@ -2515,25 +2516,12 @@ && checkAnnotations(element, CHECK_J2S_IGNORE_AND_ANNOTATIONS)) {
25152516 // log("default method " + method.getKey());
25162517 defpt = buffer .length ();
25172518 }
2518- // boolean addUnqualifiedCurrent = temp_add$UnqualifiedMethod;
2519- // if (unqualifiedMethods != null) {
2520- // // check for all methods that override a functional interface abstract method,
2521- // // as those methods are to be qualified only with $
2522- //
2523- // for (int i = unqualifiedMethods.size(); --i >= 0;) {
2524- // if (method.overrides(unqualifiedMethods.get(i))) {
2525- // temp_add$UnqualifiedMethod = true;
2526- // break;
2527- // }
2528- // }
2529- // }
25302519 processMethodDeclaration (mnode , method , mnode .parameters (), mnode .getBody (), mnode .isConstructor (),
25312520 abstractMethodList , NOT_LAMBDA );
25322521 if (defpt >= 0 ) {
25332522 defaults .append (buffer .substring (defpt ));
25342523 buffer .setLength (defpt );
25352524 }
2536- // temp_add$UnqualifiedMethod = addUnqualifiedCurrent;
25372525 } else if (element instanceof AnnotationTypeMemberDeclaration ) {
25382526 processAnnotationTypeMemberDeclaration ((AnnotationTypeMemberDeclaration ) element );
25392527 }
@@ -2689,35 +2677,6 @@ private void processAnnotationTypeMemberDeclaration(AnnotationTypeMemberDeclarat
26892677 buffer .setLength (pt );
26902678 }
26912679
2692- // /**
2693- // * Collect all names of all functional interface abstract methods that this
2694- // * class might refer to so that their unqualified. This is not perfect, as it is
2695- // * possible to have implementations of specific subtypes of parameterized
2696- // * methods. However, it will have to do for now.
2697- // *
2698- // * @param type
2699- // * @param unqualifiedMethods
2700- // * @return List of methods that should have raw unparameterized alias
2701- // */
2702- // private List<IMethodBinding> getUnqualifiedMethods(ITypeBinding type, List<IMethodBinding> unqualifiedMethods) {
2703- // if (type.isArray() || type.isPrimitive()) {
2704- // return unqualifiedMethods;
2705- // }
2706- // ITypeBinding superClass = type.getSuperclass();
2707- // if (superClass != null)
2708- // unqualifiedMethods = getUnqualifiedMethods(superClass, unqualifiedMethods);
2709- // ITypeBinding[] superInterfaces = type.getInterfaces();
2710- // for (int i = 0; i < superInterfaces.length; i++)
2711- // unqualifiedMethods = getUnqualifiedMethods(superInterfaces[i], unqualifiedMethods);
2712- // IMethodBinding functionalMethod = type.getFunctionalInterfaceMethod();
2713- // if (functionalMethod != null) {
2714- // if (unqualifiedMethods == null)
2715- // unqualifiedMethods = new ArrayList<IMethodBinding>();
2716- // unqualifiedMethods.add(functionalMethod);
2717- // }
2718- // return unqualifiedMethods;
2719- // }
2720-
27212680 /**
27222681 * If there is no Foo() or Foo(xxx... array), then we need to provide our own
27232682 * constructor.
@@ -2906,7 +2865,7 @@ private void addMethodParameterList(List<?> arguments, IMethodBinding methodDecl
29062865 buffer .append (prefix );
29072866 prefix = null ;
29082867 }
2909- addMethodArguments (parameterTypes , methodIsVarArgs , arguments , flags );
2868+ addMethodArguments (methodDeclaration , parameterTypes , methodIsVarArgs , arguments , flags );
29102869 }
29112870 if (prefix == null && suffix != null )
29122871 buffer .append (suffix );
@@ -4388,13 +4347,14 @@ private void addLeftSidePrefixName(Expression left) {
43884347
43894348 /**
43904349 *
4350+ * @param methodDeclaration
43914351 * @param parameterTypes
43924352 * @param methodIsVarArgs
43934353 * @param arguments
43944354 * @param flags METHOD_INDEXOF | 0
43954355 */
43964356 @ SuppressWarnings ("null" )
4397- private void addMethodArguments (ITypeBinding [] parameterTypes , boolean methodIsVarArgs , List <?> arguments ,
4357+ private void addMethodArguments (IMethodBinding methodDeclaration , ITypeBinding [] parameterTypes , boolean methodIsVarArgs , List <?> arguments ,
43984358 int flags ) {
43994359 String post = ", " ;
44004360 int nparam = parameterTypes .length ;
@@ -4422,8 +4382,18 @@ private void addMethodArguments(ITypeBinding[] parameterTypes, boolean methodIsV
44224382 .isAssignmentCompatible (paramType .getComponentType ().getErasure ()))
44234383 // or it is not compatible
44244384 ) {
4425- buffer .append (clazzArray (paramType .getComponentType (), ARRAY_DIM_ONLY ));
4426- buffer .append (", -1, [" );
4385+ String close ;
4386+ if (NameMapper .isPackageOrClassNonqualified (methodDeclaration .getDeclaringClass ().getQualifiedName ())) {
4387+ // calls to DOMNode.setAttrs(DOMNode node, Object... attr) need not be wrapped by a Java array type
4388+ close = "" ;
4389+ } else {
4390+ buffer .append (clazzArray (paramType .getComponentType (), ARRAY_DIM_ONLY ));
4391+ buffer .append (", -1, " );
4392+ close = ")" ;
4393+ }
4394+
4395+
4396+ buffer .append ("[" );
44274397//
44284398//
44294399// buffer Debug(paramType.getComponentType().getName() + " "
@@ -4441,7 +4411,7 @@ private void addMethodArguments(ITypeBinding[] parameterTypes, boolean methodIsV
44414411 buffer .append (", " );
44424412 }
44434413 }
4444- buffer .append ("])" );
4414+ buffer .append ("]" ). append ( close );
44454415 break ;
44464416 }
44474417 post = "" ;
@@ -6660,7 +6630,7 @@ public static void setNonQualifiedNamePackages(String names) {
66606630 * @param className
66616631 * @return
66626632 */
6663- private static boolean isPackageOrClassNonqualified (String className ) {
6633+ static boolean isPackageOrClassNonqualified (String className ) {
66646634 if (className .indexOf ("$" ) >= 0 )
66656635 return false ; // inner class
66666636 className += "." ;
@@ -6673,9 +6643,6 @@ private static boolean isPackageOrClassNonqualified(String className) {
66736643 return false ;
66746644 }
66756645
6676- /**
6677- * @param methodName not used but could be
6678- */
66796646 static boolean isMethodNonqualified (String className , String methodName ) {
66806647 if (className .equals ("java.lang.Math" )) {
66816648 switch (methodName ) {
0 commit comments