Package com.envoisolutions.sxc.builder

Examples of com.envoisolutions.sxc.builder.BuildException


        try {
            Class<?> main = newCL.loadClass("com.sun.tools.javac.Main");
            Method method = main.getMethod("compile", String[].class, PrintWriter.class);
            exitCode = (Integer) method.invoke(null, args.toArray(new String[args.size()]), writer);
        } catch (ClassNotFoundException e1) {
            throw new BuildException("Could not find javac compiler!", e1);
        } catch (Exception e) {
            throw new BuildException("Could not invoke javac compiler!", e);
        }

        // check exit code
        if (exitCode != 0) {
            writer.close();

            System.out.println(out.toString());

            throw new BuildException("Could not compile generated files! Code: " + exitCode);
        }
    }
View Full Code Here


        File toolsJar = new File(System.getProperty("java.home"), "../lib/tools.jar");
        if (toolsJar.exists()) {
            try {
                urls = new URL[]{toolsJar.toURL()};
            } catch (MalformedURLException e) {
                throw new BuildException("Could not convert the file reference to tools.jar to a URL, path to tools.jar: '"
                        + toolsJar.getAbsolutePath() + "'.");
            }
        } else {
            urls = new URL[0];
        }
View Full Code Here

        try {
            Field jdocField = JDefinedClass.class.getDeclaredField("jdoc");
            jdocField.setAccessible(true);
            return (JDocComment) jdocField.get(definedClass);
        } catch (Exception e) {
            throw new BuildException("Unable to hack into JDefinedClass to add staic imports");
        }
    }
View Full Code Here

        try {
            Field jdocField = JDefinedClass.class.getDeclaredField("jdoc");
            jdocField.setAccessible(true);
            jdocField.set(definedClass, value);
        } catch (Exception e) {
            throw new BuildException("Unable to hack into JDefinedClass to add staic imports");
        }
    }
View Full Code Here

    }

    public void state(JFormatter f) {
        if (ifConditions.isEmpty()) {
            if (elseBlock != null) {
                throw new BuildException("If else block has an else block but no if blocks", declaredLocation);
            }
            // totally empty statement
            return;
        }
View Full Code Here

            if(writerClsName!=null) {
                Class<?> writerCls = cl.loadClass(writerClsName);
                writerConstructor = writerCls.getConstructor(Context.class);
            }
        } catch (Exception e) {
            throw new BuildException(e);
        }
    }
View Full Code Here

    @Override
    public Reader createReader() {
        try {
            return (Reader) readerConstructor.newInstance(this);
        } catch (Exception e) {
            throw new BuildException(e);
        }
    }
View Full Code Here

    @Override
    public Writer createWriter() {
        try {
            return (Writer) writerConstructor.newInstance(this);
        } catch (Exception e) {
            throw new BuildException(e);
        }
    }
View Full Code Here

                cc.method(JMod.PUBLIC, Writer.class,"createWriter")
                    .body()._return( writerBuilder!=null
                        ? JExpr._new(writerBuilder.getWriterClass()).arg(JExpr._this())
                        : JExpr._null());
            } catch (JClassAlreadyExistsException e) {
                throw new BuildException(e);
            }
        }
    }
View Full Code Here

        if (codeWriter == null) {
            try {
                codeWriter = new CodeWriterImpl();
                write(codeWriter);
            } catch (IOException e) {
                throw new BuildException(e);
            }
        }

        // compile the generated code
        Compiler compiler = Compiler.newInstance(this.compiler);
View Full Code Here

TOP

Related Classes of com.envoisolutions.sxc.builder.BuildException

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.