Package org.codehaus.groovy.control.messages

Examples of org.codehaus.groovy.control.messages.SimpleMessage


   
    private void verifyClassAndAddTransform(AnnotationNode annotation, Class klass) {
        if (ASTTransformation.class.isAssignableFrom(klass)) {
            classNode.addTransform(klass, annotation);
        } else {
            source.getErrorCollector().addError(new SimpleMessage("Not an ASTTransformation: " +
                    klass.getName() + " declared by " + annotation.getClassNode().getName(), source));
        }
    }
View Full Code Here


            for (Class<? extends ASTTransformation> transformClass : baseTransforms.keySet()) {
                try {
                    transformInstances.put(transformClass, transformClass.newInstance());
                } catch (InstantiationException e) {
                    source.getErrorCollector().addError(
                            new SimpleMessage(
                                    "Could not instantiate Transformation Processor " + transformClass
                                    , //+ " declared by " + annotation.getClassNode().getName(),
                                    source));
                } catch (IllegalAccessException e) {
                    source.getErrorCollector().addError(
                            new SimpleMessage(
                                    "Could not instantiate Transformation Processor " + transformClass
                                    , //+ " declared by " + annotation.getClassNode().getName(),
                                    source));
                }
            }
View Full Code Here

                String className;
                BufferedReader svcIn = new BufferedReader(new InputStreamReader(service.openStream()));
                try {
                    className = svcIn.readLine();
                } catch (IOException ioe) {
                    compilationUnit.getErrorCollector().addError(new SimpleMessage(
                        "IOException reading the service definition at "
                        + service.toExternalForm() + " because of exception " + ioe.toString(), null));
                    continue;
                }
                while (className != null) {
                    if (!className.startsWith("#") && className.length() > 0) {
                        if (transformNames.containsKey(className)) {
                            if (!service.equals(transformNames.get(className))) {
                                compilationUnit.getErrorCollector().addWarning(
                                        WarningMessage.POSSIBLE_ERRORS,
                                        "The global transform for class " + className + " is defined in both "
                                            + transformNames.get(className).toExternalForm()
                                            + " and "
                                            + service.toExternalForm()
                                            + " - the former definition will be used and the latter ignored.",
                                        null,
                                        null);
                            }

                        } else {
                            transformNames.put(className, service);
                        }
                    }
                    try {
                        className = svcIn.readLine();
                    } catch (IOException ioe) {
                        compilationUnit.getErrorCollector().addError(new SimpleMessage(
                            "IOException reading the service definition at "
                            + service.toExternalForm() + " because of exception " + ioe.toString(), null));
                        //noinspection UnnecessaryContinue
                        continue;
                    }
                }
            }
        } catch (IOException e) {
            //FIXME the warning message will NPE with what I have :(
            compilationUnit.getErrorCollector().addError(new SimpleMessage(
                "IO Exception attempting to load global transforms:" + e.getMessage(),
                null));
        }
        try {
            Class.forName("java.lang.annotation.Annotation"); // test for 1.5 JVM
View Full Code Here

                        compilationUnit.addPhaseOperation(suOp, transformAnnotation.phase().getPhaseNumber());
                    } else {
                        compilationUnit.addNewPhaseOperation(suOp, transformAnnotation.phase().getPhaseNumber());
                    }
                } else {
                    compilationUnit.getErrorCollector().addError(new SimpleMessage(
                        "Transform Class " + entry.getKey() + " specified at "
                        + entry.getValue().toExternalForm() + " is not an ASTTransformation.", null));
                }
            } catch (Exception e) {
                compilationUnit.getErrorCollector().addError(new SimpleMessage(
                    "Could not instantiate global transform class " + entry.getKey() + " specified at "
                    + entry.getValue().toExternalForm() + "  because of exception " + e.toString(), null));
            }
        }
    }
View Full Code Here

            header = header+
            "\nThis javac version does not support compile(String[],PrintWriter), "+
            "so no further details of the error are available. The message error text "+
            "should be found on System.err.\n";
        }
        cu.getErrorCollector().addFatalError(new SimpleMessage(header,cu));
    }
View Full Code Here

            reader.close();
           
        }
        catch (IOException e) {
            getErrorCollector().addFatalError(new SimpleMessage(e.getMessage(),this));
        }
        finally {
            if (reader != null) {
                try {
                    reader.close();
View Full Code Here

                ClassNode cn = start;
                Set parents = new HashSet();
                do {
                    if (parents.contains(cn.getName())) {
                        getErrorCollector().addErrorAndContinue(
                                new SimpleMessage("cyclic inheritance involving " + cn.getName() + " in class " + start.getName(), this)
                        );
                        cn = null;
                    } else {
                        parents.add(cn.getName());
                        cn = cn.getSuperClass();
View Full Code Here

    protected static boolean hasSimilarMethod(MethodNode declaredMethod, ClassNode groovyMethods) {
        return groovyMethods.hasMethod(declaredMethod.getName(), declaredMethod.getParameters());
    }

    protected void error(SourceUnit source, String me) {
        source.getErrorCollector().addError(new SimpleMessage(me,source), true);
    }
View Full Code Here

        !Modifier.isAbstract(declaredMethod.getModifiers()) &&
        !groovyMethods.hasMethod(declaredMethod.getName(), declaredMethod.getParameters());
  }

  protected void error(SourceUnit source, String me) {
    source.getErrorCollector().addError(new SimpleMessage(me,source), true);
  }
View Full Code Here

            header = header +
                    "\nThis javac version does not support compile(String[],PrintWriter), " +
                    "so no further details of the error are available. The message error text " +
                    "should be found on System.err.\n";
        }
        cu.getErrorCollector().addFatalError(new SimpleMessage(header, cu));
    }
View Full Code Here

TOP

Related Classes of org.codehaus.groovy.control.messages.SimpleMessage

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.