private boolean thriftIsSetCall(Symbol.MethodSymbol symbol, Types types) { Preconditions.checkNotNull(tbaseType); // noinspection ConstantConditions return tbaseType.isPresent() && symbol.getSimpleName().toString().startsWith("isSet") // weeds out the isSet() method in TBase itself && symbol.getParameters().length() == 0 && types.isSubtype(symbol.owner.type, tbaseType.get()); } }
if (streamType.isFilterMethod(methodSymbol) && methodSymbol.getParameters().length() == 1) { ExpressionTree argTree = tree.getArguments().get(0); if (argTree instanceof NewClassTree) { && methodSymbol.getParameters().length() == 1) { ExpressionTree argTree = tree.getArguments().get(0); if (argTree instanceof NewClassTree) {
/** * Tells if the given method has varargs. */ public static boolean hasVarargs(MethodSymbol methodSymbol) { return methodSymbol != null && methodSymbol.getParameters().length() > 0 && (methodSymbol.flags() & Flags.VARARGS) != 0; }
/** * Tells if the method uses a type parameter. */ public static boolean hasTypeParameters(MethodSymbol methodSymbol) { if (methodSymbol != null && methodSymbol.getParameters().length() > 0) { for (VarSymbol p : methodSymbol.getParameters()) { if (p.type instanceof TypeVar) { return true; } } } return false; }
/** * Transforms a list of source files to Java file objects (used by javac). */ public static com.sun.tools.javac.util.List<JavaFileObject> toJavaFileObjects(JavaFileManager fileManager, Collection<File> sourceFiles) throws IOException { com.sun.tools.javac.util.List<JavaFileObject> fileObjects = com.sun.tools.javac.util.List.nil(); JavacFileManager javacFileManager = (JavacFileManager) fileManager; for (JavaFileObject fo : javacFileManager.getJavaFileObjectsFromFiles(sourceFiles)) { fileObjects = fileObjects.append(fo); } if (fileObjects.length() != sourceFiles.size()) { throw new IOException("invalid file list"); } return fileObjects; }
/** * Tells if a method can be invoked with some given parameter types. * * @param types * a reference to the types in the compilation scope * @param from * the caller method signature to test (contains the parameter types) * @param target * the callee method signature * @return true if the callee can be invoked by the caller */ public static boolean isInvocable(Types types, MethodType from, MethodType target) { if (from.getParameterTypes().length() != target.getParameterTypes().length()) { return false; } for (int i = 0; i < from.getParameterTypes().length(); i++) { if (!types.isAssignable(types.erasure(from.getParameterTypes().get(i)), types.erasure(target.getParameterTypes().get(i)))) { return false; } } return true; }
for (int i = 0; i < compilationUnits.length(); i++) { try { JCCompilationUnit cu = compilationUnits.get(i);
.print(","); if (typeApply.arguments.length() > 0) { removeLastChar(); print("|"); if (typeApply.arguments.length() > 0) { removeLastChar(); print("p0 : number"); } else { printArguments(typeApply.arguments.subList(0, typeApply.arguments.length() - 1)); substituteAndPrintType(typeApply.arguments.get(typeApply.arguments.length() - 1), arrayComponent, inTypeParameters, completeRawTypes, false); if (arrayComponent) { substituteAndPrintType(argument, arrayComponent, false, completeRawTypes, false).print(", "); if (typeApply.arguments.length() > 0) { removeLastChars(2); for (int i = 0; i < typeTree.type.tsym.getTypeParameters().length(); i++) { print("any, ");
defaultValues.put(i, expr); } else { if (!(expr instanceof JCIdent && i < methodDecl.params.length() && methodDecl.params.get(i).name .equals(((JCIdent) expr).name))) {
if (newClass.args.length() >= 3) { getPrinter().print("((str, index, len) => ").print("str.substring(index, index + len))((") .print(newClass.args.head).print(")");
public UndetVar(TypeVar origin, Types types) { super(UNDETVAR, origin); bounds = new EnumMap<InferenceBound, List<Type>>(InferenceBound.class); List<Type> declaredBounds = types.getBounds(origin); declaredCount = declaredBounds.length(); bounds.put(InferenceBound.UPPER, declaredBounds); bounds.put(InferenceBound.LOWER, List.<Type>nil()); bounds.put(InferenceBound.EQ, List.<Type>nil()); }
public void visitArrayAttributeProxy(ArrayAttributeProxy proxy) { int length = proxy.values.length(); Attribute[] ats = new Attribute[length]; Type elemtype = types.elemtype(type); int i = 0; for (List<Attribute> p = proxy.values; p.nonEmpty(); p = p.tail) { ats[i++] = deproxy(elemtype, p.head); } result = new Attribute.Array(type, ats); }
public void visitArrayAttributeProxy(ArrayAttributeProxy proxy) { int length = proxy.values.length(); Attribute[] ats = new Attribute[length]; Type elemtype = types.elemtype(type); int i = 0; for (List<Attribute> p = proxy.values; p.nonEmpty(); p = p.tail) { ats[i++] = deproxy(elemtype, p.head); } result = new Attribute.Array(type, ats); }
/** Write a compound attribute excluding the '@' marker. */ void writeCompoundAttribute(Attribute.Compound c) { databuf.appendChar(pool.put(typeSig(c.type))); databuf.appendChar(c.values.length()); for (Pair<Symbol.MethodSymbol,Attribute> p : c.values) { databuf.appendChar(pool.put(p.fst.name)); p.snd.accept(awriter); } }
/** Write a compound attribute excluding the '@' marker. */ void writeCompoundAttribute(Attribute.Compound c) { databuf.appendChar(pool.put(typeSig(c.type))); databuf.appendChar(c.values.length()); for (Pair<Symbol.MethodSymbol,Attribute> p : c.values) { databuf.appendChar(pool.put(p.fst.name)); p.snd.accept(awriter); } }
/** Write a compound attribute excluding the '@' marker. */ void writeCompoundAttribute(Attribute.Compound c) { databuf.appendChar(pool.put(typeSig(c.type))); databuf.appendChar(c.values.length()); for (Pair<Symbol.MethodSymbol,Attribute> p : c.values) { databuf.appendChar(pool.put(p.fst.name)); p.snd.accept(awriter); } }