@@ -2476,21 +2476,23 @@ && checkAnnotations(element, CHECK_J2S_IGNORE_AND_ANNOTATIONS)) {
24762476// }
24772477// }
24782478
2479+ /**
2480+ * for at_interfaces, build the
2481+ * @param node
2482+ */
24792483 private void processAnnotationTypeMemberDeclaration (AnnotationTypeMemberDeclaration node ) {
24802484
24812485 Expression def = node .getDefault ();
24822486 SimpleName name = node .getName ();
24832487 IMethodBinding mbinding = node .resolveBinding ();
24842488 ITypeBinding ret = mbinding .getReturnType ();
2485- // buffer.append("\nClazz.newMeth(C$,'").append(name).append("',function(){});\n");
24862489 int pt = buffer .length ();
2487- // retName = j2sClassObject(ret, retName);
2488- // if (ret.isPrimitive()) {
2489- // retName = NameMapper.getPrimitiveTYPE(retName) + ".TYPE";
2490- // } else {
2491- // retName += ".class";
2492- // }
2493- buffer .append ("a.push(['" + name + "'," + j2sClassObject (ret ) + "," );
2490+ // note that annotations cannot be generic
2491+ boolean isArray = ret .isArray ();
2492+ if (isArray )
2493+ ret = ret .getComponentType ();
2494+ String retName = (ret .isPrimitive () ? ret .getName () : j2sNonPrimitiveName (ret , true ));
2495+ buffer .append ("a.push(['" + name + "','" + retName + (isArray ? "[]" : "" ) + "'," );
24942496 if (def == null ) {
24952497 if (ret .isPrimitive ()) {
24962498 switch (ret .getName ()) {
@@ -5465,17 +5467,17 @@ private String j2sGetParamCode(ITypeBinding binding, boolean addAAA, boolean asG
54655467 return (asGenericObject ? "O" : "T" + binding .getName ());
54665468 }
54675469 String name = removeBrackets (getJavaClassNameQualified (binding ));
5468- if (binding . isArray () && binding . getComponentType (). isTypeVariable ( )) {
5470+ if (isTypeOrArrayType ( binding )) {
54695471 // TK[]
54705472 if (asGenericObject ) {
5471- name = "O" + name .substring (name .indexOf ("[" ));
5473+ int pt = name .indexOf ("[" );
5474+ name = "O" + (pt < 0 ? "" : name .substring (pt ));
54725475 } else {
54735476 name = "T" + name ;
54745477 }
54755478 } else if (!asGenericObject && !binding .isPrimitive ()) {
54765479 name = NameMapper .fixPackageName (name );
5477- }
5478-
5480+ }
54795481 String arrays = null ;
54805482 int pt = name .indexOf ("[" );
54815483 if (pt >= 0 ) {
@@ -6721,19 +6723,15 @@ public static void addClassAnnotations(Java2ScriptVisitor visitor, int accessTyp
67216723 String className = (type == null ? null
67226724 : type .isTypeVariable () ? type .toString () // could be "<T>"
67236725 : j2sNonPrimitiveName (type , false ));
6724- //stripJavaLang(NameMapper.fixPackageName(getJavaClassNameQualified(type))
6725- //String typeref = (type == null ? null : j2sClassObject(type));
67266726 if (className != null && className .equals (lastClassName )) {
67276727 className = "." ;
6728- //typeref = "'.'";
67296728 } else {
67306729 lastClassName = className ;
67316730 }
67326731 trailingBuffer .append (nn ++ == 0 ? "C$.$getAnn$ = function(){ return [\n [[" : "]],\n [[" );
67336732 trailingBuffer .append ((varName == null ? null : "'" + varName + "'" ));
67346733 ptBuf = trailingBuffer .buf .length ();
67356734 trailingBuffer .append (",'" + className + "',"
6736- //+ typeref + ","
67376735 + signature + ",['" + a .qname
67386736 + "']],[" );
67396737 ptBuf1 = trailingBuffer .buf .length () - 5 ;
@@ -7079,16 +7077,6 @@ public static void dumpStack(String msg) {
70797077 }
70807078 }
70817079
7082- public static String j2sClassObject (ITypeBinding type ) {
7083- boolean isArray = type .isArray () && !type .isTypeVariable ();
7084- if (isArray )
7085- type = type .getComponentType ();
7086- String name = (type .isPrimitive () ? type .getName () : j2sNonPrimitiveName (type , true ));
7087- return "'" + (isArray ? name + "[]" : name ) + "'" ;
7088- }
7089-
7090- // private static Map<ITypeBinding, String> nonPrimitiveJ2STypeNames = new Hashtable<>();
7091-
70927080 static String j2sNonPrimitiveName (ITypeBinding type , boolean typeAsObject ) {
70937081 if (type .isTypeVariable ()) {
70947082 String n = type .toString ();
0 commit comments