com.sun.tools.javac.util.FatalError Java Examples

The following examples show how to use com.sun.tools.javac.util.FatalError. 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: JavacProcessingEnvironment.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Free resources related to annotation processing.
 */
public void close() {
    filer.close();
    if (discoveredProcs != null) // Make calling close idempotent
        discoveredProcs.close();
    discoveredProcs = null;
    if (processorClassLoader != null && processorClassLoader instanceof Closeable) {
        try {
            ((Closeable) processorClassLoader).close();
        } catch (IOException e) {
            JCDiagnostic msg = diags.fragment("fatal.err.cant.close.loader");
            throw new FatalError(msg, e);
        }
    }
}
 
Example #2
Source File: JavacProcessingEnvironment.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Free resources related to annotation processing.
 */
public void close() {
    filer.close();
    if (discoveredProcs != null) // Make calling close idempotent
        discoveredProcs.close();
    discoveredProcs = null;
    if (processorClassLoader != null && processorClassLoader instanceof Closeable) {
        try {
            ((Closeable) processorClassLoader).close();
        } catch (IOException e) {
            JCDiagnostic msg = diags.fragment("fatal.err.cant.close.loader");
            throw new FatalError(msg, e);
        }
    }
}
 
Example #3
Source File: TypeEnter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void resolveImports(JCCompilationUnit tree, Env<AttrContext> env) {
    if (tree.starImportScope.isFilled()) {
        // we must have already processed this toplevel
        return;
    }

    ImportFilter prevStaticImportFilter = staticImportFilter;
    ImportFilter prevTypeImportFilter = typeImportFilter;
    DiagnosticPosition prevLintPos = deferredLintHandler.immediate();
    Lint prevLint = chk.setLint(lint);
    Env<AttrContext> prevEnv = this.env;
    try {
        this.env = env;
        final PackageSymbol packge = env.toplevel.packge;
        this.staticImportFilter =
                (origin, sym) -> sym.isStatic() &&
                                 chk.importAccessible(sym, packge) &&
                                 sym.isMemberOf((TypeSymbol) origin.owner, types);
        this.typeImportFilter =
                (origin, sym) -> sym.kind == TYP &&
                                 chk.importAccessible(sym, packge);

        // Import-on-demand java.lang.
        PackageSymbol javaLang = syms.enterPackage(syms.java_base, names.java_lang);
        if (javaLang.members().isEmpty() && !javaLang.exists())
            throw new FatalError(diags.fragment(Fragments.FatalErrNoJavaLang));
        importAll(make.at(tree.pos()).Import(make.QualIdent(javaLang), false), javaLang, env);

        JCModuleDecl decl = tree.getModuleDecl();

        // Process the package def and all import clauses.
        if (tree.getPackage() != null && decl == null)
            checkClassPackageClash(tree.getPackage());

        for (JCImport imp : tree.getImports()) {
            doImport(imp);
        }

        if (decl != null) {
            //check @Deprecated:
            markDeprecated(decl.sym, decl.mods.annotations, env);
            // process module annotations
            annotate.annotateLater(decl.mods.annotations, env, env.toplevel.modle, null);
        }
    } finally {
        this.env = prevEnv;
        chk.setLint(prevLint);
        deferredLintHandler.setPos(prevLintPos);
        this.staticImportFilter = prevStaticImportFilter;
        this.typeImportFilter = prevTypeImportFilter;
    }
}