new MethodType(expectedArgTypes, returnType, List.<Type>nil(), symtab.methodClass); if (!freeTypeVariables.isEmpty()) { methodType = new ForAll(freeTypeVariables, methodType);
@Override @Nullable public Choice<Unifier> visitMethodType(MethodType methodTy, @Nullable Unifier unifier) { // Don't unify the return type, which doesn't matter in overload resolution. return unifyList(unifier, getParameterTypes(), methodTy.getParameterTypes()); }
make.QualIdent(lambdaType.getReturnType().tsym), List.<JCTypeParameter>nil(), localContext.syntheticParams, lambdaType.getThrownTypes() == null ? List.<JCExpression>nil() : make.Types(lambdaType.getThrownTypes()), null, null);
} else if (type instanceof Type.MethodType) { Type.MethodType methodType = (Type.MethodType) type; Type returnType = methodType.getReturnType(); if (nonNull(returnType) && nonNull(returnType.tsym)) { String baseType = returnType.tsym.flatName().toString();
argtypes, mt.getParameterTypes(), warn);
make.QualIdent(lambdaType.getReturnType().tsym), List.<JCTypeParameter>nil(), localContext.syntheticParams, lambdaType.getThrownTypes() == null ? List.<JCExpression>nil() : make.Types(lambdaType.getThrownTypes()), null, null);
argtypes, mt.getParameterTypes(), warn);
MethodType mt, InferenceContext inferenceContext) { InferenceContext rsInfoInfContext = resultInfo.checkContext.inferenceContext(); Type from = mt.getReturnType(); if (mt.getReturnType().containsAny(inferenceContext.inferencevars) && rsInfoInfContext != emptyContext) { from = types.capture(from); throw inferenceException .setMessage("infer.no.conforming.instance.exists", inferenceContext.restvars(), mt.getReturnType(), to);
ListBuffer<JCExpression> serArgs = new ListBuffer<>(); int i = 0; for (Type t : indyType.getParameterTypes()) { List<JCExpression> indexAsArg = new ListBuffer<JCExpression>().append(make.Literal(i)).toList(); List<Type> argTypes = new ListBuffer<Type>().append(syms.intType).toList();
ListBuffer<JCExpression> serArgs = new ListBuffer<>(); int i = 0; for (Type t : indyType.getParameterTypes()) { List<JCExpression> indexAsArg = new ListBuffer<JCExpression>().append(make.Literal(i)).toList(); List<Type> argTypes = new ListBuffer<Type>().append(syms.intType).toList();
&& tree.sym.owner.isLocal()) { MethodSymbol consSym = (MethodSymbol) tree.sym; List<Type> ptypes = ((MethodType) consSym.type).getParameterTypes(); Type classType = consSym.owner.type;
qualifier.type = indyType.getReturnType(); proxyCall.type = indyType.getReturnType(); return proxyCall; } finally {
qualifier.type = indyType.getReturnType(); proxyCall.type = indyType.getReturnType(); return proxyCall; } finally {
Type from = mt.getReturnType(); if (mt.getReturnType().containsAny(inferenceContext.inferencevars) && resultInfo.checkContext.inferenceContext() != emptyContext) { from = types.capture(from); throw inferenceException .setMessage("infer.no.conforming.instance.exists", inferenceContext.restvars(), mt.getReturnType(), to);
SYNTHETIC, names.init, new MethodType( argtypes.append( accessConstructorTag().erasure(types)),
SYNTHETIC, names.init, new MethodType( argtypes.append( accessConstructorTag().erasure(types)),
/** Read a method. */ MethodSymbol readMethod() { long flags = adjustMethodFlags(nextChar()); Name name = readName(nextChar()); Type type = readType(nextChar()); if (name == names.init && currentOwner.hasOuterInstance()) { // Sometimes anonymous classes don't have an outer // instance, however, there is no reliable way to tell so // we never strip this$n if (currentOwner.name.len != 0) type = new MethodType(type.getParameterTypes().tail, type.getReturnType(), type.getThrownTypes(), syms.methodClass); } MethodSymbol m = new MethodSymbol(flags, name, type, currentOwner); if (saveParameterNames) initParameterNames(m); Symbol prevOwner = currentOwner; currentOwner = m; try { readMemberAttrs(m); } finally { currentOwner = prevOwner; } if (saveParameterNames) setParameterNames(m, type); return m; }
/** Read a method. */ MethodSymbol readMethod() { long flags = adjustMethodFlags(nextChar()); Name name = readName(nextChar()); Type type = readType(nextChar()); if (name == names.init && currentOwner.hasOuterInstance()) { // Sometimes anonymous classes don't have an outer // instance, however, there is no reliable way to tell so // we never strip this$n if (currentOwner.name.len != 0) type = new MethodType(type.getParameterTypes().tail, type.getReturnType(), type.getThrownTypes(), syms.methodClass); } MethodSymbol m = new MethodSymbol(flags, name, type, currentOwner); Symbol prevOwner = currentOwner; currentOwner = m; try { readMemberAttrs(m); } finally { currentOwner = prevOwner; } return m; }
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); } } };
private MethodSymbol findMethod(NameAndType nt, Scope scope, long flags) { if (nt == null) return null; MethodType type = nt.type.asMethodType(); for (Scope.Entry e = scope.lookup(nt.name); e.scope != null; e = e.next()) if (e.sym.kind == MTH && isSameBinaryType(e.sym.type.asMethodType(), type)) return (MethodSymbol)e.sym; if (nt.name != names.init) // not a constructor return null; if ((flags & INTERFACE) != 0) // no enclosing instance return null; if (nt.type.getParameterTypes().isEmpty()) // no parameters return null; // A constructor of an inner class. // Remove the first argument (the enclosing instance) nt.type = new MethodType(nt.type.getParameterTypes().tail, nt.type.getReturnType(), nt.type.getThrownTypes(), syms.methodClass); // Try searching again return findMethod(nt, scope, flags); }