Package flex2.compiler

Examples of flex2.compiler.CompilerException


        if (m_reader == null) {
            throw new IllegalStateException("annotation enhancer is not initialized");
        }
        FieldAnnotationInfo info = new FieldAnnotationInfo(field, annotation);
        if (hasFieldAnnotation(info)) {
            throw new CompilerException(
                    "duplicate field annotation " + annotation,
                    SourceLocation.render(annotation)
            );
        }
        m_fieldAnnotations.add(new FieldAnnotationInfo(field, annotation));
View Full Code Here


        if (m_reader == null) {
            throw new IllegalStateException("annotation enhancer is not initialized");
        }
        MethodAnnotationInfo info = new MethodAnnotationInfo(constructor, annotation);
        if (hasConstructorAnnotation(info)) {
            throw new CompilerException(
                    "duplicate constructor annotation " + annotation,
                    SourceLocation.render(annotation)
            );
        }
        m_constructorAnnotations.add(new MethodAnnotationInfo(constructor, annotation));
View Full Code Here

        File file = new File(filename);
        File parentFile = file.getParentFile();
        if (!parentFile.exists()) {
            // directory does not exist create all directories in the filename
            if (!parentFile.mkdirs()) {
                throw new CompilerException(
                        "could not create dir structure needed to write file " + filename + " to disk"
                );
            }
        }
        FileOutputStream os = null;
        try {
            os = new FileOutputStream(filename);
            os.write(writer.toByteArray());
        } catch (IOException e) {
            throw new CompilerException("could not write compiled class file to disk [" + filename + "]", e);
        } finally {
            try {
                os.close();
            } catch (IOException e) {
                throw new CompilerException("could not close file output stream for [" + filename + "]", e);
            }
        }
    }
View Full Code Here

        /**
         * Helper to stdout
         */
        public void dump() {
            for (Iterator iterator = compilerExceptions.iterator(); iterator.hasNext();) {
                CompilerException compilerException = (CompilerException) iterator.next();
                System.out.println("ERROR: "+ compilerException.toString());
            }
            for (Iterator iterator = acceptedLocations.iterator(); iterator.hasNext();) {
                SourceLocation sourceLocation = (SourceLocation) iterator.next();
                System.out.println("OK: " + sourceLocation.toString());
            }
View Full Code Here

        /**
         * Helper to stdout
         */
        public void dump() {
            for (Iterator iterator = compilerExceptions.iterator(); iterator.hasNext();) {
                CompilerException compilerException = (CompilerException) iterator.next();
                System.out.println("ERROR: "+ compilerException.toString());
            }
            for (Iterator iterator = acceptedLocations.iterator(); iterator.hasNext();) {
                SourceLocation sourceLocation = (SourceLocation) iterator.next();
                System.out.println("OK: " + sourceLocation.toString());
            }
View Full Code Here

    public void insertClassAnnotation(final RawAnnotation annotation) {
        if (m_reader == null) {
            throw new IllegalStateException("annotation enhancer is not initialized");
        }
        if (hasClassAnnotation(annotation)) {
            throw new CompilerException(
                    "duplicate class annotation " + annotation,
                    SourceLocation.render(annotation)
            );
        }
        m_classAnnotations.add(annotation);
View Full Code Here

        if (m_reader == null) {
            throw new IllegalStateException("annotation enhancer is not initialized");
        }
        FieldAnnotationInfo info = new FieldAnnotationInfo(field, annotation);
        if (hasFieldAnnotation(info)) {
            throw new CompilerException(
                    "duplicate field annotation " + annotation,
                    SourceLocation.render(annotation)
            );
        }
        m_fieldAnnotations.add(new FieldAnnotationInfo(field, annotation));
View Full Code Here

        if (m_reader == null) {
            throw new IllegalStateException("annotation enhancer is not initialized");
        }
        MethodAnnotationInfo info = new MethodAnnotationInfo(constructor, annotation);
        if (hasConstructorAnnotation(info)) {
            throw new CompilerException(
                    "duplicate constructor annotation " + annotation,
                    SourceLocation.render(annotation)
            );
        }
        m_constructorAnnotations.add(new MethodAnnotationInfo(constructor, annotation));
View Full Code Here

        File file = new File(filename);
        File parentFile = file.getParentFile();
        if (!parentFile.exists()) {
            // directory does not exist create all directories in the filename
            if (!parentFile.mkdirs()) {
                throw new CompilerException(
                        "could not create dir structure needed to write file " + filename + " to disk"
                );
            }
        }
        FileOutputStream os = null;
        try {
            os = new FileOutputStream(filename);
            os.write(writer.toByteArray());
        } catch (IOException e) {
            throw new CompilerException("could not write compiled class file to disk [" + filename + "]", e);
        } finally {
            try {
                os.close();
            } catch (IOException e) {
                throw new CompilerException("could not close file output stream for [" + filename + "]", e);
            }
        }
    }
View Full Code Here

            String rawValueString = rawAnnotationString.substring(annotationName.length());
            rawValueString = rawValueString.trim();
            char first = rawValueString.charAt(0);
            if (first == '(') {
                if (!rawValueString.endsWith(")")) {
                    throw new CompilerException("annotation not well-formed, needs to end with a closing parenthesis ["
                            + rawAnnotationString + "]",
                            SourceLocation.render(annotationClass, tag, enclosingClassName, enclosingClassFileName)
                    );
                }
                return new RawAnnotation(annotationClass, rawValueString.substring(1, rawValueString.length()-1), tag.getLineNumber(), enclosingClassName, enclosingClassFileName);
            } else if (first == '"') {
                if (!rawValueString.endsWith("\"")) {
                    throw new CompilerException("annotation not well-formed, needs to end with a closing \" ["
                            + rawAnnotationString + "]",
                            SourceLocation.render(annotationClass, tag, enclosingClassName, enclosingClassFileName)
                    );
                }
                return new RawAnnotation(annotationClass, rawValueString, tag.getLineNumber(), enclosingClassName, enclosingClassFileName);
View Full Code Here

TOP

Related Classes of flex2.compiler.CompilerException

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.