equal
deleted
inserted
replaced
449 .replace('/', '.') |
449 .replace('/', '.') |
450 .replace('.', target.syntheticNameChar())); |
450 .replace('.', target.syntheticNameChar())); |
451 ClassSymbol outerCacheClass = outerCacheClass(); |
451 ClassSymbol outerCacheClass = outerCacheClass(); |
452 this.mapVar = new VarSymbol(STATIC | SYNTHETIC | FINAL, |
452 this.mapVar = new VarSymbol(STATIC | SYNTHETIC | FINAL, |
453 varName, |
453 varName, |
454 new ArrayType(syms.intType, syms.arrayClass, |
454 new ArrayType(syms.intType, syms.arrayClass), |
455 Type.noAnnotations), |
|
456 outerCacheClass); |
455 outerCacheClass); |
457 enterSynthetic(pos, mapVar, outerCacheClass.members()); |
456 enterSynthetic(pos, mapVar, outerCacheClass.members()); |
458 } |
457 } |
459 |
458 |
460 DiagnosticPosition pos = null; |
459 DiagnosticPosition pos = null; |
491 JCExpression size = make // Color.values().length |
490 JCExpression size = make // Color.values().length |
492 .Select(make.App(make.QualIdent(valuesMethod)), |
491 .Select(make.App(make.QualIdent(valuesMethod)), |
493 syms.lengthVar); |
492 syms.lengthVar); |
494 JCExpression mapVarInit = make |
493 JCExpression mapVarInit = make |
495 .NewArray(make.Type(syms.intType), List.of(size), null) |
494 .NewArray(make.Type(syms.intType), List.of(size), null) |
496 .setType(new ArrayType(syms.intType, syms.arrayClass, |
495 .setType(new ArrayType(syms.intType, syms.arrayClass)); |
497 Type.noAnnotations)); |
|
498 |
496 |
499 // try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {} |
497 // try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {} |
500 ListBuffer<JCStatement> stmts = new ListBuffer<>(); |
498 ListBuffer<JCStatement> stmts = new ListBuffer<>(); |
501 Symbol ordinalMethod = lookupMethod(pos, |
499 Symbol ordinalMethod = lookupMethod(pos, |
502 names.ordinal, |
500 names.ordinal, |
1964 // newcache := "new cache$1[0]" |
1962 // newcache := "new cache$1[0]" |
1965 JCNewArray newcache = make.NewArray(make.Type(outerCacheClass.type), |
1963 JCNewArray newcache = make.NewArray(make.Type(outerCacheClass.type), |
1966 List.<JCExpression>of(make.Literal(INT, 0).setType(syms.intType)), |
1964 List.<JCExpression>of(make.Literal(INT, 0).setType(syms.intType)), |
1967 null); |
1965 null); |
1968 newcache.type = new ArrayType(types.erasure(outerCacheClass.type), |
1966 newcache.type = new ArrayType(types.erasure(outerCacheClass.type), |
1969 syms.arrayClass, Type.noAnnotations); |
1967 syms.arrayClass); |
1970 |
1968 |
1971 // forNameSym := java.lang.Class.forName( |
1969 // forNameSym := java.lang.Class.forName( |
1972 // String s,boolean init,ClassLoader loader) |
1970 // String s,boolean init,ClassLoader loader) |
1973 Symbol forNameSym = lookupMethod(make_pos, names.forName, |
1971 Symbol forNameSym = lookupMethod(make_pos, names.forName, |
1974 types.erasure(syms.classType), |
1972 types.erasure(syms.classType), |
2504 |
2502 |
2505 // private static final T[] #VALUES = { a, b, c }; |
2503 // private static final T[] #VALUES = { a, b, c }; |
2506 Name valuesName = names.fromString(target.syntheticNameChar() + "VALUES"); |
2504 Name valuesName = names.fromString(target.syntheticNameChar() + "VALUES"); |
2507 while (tree.sym.members().findFirst(valuesName) != null) // avoid name clash |
2505 while (tree.sym.members().findFirst(valuesName) != null) // avoid name clash |
2508 valuesName = names.fromString(valuesName + "" + target.syntheticNameChar()); |
2506 valuesName = names.fromString(valuesName + "" + target.syntheticNameChar()); |
2509 Type arrayType = new ArrayType(types.erasure(tree.type), |
2507 Type arrayType = new ArrayType(types.erasure(tree.type), syms.arrayClass); |
2510 syms.arrayClass, Type.noAnnotations); |
|
2511 VarSymbol valuesVar = new VarSymbol(PRIVATE|FINAL|STATIC|SYNTHETIC, |
2508 VarSymbol valuesVar = new VarSymbol(PRIVATE|FINAL|STATIC|SYNTHETIC, |
2512 valuesName, |
2509 valuesName, |
2513 arrayType, |
2510 arrayType, |
2514 tree.type.tsym); |
2511 tree.type.tsym); |
2515 JCNewArray newArray = make.NewArray(make.Type(types.erasure(tree.type)), |
2512 JCNewArray newArray = make.NewArray(make.Type(types.erasure(tree.type)), |
3075 args = args.tail; |
3072 args = args.tail; |
3076 } |
3073 } |
3077 JCNewArray boxedArgs = make.NewArray(make.Type(varargsElement), |
3074 JCNewArray boxedArgs = make.NewArray(make.Type(varargsElement), |
3078 List.<JCExpression>nil(), |
3075 List.<JCExpression>nil(), |
3079 elems.toList()); |
3076 elems.toList()); |
3080 boxedArgs.type = new ArrayType(varargsElement, syms.arrayClass, |
3077 boxedArgs.type = new ArrayType(varargsElement, syms.arrayClass); |
3081 Type.noAnnotations); |
|
3082 result.append(boxedArgs); |
3078 result.append(boxedArgs); |
3083 } else { |
3079 } else { |
3084 if (args.length() != 1) throw new AssertionError(args); |
3080 if (args.length() != 1) throw new AssertionError(args); |
3085 JCExpression arg = translate(args.head, parameter); |
3081 JCExpression arg = translate(args.head, parameter); |
3086 anyChanges |= (arg != args.head); |
3082 anyChanges |= (arg != args.head); |