Package org.codehaus.groovy.control.messages

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


        ClassNode declaringClass = parent.getDeclaringClass();
        if (parent instanceof FieldNode) {
            if ((((FieldNode)parent).getModifiers() & Opcodes.ACC_FINAL) != 0) {
                source.getErrorCollector().addErrorAndContinue(
                            new SyntaxErrorMessage(new SyntaxException(
                                "@groovy.beans.Bindable cannot annotate a final property.",
                                node.getLineNumber(),
                                node.getColumnNumber()),
                                source));
            }
View Full Code Here


        for (PropertyNode propertyNode : declaringClass.getProperties()) {
            if (propertyNode.getName().equals(fieldName)) {
                if (field.isStatic()) {
                    //noinspection ThrowableInstanceNeverThrown
                    source.getErrorCollector().addErrorAndContinue(
                                new SyntaxErrorMessage(new SyntaxException(
                                    "@groovy.beans.Bindable cannot annotate a static property.",
                                    node.getLineNumber(),
                                    node.getColumnNumber()),
                                    source));
                } else {
                    if (needsPropertyChangeSupport(declaringClass, source)) {
                        addPropertyChangeSupport(declaringClass);
                    }
                    createListenerSetter(source, node, declaringClass, propertyNode);
                }
                return;
            }
        }
        //noinspection ThrowableInstanceNeverThrown
        source.getErrorCollector().addErrorAndContinue(
                new SyntaxErrorMessage(new SyntaxException(
                        "@groovy.beans.Bindable must be on a property, not a field.  Try removing the private, protected, or public modifier.",
                        node.getLineNumber(),
                        node.getColumnNumber()),
                        source));
    }
View Full Code Here

        if (nodes[1] instanceof ClassNode) {
            addListenerToClass(source, node, (ClassNode) nodes[1]);
        } else {
            if ((((FieldNode)nodes[1]).getModifiers() & Opcodes.ACC_FINAL) != 0) {
                source.getErrorCollector().addErrorAndContinue(
                            new SyntaxErrorMessage(new SyntaxException(
                                "@groovy.beans.Vetoable cannot annotate a final property.",
                                node.getLineNumber(),
                                node.getColumnNumber()),
                                source));
            }
View Full Code Here

            if (propertyNode.getName().equals(fieldName)) {
                if (field.isStatic()) {
                    //noinspection ThrowableInstanceNeverThrown
                    source.getErrorCollector().addErrorAndContinue(
                                new SyntaxErrorMessage(new SyntaxException(
                                    "@groovy.beans.Vetoable cannot annotate a static property.",
                                    node.getLineNumber(),
                                    node.getColumnNumber()),
                                    source));
                } else {
                    createListenerSetter(source, node, bindable, declaringClass,  propertyNode);
                }
                return;
            }
        }
        //noinspection ThrowableInstanceNeverThrown
        source.getErrorCollector().addErrorAndContinue(
                    new SyntaxErrorMessage(new SyntaxException(
                        "@groovy.beans.Vetoable must be on a property, not a field.  Try removing the private, protected, or public modifier.",
                        node.getLineNumber(),
                        node.getColumnNumber()),
                        source));
    }
View Full Code Here

    public void addError(String msg, ASTNode expr) {
        int line = expr.getLineNumber();
        int col = expr.getColumnNumber();
        SourceUnit source = sourceUnit();
        source.getErrorCollector().addErrorAndContinue(
                new SyntaxErrorMessage(new SyntaxException(msg + '\n', line, col), source)
        );
    }
View Full Code Here

public abstract class ImplicitAssertionsTransformationUtil {

  public static void  reportError(ASTNode node, String message, SourceUnit sourceUnit) {
    int line = node.getLineNumber() > 0 ? node.getLineNumber() : node.getLastLineNumber();
    int column = node.getColumnNumber() > 0 ? node.getColumnNumber() : node.getLastColumnNumber();
    SyntaxErrorMessage errorMessage = new SyntaxErrorMessage(new SyntaxException(message, line, column), sourceUnit);
    sourceUnit.getErrorCollector().addErrorAndContinue(errorMessage);
  }
View Full Code Here

     * @param node The node that was annotated
     * @param msg The error message to display
     */
    private void generateSyntaxErrorMessage(SourceUnit sourceUnit, AnnotationNode node, String msg) {
        SyntaxException error = new SyntaxException(msg, node.getLineNumber(), node.getColumnNumber());
        sourceUnit.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(error, sourceUnit));
    }
View Full Code Here

            error = false;
        } else {
            error = true;
        }
        if (pMessage instanceof SyntaxErrorMessage) {
            SyntaxErrorMessage syntaxErrorMessage = (SyntaxErrorMessage)pMessage;
            SyntaxException syntaxException = syntaxErrorMessage.getCause();
            message = syntaxException.getMessage();
            fileName = syntaxException.getSourceLocator();
            // FIXME: getStartLine() vs. getLine()
            startLine = syntaxException.getStartLine();
            startColumn = syntaxException.getStartColumn();
View Full Code Here

        this.annotation.setAllowedTargets(bitmap);
    }

    protected void addError(String msg) {
        this.errorCollector.addErrorAndContinue(
          new SyntaxErrorMessage(new SyntaxException(msg
                  + " in @" + this.annotationClass.getName() + '\n',
                  this.annotation.getLineNumber(),
                  this.annotation.getColumnNumber()), this.source)
        );
    }
View Full Code Here

        );
    }

    protected void addError(String msg, ASTNode expr) {
        this.errorCollector.addErrorAndContinue(
          new SyntaxErrorMessage(new SyntaxException(msg
                  + " in @" + this.annotationClass.getName() + '\n',
                  expr.getLineNumber(),
                  expr.getColumnNumber()), this.source)
        );
    }
View Full Code Here

TOP

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

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.