Java Code Examples for com.sun.tools.javac.util.List

The following examples show how to use com.sun.tools.javac.util.List. These examples are extracted from open source projects. 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
/** Create a round (common code). */
private Round(Context context, int number, int priorErrors, int priorWarnings,
        Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
    this.context = context;
    this.number = number;

    compiler = JavaCompiler.instance(context);
    log = Log.instance(context);
    log.nerrors = priorErrors;
    log.nwarnings = priorWarnings;
    if (number == 1) {
        Assert.checkNonNull(deferredDiagnosticHandler);
        this.deferredDiagnosticHandler = deferredDiagnosticHandler;
    } else {
        this.deferredDiagnosticHandler = new Log.DeferredDiagnosticHandler(log);
    }

    // the following is for the benefit of JavacProcessingEnvironment.getContext()
    JavacProcessingEnvironment.this.context = context;

    // the following will be populated as needed
    topLevelClasses  = List.nil();
    packageInfoFiles = List.nil();
}
 
Example 2
Source Project: javaide   Source File: TransTypes.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void addOverrideBridges(DiagnosticPosition pos,
                                MethodSymbol impl,
                                MethodSymbol member,
                                ClassSymbol c,
                                ListBuffer<JCTree> bridges) {
    Type implErasure = impl.erasure(types);
    long flags = (impl.flags() & AccessFlags) | SYNTHETIC | BRIDGE | OVERRIDE_BRIDGE;
    member = new MethodSymbol(flags, member.name, member.type, c);
    JCMethodDecl md = make.MethodDef(member, null);
    JCExpression receiver = make.Super(types.supertype(c.type).tsym.erasure(types), c);
    Type calltype = erasure(impl.type.getReturnType());
    JCExpression call =
        make.Apply(null,
                   make.Select(receiver, impl).setType(calltype),
                   translateArgs(make.Idents(md.params),
                                 implErasure.getParameterTypes(), null))
        .setType(calltype);
    JCStatement stat = (member.getReturnType().tag == VOID)
        ? make.Exec(call)
        : make.Return(coerce(call, member.erasure(types).getReturnType()));
    md.body = make.Block(0, List.of(stat));
    c.members().enter(member);
    bridges.append(md);
}
 
Example 3
Source Project: TencentKona-8   Source File: Check.java    License: GNU General Public License v2.0 6 votes vote down vote up
/** Check that all methods which implement some
 *  method in `ic' conform to the method they implement.
 */
void checkImplementations(JCTree tree, ClassSymbol origin, ClassSymbol ic) {
    for (List<Type> l = types.closure(ic.type); l.nonEmpty(); l = l.tail) {
        ClassSymbol lc = (ClassSymbol)l.head.tsym;
        if ((allowGenerics || origin != lc) && (lc.flags() & ABSTRACT) != 0) {
            for (Scope.Entry e=lc.members().elems; e != null; e=e.sibling) {
                if (e.sym.kind == MTH &&
                    (e.sym.flags() & (STATIC|ABSTRACT)) == ABSTRACT) {
                    MethodSymbol absmeth = (MethodSymbol)e.sym;
                    MethodSymbol implmeth = absmeth.implementation(origin, types, false);
                    if (implmeth != null && implmeth != absmeth &&
                        (implmeth.owner.flags() & INTERFACE) ==
                        (origin.flags() & INTERFACE)) {
                        // don't check if implmeth is in a class, yet
                        // origin is an interface. This case arises only
                        // if implmeth is declared in Object. The reason is
                        // that interfaces really don't inherit from
                        // Object it's just that the compiler represents
                        // things that way.
                        checkOverride(tree, implmeth, absmeth, origin);
                    }
                }
            }
        }
    }
}
 
Example 4
Source Project: TencentKona-8   Source File: TransTypes.java    License: GNU General Public License v2.0 6 votes vote down vote up
private List<VarSymbol> createBridgeParams(MethodSymbol impl, MethodSymbol bridge,
        Type bridgeType) {
    List<VarSymbol> bridgeParams = null;
    if (impl.params != null) {
        bridgeParams = List.nil();
        List<VarSymbol> implParams = impl.params;
        Type.MethodType mType = (Type.MethodType)bridgeType;
        List<Type> argTypes = mType.argtypes;
        while (implParams.nonEmpty() && argTypes.nonEmpty()) {
            VarSymbol param = new VarSymbol(implParams.head.flags() | SYNTHETIC | PARAMETER,
                    implParams.head.name, argTypes.head, bridge);
            param.setAttributes(implParams.head);
            bridgeParams = bridgeParams.append(param);
            implParams = implParams.tail;
            argTypes = argTypes.tail;
        }
    }
    return bridgeParams;
}
 
Example 5
Source Project: hottub   Source File: DocletInvoker.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal).booleanValue();
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
Example 6
private String makeSignature(boolean full) {
    StringBuilder result = new StringBuilder();
    result.append("(");
    for (List<Type> types = sym.type.getParameterTypes(); types.nonEmpty(); ) {
        Type t = types.head;
        result.append(TypeMaker.getTypeString(env, t, full));
        types = types.tail;
        if (types.nonEmpty()) {
            result.append(", ");
        }
    }
    if (isVarArgs()) {
        int len = result.length();
        result.replace(len - 2, len, "...");
    }
    result.append(")");
    return result.toString();
}
 
Example 7
protected JCVariableDecl formalParameter(boolean lambdaParameter) {
    JCModifiers mods = optFinal(Flags.PARAMETER);
    // need to distinguish between vararg annos and array annos
    // look at typeAnnotationsPushedBack comment
    this.permitTypeAnnotationsPushBack = true;
    JCExpression type = parseType();
    this.permitTypeAnnotationsPushBack = false;

    if (token.kind == ELLIPSIS) {
        List<JCAnnotation> varargsAnnos = typeAnnotationsPushedBack;
        typeAnnotationsPushedBack = List.nil();
        checkVarargs();
        mods.flags |= Flags.VARARGS;
        // insert var arg type annotations
        type = insertAnnotationsToMostInner(type, varargsAnnos, true);
        nextToken();
    } else {
        // if not a var arg, then typeAnnotationsPushedBack should be null
        if (typeAnnotationsPushedBack.nonEmpty()) {
            reportSyntaxError(typeAnnotationsPushedBack.head.pos,
                    "illegal.start.of.type");
        }
        typeAnnotationsPushedBack = List.nil();
    }
    return variableDeclaratorId(mods, type, lambdaParameter);
}
 
Example 8
/** Check that all methods which implement some
 *  method in `ic' conform to the method they implement.
 */
void checkImplementations(JCTree tree, ClassSymbol origin, ClassSymbol ic) {
    for (List<Type> l = types.closure(ic.type); l.nonEmpty(); l = l.tail) {
        ClassSymbol lc = (ClassSymbol)l.head.tsym;
        if ((lc.flags() & ABSTRACT) != 0) {
            for (Symbol sym : lc.members().getSymbols(NON_RECURSIVE)) {
                if (sym.kind == MTH &&
                    (sym.flags() & (STATIC|ABSTRACT)) == ABSTRACT) {
                    MethodSymbol absmeth = (MethodSymbol)sym;
                    MethodSymbol implmeth = absmeth.implementation(origin, types, false);
                    if (implmeth != null && implmeth != absmeth &&
                        (implmeth.owner.flags() & INTERFACE) ==
                        (origin.flags() & INTERFACE)) {
                        // don't check if implmeth is in a class, yet
                        // origin is an interface. This case arises only
                        // if implmeth is declared in Object. The reason is
                        // that interfaces really don't inherit from
                        // Object it's just that the compiler represents
                        // things that way.
                        checkOverride(tree, implmeth, absmeth, origin);
                    }
                }
            }
        }
    }
}
 
Example 9
Source Project: netbeans   Source File: PostFlowAnalysis.java    License: Apache License 2.0 6 votes vote down vote up
private void checkThis(DiagnosticPosition pos, TypeSymbol c) {
    if (checkThis && currentClass != c) {
        List<Pair<TypeSymbol, Symbol>> ots = outerThisStack;
        if (ots.isEmpty()) {
            log.error(pos, new Error("compiler", "no.encl.instance.of.type.in.scope", c)); //NOI18N
            return;
        }
        Pair<TypeSymbol, Symbol> ot = ots.head;
        TypeSymbol otc = ot.fst;
        while (otc != c) {
            do {
                ots = ots.tail;
                if (ots.isEmpty()) {
                    log.error(pos, new Error("compiler", "no.encl.instance.of.type.in.scope", c)); //NOI18N
                    return;
                }
                ot = ots.head;
            } while (ot.snd != otc);
            if (otc.owner.kind != Kinds.Kind.PCK && !otc.hasOuterInstance()) {
                log.error(pos, new Error("compiler", "cant.ref.before.ctor.called", c)); //NOI18N
                return;
            }
            otc = ot.fst;
        }
    }
}
 
Example 10
Source Project: openjdk-jdk9   Source File: Analyzer.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
void process(JCNewClass oldTree, JCNewClass newTree, boolean hasErrors) {
    if (!hasErrors) {
        List<Type> inferredArgs, explicitArgs;
        if (oldTree.def != null) {
            inferredArgs = newTree.def.implementing.nonEmpty()
                              ? newTree.def.implementing.get(0).type.getTypeArguments()
                              : newTree.def.extending.type.getTypeArguments();
            explicitArgs = oldTree.def.implementing.nonEmpty()
                              ? oldTree.def.implementing.get(0).type.getTypeArguments()
                              : oldTree.def.extending.type.getTypeArguments();
        } else {
            inferredArgs = newTree.type.getTypeArguments();
            explicitArgs = oldTree.type.getTypeArguments();
        }
        for (Type t : inferredArgs) {
            if (!types.isSameType(t, explicitArgs.head)) {
                return;
            }
            explicitArgs = explicitArgs.tail;
        }
        //exact match
        log.warning(oldTree.clazz, "diamond.redundant.args");
    }
}
 
Example 11
Source Project: sqlitemagic   Source File: HandleTable.java    License: Apache License 2.0 6 votes vote down vote up
private void generateBulkMethod(JavacTreeMaker maker, JavacNode tableElement,
                                Set<String> allStaticMethodNames, String methodName,
                                String callClassName, String tableClassName,
                                CollectionType collectionType) {
  final String invokeKey = getCreateInvokeKey(callClassName, tableClassName);
  if (!allStaticMethodNames.contains(methodName)) {
    final JCTree.JCAnnotation invokesAnnotation = maker.Annotation(chainDotsString(tableElement, Invokes.class.getCanonicalName()),
        List.<JCTree.JCExpression>of(maker.Literal(invokeKey)));
    final JCTree.JCModifiers mods = maker.Modifiers(PUBLIC_STATIC, List.of(invokesAnnotation));
    final Name name = tableElement.toName(methodName);
    final JCTree.JCExpression returnType = getMagicMethodReturnType(tableElement, callClassName, tableClassName);
    final JCTree.JCExpression tableClassType = chainDotsString(tableElement, tableElement.getPackageDeclaration() + "." + tableClassName);
    final JCTree.JCExpression paramType = maker.TypeApply(collectionType.genericType(tableElement), List.of(tableClassType));
    long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, tableElement.getContext());
    final JCTree.JCVariableDecl param = maker.VarDef(maker.Modifiers(flags), tableElement.toName("o"), paramType, null);
    final JCTree.JCBlock body = defaultMagicMethodBody(maker, tableElement);
    final JCTree.JCMethodDecl method = maker.MethodDef(mods, name, returnType,
        List.<JCTree.JCTypeParameter>nil(),
        List.of(param),
        List.<JCTree.JCExpression>nil(),
        body,
        null);
    injectMethod(tableElement, recursiveSetGeneratedBy(method, tableElement.get(), tableElement.getContext()));
  }
}
 
Example 12
Source Project: openjdk-8-source   Source File: Check.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void checkSymbol(DiagnosticPosition pos, Symbol sym) {
    if (sym != null && sym.kind == TYP) {
        Env<AttrContext> classEnv = enter.getEnv((TypeSymbol)sym);
        if (classEnv != null) {
            DiagnosticSource prevSource = log.currentSource();
            try {
                log.useSource(classEnv.toplevel.sourcefile);
                scan(classEnv.tree);
            }
            finally {
                log.useSource(prevSource.getFile());
            }
        } else if (sym.kind == TYP) {
            checkClass(pos, sym, List.<JCTree>nil());
        }
    } else {
        //not completed yet
        partialCheck = true;
    }
}
 
Example 13
Source Project: manifold   Source File: ExtensionTransformer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void visitLambda( JCTree.JCLambda tree )
{
  super.visitLambda( tree );

  if( _tp.isGenerate() && !shouldProcessForGeneration() )
  {
    // Don't process tree during GENERATE, unless the tree was generated e.g., a bridge method
    return;
  }

  tree.type = eraseStructureType( tree.type );
  ArrayList<Type> types = new ArrayList<>();
  for( Type target: IDynamicJdk.instance().getTargets( tree ) )
  {
    types.add( eraseStructureType( target ) );
  }
  IDynamicJdk.instance().setTargets( tree, List.from( types ) );
}
 
Example 14
public List<TypeCompound> fromAnnotations(List<JCAnnotation> annotations) {
    if (annotations.isEmpty()) {
        return List.nil();
    }

    ListBuffer<TypeCompound> buf = new ListBuffer<>();
    for (JCAnnotation anno : annotations) {
        Assert.checkNonNull(anno.attribute);
        buf.append((TypeCompound) anno.attribute);
    }
    return buf.toList();
}
 
Example 15
Source Project: openjdk-8   Source File: DCTree.java    License: GNU General Public License v2.0 5 votes vote down vote up
public DCDocComment(Comment comment,
        List<DCTree> firstSentence, List<DCTree> body, List<DCTree> tags) {
    this.comment = comment;
    this.firstSentence = firstSentence;
    this.body = body;
    this.tags = tags;
}
 
Example 16
/** Construct a tree that represents the outer instance
 *  {@code C.this}. Never pick the current `this'.
 *  @param pos           The source code position to be used for the tree.
 *  @param c             The qualifier class.
 */
JCExpression makeOuterThis(DiagnosticPosition pos, TypeSymbol c) {
    List<VarSymbol> ots = outerThisStack;
    if (ots.isEmpty()) {
        log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c));
        Assert.error();
        return makeNull();
    }
    VarSymbol ot = ots.head;
    JCExpression tree = access(make.at(pos).Ident(ot));
    TypeSymbol otc = ot.type.tsym;
    while (otc != c) {
        do {
            ots = ots.tail;
            if (ots.isEmpty()) {
                log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c));
                Assert.error(); // should have been caught in Attr
                return tree;
            }
            ot = ots.head;
        } while (ot.owner != otc);
        if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
            chk.earlyRefError(pos, c);
            Assert.error(); // should have been caught in Attr
            return makeNull();
        }
        tree = access(make.at(pos).Select(tree, ot));
        otc = ot.type.tsym;
    }
    return tree;
}
 
Example 17
Source Project: hottub   Source File: AnnotatedTypeImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the annotations of this program element.
 * Return an empty array if there are none.
 */
@Override
public AnnotationDesc[] annotations() {
    List<? extends TypeCompound> tas = type.getAnnotationMirrors();
    if (tas == null ||
            tas.isEmpty()) {
        return new AnnotationDesc[0];
    }
    AnnotationDesc res[] = new AnnotationDesc[tas.length()];
    int i = 0;
    for (Attribute.Compound a : tas) {
        res[i++] = new AnnotationDescImpl(env, a);
    }
    return res;
}
 
Example 18
public <T extends JCTree> List<T> copy(List<T> trees, P p) {
    if (trees == null)
        return null;
    ListBuffer<T> lb = new ListBuffer<>();
    for (T tree: trees)
        lb.append(copy(tree, p));
    return lb.toList();
}
 
Example 19
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}
 
Example 20
Source Project: jdk8u60   Source File: Tokens.java    License: GNU General Public License v2.0 5 votes vote down vote up
Token(TokenKind kind, int pos, int endPos, List<Comment> comments) {
    this.kind = kind;
    this.pos = pos;
    this.endPos = endPos;
    this.comments = comments;
    checkKind();
}
 
Example 21
/**
 * Similar to makeOwnerThis but will never pick "this".
 */
JCExpression makeOwnerThisN(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) {
    Symbol c = sym.owner;
    List<VarSymbol> ots = outerThisStack;
    if (ots.isEmpty()) {
        log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c));
        Assert.error();
        return makeNull();
    }
    VarSymbol ot = ots.head;
    JCExpression tree = access(make.at(pos).Ident(ot));
    TypeSymbol otc = ot.type.tsym;
    while (!(preciseMatch ? sym.isMemberOf(otc, types) : otc.isSubClass(sym.owner, types))) {
        do {
            ots = ots.tail;
            if (ots.isEmpty()) {
                log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c));
                Assert.error();
                return tree;
            }
            ot = ots.head;
        } while (ot.owner != otc);
        tree = access(make.at(pos).Select(tree, ot));
        otc = ot.type.tsym;
    }
    return tree;
}
 
Example 22
Source Project: openjdk-jdk8u   Source File: JavacParser.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** CatchClause     = CATCH "(" FormalParameter ")" Block
 * TODO: the "FormalParameter" is not correct, it uses the special "catchTypes" rule below.
 */
protected JCCatch catchClause() {
    int pos = token.pos;
    accept(CATCH);
    accept(LPAREN);
    JCModifiers mods = optFinal(Flags.PARAMETER);
    List<JCExpression> catchTypes = catchTypes();
    JCExpression paramType = catchTypes.size() > 1 ?
            toP(F.at(catchTypes.head.getStartPosition()).TypeUnion(catchTypes)) :
            catchTypes.head;
    JCVariableDecl formal = variableDeclaratorId(mods, paramType);
    accept(RPAREN);
    JCBlock body = block();
    return F.at(pos).Catch(formal, body);
}
 
Example 23
private boolean hasParameterTypes(MethodSymbol method, List<Type> paramTypes) {
    if (paramTypes == null)
        return true;

    if (method.params().size() != paramTypes.size())
        return false;

    List<Type> methodParamTypes = types.erasureRecursive(method.asType()).getParameterTypes();

    return (Type.isErroneous(paramTypes))
        ? fuzzyMatch(paramTypes, methodParamTypes)
        : types.isSameTypes(paramTypes, methodParamTypes);
}
 
Example 24
Source Project: openjdk-8-source   Source File: Check.java    License: GNU General Public License v2.0 5 votes vote down vote up
/** Check for cyclic references. Issue an error if the
 *  symbol of the type referred to has a LOCKED flag set.
 *
 *  @param pos      Position to be used for error reporting.
 *  @param t        The type referred to.
 *  @returns        True if the check completed on all attributed classes
 */
private boolean checkNonCyclicInternal(DiagnosticPosition pos, Type t) {
    boolean complete = true; // was the check complete?
    //- System.err.println("checkNonCyclicInternal("+t+");");//DEBUG
    Symbol c = t.tsym;
    if ((c.flags_field & ACYCLIC) != 0) return true;

    if ((c.flags_field & LOCKED) != 0) {
        noteCyclic(pos, (ClassSymbol)c);
    } else if (!c.type.isErroneous()) {
        try {
            c.flags_field |= LOCKED;
            if (c.type.hasTag(CLASS)) {
                ClassType clazz = (ClassType)c.type;
                if (clazz.interfaces_field != null)
                    for (List<Type> l=clazz.interfaces_field; l.nonEmpty(); l=l.tail)
                        complete &= checkNonCyclicInternal(pos, l.head);
                if (clazz.supertype_field != null) {
                    Type st = clazz.supertype_field;
                    if (st != null && st.hasTag(CLASS))
                        complete &= checkNonCyclicInternal(pos, st);
                }
                if (c.owner.kind == TYP)
                    complete &= checkNonCyclicInternal(pos, c.owner.type);
            }
        } finally {
            c.flags_field &= ~LOCKED;
        }
    }
    if (complete)
        complete = ((c.flags_field & UNATTRIBUTED) == 0) && c.completer == null;
    if (complete) c.flags_field |= ACYCLIC;
    return complete;
}
 
Example 25
Source Project: openjdk-jdk9   Source File: Lower.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void visitModuleDef(JCModuleDecl tree) {
    ModuleSymbol msym = tree.sym;
    ClassSymbol c = msym.module_info;
    c.setAttributes(msym);
    c.flags_field |= Flags.MODULE;
    createInfoClass(List.nil(), tree.sym.module_info);
}
 
Example 26
Source Project: javaide   Source File: JCTree.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected JCCompilationUnit(List<JCAnnotation> packageAnnotations,
                            JCExpression pid,
                            List<JCTree> defs,
                            JavaFileObject sourcefile,
                            PackageSymbol packge,
                            ImportScope namedImportScope,
                            StarImportScope starImportScope) {
    this.packageAnnotations = packageAnnotations;
    this.pid = pid;
    this.defs = defs;
    this.sourcefile = sourcefile;
    this.packge = packge;
    this.namedImportScope = namedImportScope;
    this.starImportScope = starImportScope;
}
 
Example 27
/** Create a new round. */
private Round(Round prev,
        Set<JavaFileObject> newSourceFiles, Map<String,JavaFileObject> newClassFiles) {
    this(prev.nextContext(),
            prev.number+1,
            prev.compiler.log.nerrors,
            prev.compiler.log.nwarnings,
            null);
    this.genClassFiles = prev.genClassFiles;

    List<JCCompilationUnit> parsedFiles = compiler.parseFiles(newSourceFiles);
    roots = cleanTrees(prev.roots).appendList(parsedFiles);

    // Check for errors after parsing
    if (unrecoverableError())
        return;

    enterClassFiles(genClassFiles);
    List<ClassSymbol> newClasses = enterClassFiles(newClassFiles);
    genClassFiles.putAll(newClassFiles);
    enterTrees(roots);

    if (unrecoverableError())
        return;

    topLevelClasses = join(
            getTopLevelClasses(parsedFiles),
            getTopLevelClassesFromClasses(newClasses));

    packageInfoFiles = join(
            getPackageInfoFiles(parsedFiles),
            getPackageInfoFilesFromClasses(newClasses));

    findAnnotationsPresent();
}
 
Example 28
public JCExpression parseType(List<JCAnnotation> annotations) {
    JCExpression result = unannotatedType();

    if (annotations.nonEmpty()) {
        result = insertAnnotationsToMostInner(result, annotations, false);
    }

    return result;
}
 
Example 29
Source Project: openjdk-8   Source File: TList.java    License: GNU General Public License v2.0 5 votes vote down vote up
void test_listIterator() {
    System.err.println("test listIterator()");
    for (Map.Entry<java.util.List<String>,List<String>> e: examples.entrySet()) {
        java.util.List<String> ref = e.getKey();
        List<String> l = e.getValue();
        if (!equal(l.listIterator(), ref.listIterator()))
            throw new AssertionError();
    }
}
 
Example 30
Source Project: openjdk-jdk9   Source File: TypeAnnotations.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine whether an annotation is a declaration annotation,
 * a type annotation, or both.
 */
public AnnotationType annotationTargetType(Attribute.Compound a, Symbol s) {
    List<Attribute> targets = annotationTargets(a.type.tsym);
    return (targets == null) ?
            AnnotationType.DECLARATION :
            targets.stream()
                    .map(attr -> targetToAnnotationType(attr, s))
                    .reduce(AnnotationType.NONE, this::combineAnnotationType);
}