private void write(PrintWriter writer, Janitor janitor, List messages, String txt) { if (messages==null || messages.isEmpty()) return; Iterator iterator = messages.iterator(); while (iterator.hasNext()) { Message message = (Message) iterator.next(); message.write(writer, janitor); if (configuration.getDebug() && (message instanceof SyntaxErrorMessage)){ SyntaxErrorMessage sem = (SyntaxErrorMessage) message; sem.getCause().printStackTrace(writer); } writer.println(); } writer.print(messages.size()); writer.print(" "+txt); if (messages.size()>1) writer.print("s"); writer.println(); }
/** * Configures its debugging mode and classloader classpath from a given compiler configuration. * This cannot be done more than once due to limitations in {@link java.net.URLClassLoader URLClassLoader}. */ public void configure(CompilerConfiguration configuration) { super.configure(configuration); this.debug = configuration.getDebug(); if (!this.configured && this.classLoader instanceof GroovyClassLoader) { appendCompilerConfigurationClasspathToClassLoader(configuration, (GroovyClassLoader) this.classLoader); } this.configured = true; }
private void convertUncaughtExceptionToCompilationError(final Throwable e) { // check the exception for a nested compilation exception ErrorCollector nestedCollector = null; for (Throwable next = e.getCause(); next != e && next != null; next = next.getCause()) { if (!(next instanceof MultipleCompilationErrorsException)) continue; MultipleCompilationErrorsException mcee = (MultipleCompilationErrorsException) next; nestedCollector = mcee.collector; break; } if (nestedCollector != null) { getErrorCollector().addCollectorContents(nestedCollector); } else { Exception err = e instanceof Exception?((Exception)e):new RuntimeException(e); getErrorCollector().addError(new ExceptionMessage(err, configuration.getDebug(), this)); } }
public void addException(Exception cause, SourceUnit source) throws CompilationFailedException { addError(new ExceptionMessage(cause,configuration.getDebug(),source)); failIfErrors(); }
private void addLoadingError(final CompilerConfiguration config) { context.getErrorCollector().addFatalError( new SimpleMessage("Static type checking extension '" + scriptPath + "' could not be loaded.", config.getDebug(), typeCheckingVisitor.getSourceUnit()) ); }
context.getErrorCollector().addFatalError( new SimpleMessage("Static type checking extension '" + scriptPath + "' could not be loaded because it doesn't have a constructor accepting StaticTypeCheckingVisitor.", config.getDebug(), typeCheckingVisitor.getSourceUnit()) ); config.getDebug(), typeCheckingVisitor.getSourceUnit()));
setClasspathList(new LinkedList<String>(configuration.getClasspath())); setVerbose(configuration.getVerbose()); setDebug(configuration.getDebug()); setParameters(configuration.getParameters()); setTolerance(configuration.getTolerance());
public void testSetViaSystemProperties() { System.setProperty("groovy.warnings", "PaRaNoiA"); System.setProperty("groovy.output.verbose", "trUE"); System.setProperty("groovy.recompile.minimumInterval", "867892345"); assertEquals("PaRaNoiA", System.getProperty("groovy.warnings")); final CompilerConfiguration config = new CompilerConfiguration(System.getProperties()); assertEquals(WarningMessage.PARANOIA, config.getWarningLevel()); assertEquals(false, config.getDebug()); assertEquals(true, config.getVerbose()); assertEquals(10, config.getTolerance()); assertEquals(867892345, config.getMinimumRecompilationInterval()); assertNull(config.getScriptBaseClass()); assertEquals(getSystemEncoding(), config.getSourceEncoding()); assertEquals(getVMVersion(), config.getTargetBytecode()); assertEquals(false, config.getRecompileGroovySource()); { final List listCP = config.getClasspath(); assertNotNull(listCP); assertEquals(0, listCP.size()); } assertNotNull(config.getOutput()); assertNull(config.getTargetDirectory()); assertEquals(".groovy", config.getDefaultScriptExtension()); assertNull(config.getJointCompilationOptions()); assertNotNull(config.getPluginFactory()); }
public void testDefaultConstructor() { final CompilerConfiguration config = CompilerConfiguration.DEFAULT; assertEquals(WarningMessage.LIKELY_ERRORS, config.getWarningLevel()); assertEquals(Boolean.getBoolean("groovy.output.debug"), config.getDebug()); assertEquals(Boolean.getBoolean("groovy.output.verbose"), config.getVerbose()); assertEquals(false, config.getDebug()); assertEquals(false, config.getVerbose()); assertEquals(10, config.getTolerance()); assertEquals(100, config.getMinimumRecompilationInterval()); assertNull(config.getScriptBaseClass()); assertEquals(getSystemEncoding(), config.getSourceEncoding()); assertEquals(getVMVersion(), config.getTargetBytecode()); assertEquals(false, config.getRecompileGroovySource()); { final List listCP = config.getClasspath(); assertNotNull(listCP); assertEquals(0, listCP.size()); } assertNotNull(config.getOutput()); assertNull(config.getTargetDirectory()); assertEquals(".groovy", config.getDefaultScriptExtension()); assertNull(config.getJointCompilationOptions()); assertNotNull(config.getPluginFactory()); }
private void write(PrintWriter writer, Janitor janitor, List messages, String txt) { if (messages==null || messages.size()==0) return; Iterator iterator = messages.iterator(); while (iterator.hasNext()) { Message message = (Message) iterator.next(); message.write(writer, janitor); if (configuration.getDebug() && (message instanceof SyntaxErrorMessage)){ SyntaxErrorMessage sem = (SyntaxErrorMessage) message; sem.getCause().printStackTrace(writer); } } writer.println(); writer.print(messages.size()); writer.print(" "+txt); if (messages.size()>1) writer.print("s"); writer.println(); }
/** * Configures its debugging mode and classloader classpath from a given compiler configuration. * This cannot be done more than once due to limitations in {@link java.net.URLClassLoader URLClassLoader}. */ public void configure(CompilerConfiguration configuration) { super.configure(configuration); this.debug = configuration.getDebug(); if (!this.configured && this.classLoader instanceof GroovyClassLoader) { appendCompilerConfigurationClasspathToClassLoader(configuration, (GroovyClassLoader) this.classLoader); } this.configured = true; }
/** * Configures its debugging mode and classloader classpath from a given compiler configuration. * This cannot be done more than once due to limitations in {@link java.net.URLClassLoader URLClassLoader}. */ public void configure(CompilerConfiguration configuration) { super.configure(configuration); this.debug = configuration.getDebug(); if (!this.configured && this.classLoader instanceof GroovyClassLoader) { appendCompilerConfigurationClasspathToClassLoader(configuration, (GroovyClassLoader) this.classLoader); } this.configured = true; }
/** * Configures its debugging mode and classloader classpath from a given compiler configuration. * This cannot be done more than once due to limitations in {@link java.net.URLClassLoader URLClassLoader}. */ public void configure(CompilerConfiguration configuration) { super.configure(configuration); this.debug = configuration.getDebug(); if (!this.configured && this.classLoader instanceof GroovyClassLoader) { appendCompilerConfigurationClasspathToClassLoader(configuration, (GroovyClassLoader) this.classLoader); } this.configured = true; }
/** * Configures its debugging mode and classloader classpath from a given compiler configuration. * This cannot be done more than once due to limitations in {@link java.net.URLClassLoader URLClassLoader}. */ public void configure(CompilerConfiguration configuration) { super.configure(configuration); this.debug = configuration.getDebug(); if (!this.configured && this.classLoader instanceof GroovyClassLoader) { appendCompilerConfigurationClasspathToClassLoader(configuration, (GroovyClassLoader) this.classLoader); } this.configured = true; }
public void addException(Exception cause, SourceUnit source) throws CompilationFailedException { addError(new ExceptionMessage(cause,configuration.getDebug(),source)); failIfErrors(); }
public void addException(Exception cause, SourceUnit source) throws CompilationFailedException { addError(new ExceptionMessage(cause,configuration.getDebug(),source)); failIfErrors(); }
public void addException(Exception cause, SourceUnit source) throws CompilationFailedException { addError(new ExceptionMessage(cause,configuration.getDebug(),source)); failIfErrors(); }
public void addException(Exception cause, SourceUnit source) throws CompilationFailedException { addError(new ExceptionMessage(cause,configuration.getDebug(),source)); failIfErrors(); }