Java Code Examples for com.sun.tools.javac.util.List#last()
The following examples show how to use
com.sun.tools.javac.util.List#last() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavacParser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 2
Source File: JavacParser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 3
Source File: JavacParser.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, Token... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 4
Source File: Check.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Check that vararg method call is sound * @param pos Position to be used for error reporting. * @param argtypes Actual arguments supplied to vararg method. */ void checkVararg(DiagnosticPosition pos, List<Type> argtypes, Symbol msym) { Type argtype = argtypes.last(); if (!types.isReifiable(argtype) && (!allowSimplifiedVarargs || msym.attribute(syms.trustMeType.tsym) == null || !isTrustMeAllowedOnMethod(msym))) { warnUnchecked(pos, "unchecked.generic.array.creation", argtype); } }
Example 5
Source File: JavacParser.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 6
Source File: ClassReader.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
private List<Type> adjustMethodParams(long flags, List<Type> args) { boolean isVarargs = (flags & VARARGS) != 0; if (isVarargs) { Type varargsElem = args.last(); ListBuffer<Type> adjustedArgs = new ListBuffer<>(); for (Type t : args) { adjustedArgs.append(t != varargsElem ? t : ((ArrayType)t).makeVarargs()); } args = adjustedArgs.toList(); } return args.tail; }
Example 7
Source File: JavacParser.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 8
Source File: JavacParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 9
Source File: JavacParser.java From javaide with GNU General Public License v3.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, Token... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 10
Source File: Check.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Check that vararg method call is sound * @param pos Position to be used for error reporting. * @param argtypes Actual arguments supplied to vararg method. */ void checkVararg(DiagnosticPosition pos, List<Type> argtypes, Symbol msym) { Type argtype = argtypes.last(); if (!types.isReifiable(argtype) && (!allowSimplifiedVarargs || msym.attribute(syms.trustMeType.tsym) == null || !isTrustMeAllowedOnMethod(msym))) { warnUnchecked(pos, "unchecked.generic.array.creation", argtype); } }
Example 11
Source File: JavacParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 12
Source File: JavacParser.java From hottub with GNU General Public License v2.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 13
Source File: JavacParser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 14
Source File: JavacParser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) { setErrorEndPos(pos); JCErroneous err = F.at(pos).Erroneous(errs); reportSyntaxError(err, key, (Object[])args); if (errs != null) { JCTree last = errs.last(); if (last != null) storeEnd(last, pos); } return toP(err); }
Example 15
Source File: JavacHandlerUtil.java From EasyMPermission with MIT License | 4 votes |
/** * Checks if there is a method with the provided name. In case of multiple methods (overloading), only * the first method decides if EXISTS_BY_USER or EXISTS_BY_LOMBOK is returned. * * @param methodName the method name to check for. * @param node Any node that represents the Type (JCClassDecl) to look in, or any child node thereof. * @param caseSensitive If the search should be case sensitive. * @param params The number of parameters the method should have; varargs count as 0-*. Set to -1 to find any method with the appropriate name regardless of parameter count. */ public static MemberExistsResult methodExists(String methodName, JavacNode node, boolean caseSensitive, int params) { node = upToTypeNode(node); if (node != null && node.get() instanceof JCClassDecl) { top: for (JCTree def : ((JCClassDecl)node.get()).defs) { if (def instanceof JCMethodDecl) { JCMethodDecl md = (JCMethodDecl) def; String name = md.name.toString(); boolean matches = caseSensitive ? name.equals(methodName) : name.equalsIgnoreCase(methodName); if (matches) { if (params > -1) { List<JCVariableDecl> ps = md.params; int minArgs = 0; int maxArgs = 0; if (ps != null && ps.length() > 0) { minArgs = ps.length(); if ((ps.last().mods.flags & Flags.VARARGS) != 0) { maxArgs = Integer.MAX_VALUE; minArgs--; } else { maxArgs = minArgs; } } if (params < minArgs || params > maxArgs) continue; } List<JCAnnotation> annotations = md.getModifiers().getAnnotations(); if (annotations != null) for (JCAnnotation anno : annotations) { if (typeMatches(Tolerate.class, node, anno.getAnnotationType())) continue top; } return getGeneratedBy(def) == null ? MemberExistsResult.EXISTS_BY_USER : MemberExistsResult.EXISTS_BY_LOMBOK; } } } } return MemberExistsResult.NOT_EXISTS; }