/** Box up a single primitive expression. */ JCExpression boxPrimitive(JCExpression tree, Type box) { make_at(tree.pos()); if (target.boxWithConstructors()) { Symbol ctor = lookupConstructor(tree.pos(), box, List.<Type>nil() .prepend(tree.type)); return make.Create(ctor, List.of(tree)); } else { Symbol valueOfSym = lookupMethod(tree.pos(), names.valueOf, box, List.<Type>nil() .prepend(tree.type)); return make.App(make.QualIdent(valueOfSym), List.of(tree)); } }
/** Box up a single primitive expression. */ JCExpression boxPrimitive(JCExpression tree, Type box) { make_at(tree.pos()); if (target.boxWithConstructors()) { Symbol ctor = lookupConstructor(tree.pos(), box, List.<Type>nil() .prepend(tree.type)); return make.Create(ctor, List.of(tree)); } else { Symbol valueOfSym = lookupMethod(tree.pos(), names.valueOf, box, List.<Type>nil() .prepend(tree.type)); return make.App(make.QualIdent(valueOfSym), List.of(tree)); } }
/** Box up a single primitive expression. */ JCExpression boxPrimitive(JCExpression tree, Type box) { make_at(tree.pos()); if (target.boxWithConstructors()) { Symbol ctor = lookupConstructor(tree.pos(), box, List.<Type>nil() .prepend(tree.type)); return make.Create(ctor, List.of(tree)); } else { Symbol valueOfSym = lookupMethod(tree.pos(), names.valueOf, box, List.<Type>nil() .prepend(tree.type)); return make.App(make.QualIdent(valueOfSym), List.of(tree)); } }
/** Box up a single primitive expression. */ JCExpression boxPrimitive(JCExpression tree, Type box) { make_at(tree.pos()); if (target.boxWithConstructors()) { Symbol ctor = lookupConstructor(tree.pos(), box, List.<Type>nil() .prepend(tree.type)); return make.Create(ctor, List.of(tree)); } else { Symbol valueOfSym = lookupMethod(tree.pos(), names.valueOf, box, List.<Type>nil() .prepend(tree.type)); return make.App(make.QualIdent(valueOfSym), List.of(tree)); } }
public void complete(Symbol sym) throws CompletionFailure { try { completer.complete(sym); } catch (CompletionFailure e) { sym.flags_field |= PUBLIC; ((ClassType) sym.type).supertype_field = objectType; Name n = target.boxWithConstructors() ? names.init : names.valueOf; MethodSymbol boxMethod = new MethodSymbol(PUBLIC | STATIC, n, new MethodType(List.of(type), sym.type, List.<Type>nil(), methodClass), sym); sym.members().enter(boxMethod); MethodSymbol unboxMethod = new MethodSymbol(PUBLIC, type.tsym.name.append(names.Value), // x.intValue() new MethodType(List.<Type>nil(), type, List.<Type>nil(), methodClass), sym); sym.members().enter(unboxMethod); } } };
public void complete(Symbol sym) throws CompletionFailure { try { completer.complete(sym); } catch (CompletionFailure e) { sym.flags_field |= PUBLIC; ((ClassType) sym.type).supertype_field = objectType; Name n = target.boxWithConstructors() ? names.init : names.valueOf; MethodSymbol boxMethod = new MethodSymbol(PUBLIC | STATIC, n, new MethodType(List.of(type), sym.type, List.<Type>nil(), methodClass), sym); sym.members().enter(boxMethod); MethodSymbol unboxMethod = new MethodSymbol(PUBLIC, type.tsym.name.append(names.Value), // x.intValue() new MethodType(List.<Type>nil(), type, List.<Type>nil(), methodClass), sym); sym.members().enter(unboxMethod); } } };
public void complete(Symbol sym) throws CompletionFailure { try { completer.complete(sym); } catch (CompletionFailure e) { sym.flags_field |= PUBLIC; ((ClassType) sym.type).supertype_field = objectType; Name n = target.boxWithConstructors() ? names.init : names.valueOf; MethodSymbol boxMethod = new MethodSymbol(PUBLIC | STATIC, n, new MethodType(List.of(type), sym.type, List.<Type>nil(), methodClass), sym); sym.members().enter(boxMethod); MethodSymbol unboxMethod = new MethodSymbol(PUBLIC, type.tsym.name.append(names.Value), // x.intValue() new MethodType(List.<Type>nil(), type, List.<Type>nil(), methodClass), sym); sym.members().enter(unboxMethod); } } };