Package com.sun.tools.javac.util

Examples of com.sun.tools.javac.util.Context


public class T6589361 {
    public static void main(String [] args) throws Exception {
        JavacFileManager fm = null;
        try {
            fm = new JavacFileManager(new Context(), false, null);
            Set<JavaFileObject.Kind> set = new HashSet<JavaFileObject.Kind>();
            set.add(JavaFileObject.Kind.CLASS);
            Iterable<JavaFileObject> files = fm.list(StandardLocation.PLATFORM_CLASS_PATH, "java.lang", set, false);
            for (JavaFileObject file : files) {
                // Note: Zip/Jar entry names use '/', not File.separator, but just to be sure,
View Full Code Here


    //---------------

    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
        FSInfo fsInfo = context.get(FSInfo.class);

        round++;
        if (round == 1) {
            boolean expect = Boolean.valueOf(options.get("expect"));
            checkEqual("cache result", fsInfo.isDirectory(testDir), expect);
View Full Code Here

    public static void main(String... args) throws Exception {
        new TestSymtabItems().run();
    }

    void run() throws Exception {
        Context c = new Context();
        JavacFileManager.preRegister(c);
        Symtab syms = Symtab.instance(c);
        JavacTypes types = JavacTypes.instance(c);
        JavaCompiler.instance(c)// will init ClassReader.sourceCompleter
View Full Code Here

    /**
     * Programmatic interface for main function.
     * @param args The command line parameters.
     */
    public int compile(String[] args) {
        Context context = new Context();
        CeyloncFileManager.preRegister(context); // can't create it until Log
                                                 // has been set up
        CeylonLog.preRegister(context);
        int result = compile(args, context);
        if (fileManager instanceof JavacFileManager) {
View Full Code Here

    public JavacFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset) {
        return getStandardFileManager(null, diagnosticListener, locale, charset);
    }
   
    public JavacFileManager getStandardFileManager(Writer out, DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset) {
        Context context = new Context();
        if (diagnosticListener != null)
            context.put(DiagnosticListener.class, diagnosticListener);
        // make sure we set the out before someone else sets a default one, or uses one
        if (context.get(Log.outKey) == null) {
            if (out == null)
                context.put(Log.outKey, new PrintWriter(System.err, true));
            else
                context.put(Log.outKey, new PrintWriter(out, true));
        }
        CeylonLog.preRegister(context);
        return new CeyloncFileManager(context, true, charset);
    }
View Full Code Here

        }

        if (fileManager == null)
            fileManager = getStandardFileManager(out, diagnosticListener, null, null);

        Context context = ((CeyloncFileManager) fileManager).getContext();
        if (diagnosticListener != null && context.get(DiagnosticListener.class) == null)
            context.put(DiagnosticListener.class, diagnosticListener);

        context.put(JavaFileManager.class, fileManager);
        JavacTool.processOptions(context, fileManager, options);
        Main compiler = new Main("ceyloncTask", context.get(Log.outKey));
        return new CeyloncTaskImpl(compiler, options, context, classes, compilationUnits);
    }
View Full Code Here

        test(false);
        test(true);
    }

    static void test(boolean genEndPos) throws IOException {
        Context context = new Context();

        Options options = Options.instance(context);
        options.put("diags", "%b:%s/%o/%e:%_%t%m|%p%m");

        Log log = Log.instance(context);
View Full Code Here

                ZipFileIndex.getZipFileIndex(rt_jar, null, false, null, false);
        long zfiTime = zfi.getLastModified(TEST_ENTRY_NAME);

        check(je, jarEntryTime, zfi + ":" + TEST_ENTRY_NAME.getPath(), zfiTime);

        Context context = new Context();
        JavacFileManager fm = new JavacFileManager(context, false, null);
        ZipFileIndexArchive zfia = new ZipFileIndexArchive(fm, zfi);
        JavaFileObject jfo =
            zfia.getFileObject(TEST_ENTRY_NAME.dirname(),
                                   TEST_ENTRY_NAME.basename());
View Full Code Here

    public JavacFileManager getStandardFileManager(
        DiagnosticListener<? super JavaFileObject> diagnosticListener,
        Locale locale,
        Charset charset) {
        Context context = new Context();
        if (diagnosticListener != null)
            context.put(DiagnosticListener.class, diagnosticListener);
        context.put(Log.outKey, new PrintWriter(System.err, true)); // FIXME
        return new JavacFileManager(context, true, charset);
    }
View Full Code Here

                if (cu.getKind() != JavaFileObject.Kind.SOURCE) // implicit null check
                    throw new IllegalArgumentException(kindMsg);
            }
        }

        Context context = new Context();

        if (diagnosticListener != null)
            context.put(DiagnosticListener.class, diagnosticListener);

        if (out == null)
            context.put(Log.outKey, new PrintWriter(System.err, true));
        else
            context.put(Log.outKey, new PrintWriter(out, true));

        if (fileManager == null)
            fileManager = getStandardFileManager(diagnosticListener, null, null);
        context.put(JavaFileManager.class, fileManager);
        processOptions(context, fileManager, options);
        Main compiler = new Main("javacTask", context.get(Log.outKey));
        return new JavacTaskImpl(this, compiler, options, context, classes, compilationUnits);
    }
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.util.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.