Package org.codehaus.commons.compiler

Examples of org.codehaus.commons.compiler.CompileException


        }

        // Implement "Locatable".
        public Location getLocation() { return this.location; }
        public void throwCompileException(String message) throws CompileException {
            throw new CompileException(message, this.location);
        }
View Full Code Here


    /**
     * Convenience method for throwing a CompileException.
     */
    protected final void throwCompileException(String message) throws CompileException {
        throw new CompileException(message, this.location());
    }
View Full Code Here

            // Find the class/interface declaration in the compiled unit.
            IClass res = uc.findClass(className);
            if (res == null) {
                if (className.equals(topLevelClassName)) {
                    throw new CompileException((
                        "Source file \""
                        + sourceResource.getFileName()
                        + "\" does not declare class \""
                        + className
                        + "\""
View Full Code Here

            ClassFile.InnerClassesAttribute.Entry e = (ClassFile.InnerClassesAttribute.Entry) it.next();
            if (e.outerClassInfoIndex == this.classFile.thisClass) {
                try {
                    res.add(this.resolveClass(e.innerClassInfoIndex));
                } catch (ClassNotFoundException ex) {
                    throw new CompileException(ex.getMessage(), null);
                }
            }
        }
        return (IClass[]) res.toArray(new IClass[res.size()]);
    }
View Full Code Here

                // Is this an anonymous class?
                if (e.outerClassInfoIndex == 0) return null;
                try {
                    return this.resolveClass(e.outerClassInfoIndex);
                } catch (ClassNotFoundException ex) {
                    throw new CompileException(ex.getMessage(), null);
                }
            }
        }
        return null;
    }
View Full Code Here

                    // Member type.
                    if ((e.innerClassAccessFlags & Mod.STATIC) != 0) return null;
                    try {
                        return this.resolveClass(e.outerClassInfoIndex);
                    } catch (ClassNotFoundException ex) {
                        throw new CompileException(ex.getMessage(), null);
                    }
                }
            }
        }
        return null;
View Full Code Here

    protected IClass getSuperclass2() throws CompileException {
        if (this.classFile.superclass == 0) return null;
        try {
            return this.resolveClass(this.classFile.superclass);
        } catch (ClassNotFoundException e) {
            throw new CompileException(e.getMessage(), null);
        }
    }
View Full Code Here

        IClass[] result = new IClass[ifs.length];
        for (int i = 0; i < result.length; ++i) {
            try {
                result[i] = this.resolveClass(ifs[i]);
            } catch (ClassNotFoundException e) {
                throw new CompileException(e.getMessage(), null);
            }
        }
        return result;
    }
View Full Code Here

        // Implement "Locatable".

        public Location getLocation() { return this.location; }
        public void throwCompileException(String message) throws CompileException {
            throw new CompileException(message, this.location);
        }
View Full Code Here

      CompilationTask task = compiler.getTask(null, fileManager, listener, compilerOptions, null, Collections.singleton(compilationUnit));

      // Run the compiler.
      if(!task.call()) {
        throw new CompileException("Compilation failed", null);
      } else if (!compilationUnit.isCompiled()) {
        throw new ClassNotFoundException(className + ": Class file not created by compilation.");
      }
      // all good
      return compilationUnit.getByteCode();
View Full Code Here

TOP

Related Classes of org.codehaus.commons.compiler.CompileException

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.