Package org.apache.sling.commons.compiler

Examples of org.apache.sling.commons.compiler.CompilationResult


        final Map<String, String> mapping = new HashMap<String, String>();
        for(int i=0;i<srcFiles.length;i++) {
            mapping.put(units[i].getMainClassName() + ".java", srcFiles[i]);
        }
        return new CompilationResult() {

            private List<CompilerMessage> mapMessages(final List<CompilerMessage> msgs) {
                if ( msgs == null || msgs.size() == 0 ) {
                    return msgs;
                }
View Full Code Here


        final Options options = new Options();
        options.put(Options.KEY_SOURCE_VERSION, Options.VERSION_1_5);
        options.put(Options.KEY_CLASS_LOADER_WRITER, this);
        options.put(Options.KEY_CLASS_LOADER, this.getClass().getClassLoader());

        final CompilationResult result = new EclipseJavaCompiler().compile(new CompilationUnit[]{unit}, options);
        assertNotNull(result);
        assertNull(result.getErrors());
    }
View Full Code Here

        // clear exception
        this.compileException = null;
        try {
            final CompilerOptions opts = this.ioProvider.getForceCompileOptions();
            final CompilationUnit unit = new CompilationUnit(this.sourcePath, className, ioProvider);
            final CompilationResult result = this.ioProvider.getCompiler().compile(new org.apache.sling.commons.compiler.CompilationUnit[] {unit},
                    opts);

            final List<CompilerMessage> errors = result.getErrors();
            this.destroy();
            if ( errors != null && errors.size() > 0 ) {
                throw CompilerException.create(errors, this.sourcePath);
            }

            final Servlet servlet = (Servlet) result.loadCompiledClass(this.className).newInstance();

            servlet.init(this.config);
            this.injectFields(servlet);

            this.theServlet = servlet;
View Full Code Here

            // Default to 1.6
            options.put(Options.KEY_TARGET_VERSION, Options.VERSION_1_6);
        }

        final ArrayList<JavacErrorDetail> problemList = new ArrayList<JavacErrorDetail>();
        final CompilationResult result = this.ctxt.getRuntimeContext().getIOProvider().getJavaCompiler().compile(new CompilationUnit[] {unit}, options);
        if ( result.getErrors() != null ) {
            for(final CompilerMessage cm : result.getErrors() ) {
                final String name = cm.getFile();
                try {
                    problemList.add(ErrorDispatcher.createJavacError
                            (name, pageNodes, new StringBuffer(cm.getMessage()),
                                    cm.getLine(), ctxt));
View Full Code Here

TOP

Related Classes of org.apache.sling.commons.compiler.CompilationResult

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.