Search in sources :

Example 6 with ClassFileReader

use of org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader in project opennms by OpenNMS.

the class CustomJRJdtCompiler method getNameEnvironment.

protected INameEnvironment getNameEnvironment(final JRCompilationUnit[] units) {
    final INameEnvironment env = new INameEnvironment() {

        @Override
        public NameEnvironmentAnswer findType(char[][] compoundTypeName) {
            final StringBuilder result = new StringBuilder();
            String sep = "";
            for (int i = 0; i < compoundTypeName.length; i++) {
                result.append(sep);
                result.append(compoundTypeName[i]);
                sep = ".";
            }
            return findType(result.toString());
        }

        @Override
        public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName) {
            final StringBuilder result = new StringBuilder();
            String sep = "";
            for (int i = 0; i < packageName.length; i++) {
                result.append(sep);
                result.append(packageName[i]);
                sep = ".";
            }
            result.append(sep);
            result.append(typeName);
            return findType(result.toString());
        }

        private int getClassIndex(String className) {
            int classIdx;
            for (classIdx = 0; classIdx < units.length; ++classIdx) {
                if (className.equals(units[classIdx].getName())) {
                    break;
                }
            }
            if (classIdx >= units.length) {
                classIdx = -1;
            }
            return classIdx;
        }

        private NameEnvironmentAnswer findType(String className) {
            try {
                int classIdx = getClassIndex(className);
                if (classIdx >= 0) {
                    ICompilationUnit compilationUnit = new CompilationUnit(units[classIdx].getSourceCode(), className);
                    return new NameEnvironmentAnswer(compilationUnit, null);
                }
                String resourceName = className.replace('.', '/') + ".class";
                InputStream is = getResource(resourceName);
                if (is != null) {
                    try {
                        byte[] classBytes = JRLoader.loadBytes(is);
                        char[] fileName = className.toCharArray();
                        ClassFileReader classFileReader = new ClassFileReader(classBytes, fileName, true);
                        return new NameEnvironmentAnswer(classFileReader, null);
                    } finally {
                        try {
                            is.close();
                        } catch (IOException e) {
                        // ignore
                        }
                    }
                }
            } catch (JRException e) {
                LOG.error("Compilation error", e);
            } catch (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException exc) {
                LOG.error("Compilation error", exc);
            } catch (IllegalArgumentException e) {
                throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_NAME_ENVIRONMENT_ANSWER_INSTANCE_ERROR, (Object[]) null, e);
            }
            return null;
        }

        private boolean isPackage(String result) {
            int classIdx = getClassIndex(result);
            if (classIdx >= 0) {
                return false;
            }
            String resourceName = result.replace('.', '/') + ".class";
            boolean isPackage = true;
            InputStream is = getResource(resourceName);
            if (is != null) {
                // 1.5 plugin
                try {
                    isPackage = (is.read() > 0);
                } catch (IOException e) {
                // ignore
                } finally {
                    try {
                        is.close();
                    } catch (IOException e) {
                    // ignore
                    }
                }
            }
            return isPackage;
        }

        @Override
        public boolean isPackage(char[][] parentPackageName, char[] packageName) {
            final StringBuilder result = new StringBuilder();
            String sep = "";
            if (parentPackageName != null) {
                for (int i = 0; i < parentPackageName.length; i++) {
                    result.append(sep);
                    result.append(parentPackageName[i]);
                    sep = ".";
                }
            }
            if (Character.isUpperCase(packageName[0])) {
                if (!isPackage(result.toString())) {
                    return false;
                }
            }
            result.append(sep);
            result.append(packageName);
            return isPackage(result.toString());
        }

        @Override
        public void cleanup() {
        }
    };
    return env;
}
Also used : JRCompilationUnit(net.sf.jasperreports.engine.design.JRCompilationUnit) ICompilationUnit(org.eclipse.jdt.internal.compiler.env.ICompilationUnit) ICompilationUnit(org.eclipse.jdt.internal.compiler.env.ICompilationUnit) NameEnvironmentAnswer(org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer) JRException(net.sf.jasperreports.engine.JRException) InputStream(java.io.InputStream) ClassFileReader(org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader) JRRuntimeException(net.sf.jasperreports.engine.JRRuntimeException) IOException(java.io.IOException) INameEnvironment(org.eclipse.jdt.internal.compiler.env.INameEnvironment)

Example 7 with ClassFileReader

use of org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader in project drools by kiegroup.

the class EclipseJavaCompiler method compile.

public CompilationResult compile(final String[] pSourceFiles, final ResourceReader pReader, final ResourceStore pStore, final ClassLoader pClassLoader, final JavaCompilerSettings pSettings) {
    final Collection problems = new ArrayList();
    final ICompilationUnit[] compilationUnits = new ICompilationUnit[pSourceFiles.length];
    for (int i = 0; i < compilationUnits.length; i++) {
        final KiePath sourceFile = KiePath.of(pSourceFiles[i]);
        if (pReader.isAvailable(sourceFile)) {
            compilationUnits[i] = new CompilationUnit(pReader, sourceFile.asString());
        } else {
            // log.error("source not found " + sourceFile);
            final CompilationProblem problem = new CompilationProblem() {

                public int getEndColumn() {
                    return 0;
                }

                public int getEndLine() {
                    return 0;
                }

                public String getFileName() {
                    return sourceFile.asString();
                }

                public String getMessage() {
                    return "Source " + sourceFile.asString() + " could not be found";
                }

                public int getStartColumn() {
                    return 0;
                }

                public int getStartLine() {
                    return 0;
                }

                public boolean isError() {
                    return true;
                }

                public String toString() {
                    return getMessage();
                }
            };
            problems.add(problem);
        }
    }
    if (problems.size() > 0) {
        final CompilationProblem[] result = new CompilationProblem[problems.size()];
        problems.toArray(result);
        return new CompilationResult(result);
    }
    final IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();
    final IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault());
    final INameEnvironment nameEnvironment = new INameEnvironment() {

        public NameEnvironmentAnswer findType(final char[][] pCompoundTypeName) {
            final StringBuilder result = new StringBuilder();
            for (int i = 0; i < pCompoundTypeName.length; i++) {
                if (i != 0) {
                    result.append('.');
                }
                result.append(pCompoundTypeName[i]);
            }
            return findType(result.toString());
        }

        public NameEnvironmentAnswer findType(final char[] pTypeName, final char[][] pPackageName) {
            final StringBuilder result = new StringBuilder();
            for (char[] chars : pPackageName) {
                result.append(chars);
                result.append('.');
            }
            result.append(pTypeName);
            return findType(result.toString());
        }

        private NameEnvironmentAnswer findType(final String pClazzName) {
            final String resourceName = ClassUtils.convertClassToResourcePath(pClazzName);
            final byte[] clazzBytes = pStore.read(resourceName);
            if (clazzBytes != null) {
                try {
                    return createNameEnvironmentAnswer(pClazzName, clazzBytes);
                } catch (final ClassFormatException e) {
                    throw new RuntimeException("ClassFormatException in loading class '" + pClazzName + "' with JCI.");
                }
            }
            try (InputStream is = pClassLoader.getResourceAsStream(resourceName)) {
                if (is == null) {
                    return null;
                }
                if (ClassUtils.isCaseSenstiveOS()) {
                    // check it really is a class, this issue is due to windows case sensitivity issues for the class org.kie.Process and path org/droosl/process
                    try {
                        pClassLoader.loadClass(pClazzName);
                    } catch (ClassNotFoundException | NoClassDefFoundError e) {
                        return null;
                    }
                }
                final byte[] buffer = new byte[8192];
                try (ByteArrayOutputStream baos = new ByteArrayOutputStream(buffer.length)) {
                    int count;
                    while ((count = is.read(buffer, 0, buffer.length)) > 0) {
                        baos.write(buffer, 0, count);
                    }
                    baos.flush();
                    return createNameEnvironmentAnswer(pClazzName, baos.toByteArray());
                }
            } catch (final IOException e) {
                throw new RuntimeException("could not read class", e);
            } catch (final ClassFormatException e) {
                throw new RuntimeException("wrong class format", e);
            }
        }

        private NameEnvironmentAnswer createNameEnvironmentAnswer(final String pClazzName, final byte[] clazzBytes) throws ClassFormatException {
            final char[] fileName = pClazzName.toCharArray();
            final ClassFileReader classFileReader = new ClassFileReader(clazzBytes, fileName, true);
            return new NameEnvironmentAnswer(classFileReader, null);
        }

        private boolean isSourceAvailable(final String pClazzName, final ResourceReader pReader) {
            // FIXME: this should not be tied to the extension
            final String javaSource = pClazzName.replace('.', '/') + ".java";
            final String classSource = pClazzName.replace('.', '/') + ".class";
            return pReader.isAvailable(sourceFolder + javaSource) || pReader.isAvailable(sourceFolder + classSource);
        }

        private boolean isPackage(final String pClazzName) {
            try (InputStream is = pClassLoader.getResourceAsStream(ClassUtils.convertClassToResourcePath(pClazzName))) {
                if (is != null) {
                    if (ClassUtils.isWindows() || ClassUtils.isOSX()) {
                        try {
                            Class cls = pClassLoader.loadClass(pClazzName);
                            if (cls != null) {
                                return false;
                            }
                        } catch (ClassNotFoundException | NoClassDefFoundError e) {
                            return true;
                        }
                    }
                }
                return is == null && !isSourceAvailable(pClazzName, pReader);
            } catch (IOException e) {
                throw new RuntimeException("Cannot open or close resource stream!", e);
            }
        }

        public boolean isPackage(char[][] parentPackageName, char[] pPackageName) {
            final StringBuilder result = new StringBuilder();
            if (parentPackageName != null) {
                for (int i = 0; i < parentPackageName.length; i++) {
                    if (i != 0) {
                        result.append('.');
                    }
                    result.append(parentPackageName[i]);
                }
            }
            if (parentPackageName != null && parentPackageName.length > 0) {
                result.append('.');
            }
            result.append(pPackageName);
            return isPackage(result.toString());
        }

        public void cleanup() {
        }
    };
    final ICompilerRequestor compilerRequestor = pResult -> {
        if (pResult.hasProblems()) {
            final IProblem[] iproblems = pResult.getProblems();
            for (final IProblem iproblem : iproblems) {
                final CompilationProblem problem = new EclipseCompilationProblem(iproblem);
                problems.add(problem);
            }
        }
        if (!pResult.hasErrors()) {
            final ClassFile[] clazzFiles = pResult.getClassFiles();
            for (final ClassFile clazzFile : clazzFiles) {
                final char[][] compoundName = clazzFile.getCompoundName();
                final StringBuilder clazzName = new StringBuilder();
                for (int j = 0; j < compoundName.length; j++) {
                    if (j != 0) {
                        clazzName.append('.');
                    }
                    clazzName.append(compoundName[j]);
                }
                pStore.write(clazzName.toString().replace('.', '/') + ".class", clazzFile.getBytes());
            }
        }
    };
    final Map settingsMap = new EclipseJavaCompilerSettings(pSettings).toNativeSettings();
    CompilerOptions compilerOptions = new CompilerOptions(settingsMap);
    compilerOptions.parseLiteralExpressionsAsConstants = false;
    final Compiler compiler = new Compiler(nameEnvironment, policy, compilerOptions, compilerRequestor, problemFactory);
    if (ClassBuilderFactory.DUMP_GENERATED_CLASSES) {
        dumpUnits(compilationUnits, pReader);
    }
    compiler.compile(compilationUnits);
    final CompilationProblem[] result = new CompilationProblem[problems.size()];
    problems.toArray(result);
    return new CompilationResult(result);
}
Also used : IErrorHandlingPolicy(org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy) ResourceReader(org.kie.memorycompiler.resources.ResourceReader) INameEnvironment(org.eclipse.jdt.internal.compiler.env.INameEnvironment) KiePath(org.kie.memorycompiler.resources.KiePath) ByteArrayOutputStream(java.io.ByteArrayOutputStream) URLDecoder(java.net.URLDecoder) ResourceStore(org.kie.memorycompiler.resources.ResourceStore) ClassFormatException(org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException) CompilationProblem(org.kie.memorycompiler.CompilationProblem) CompilationResult(org.kie.memorycompiler.CompilationResult) AbstractJavaCompiler(org.kie.memorycompiler.AbstractJavaCompiler) ArrayList(java.util.ArrayList) ClassBuilderFactory(org.drools.core.factmodel.ClassBuilderFactory) NameEnvironmentAnswer(org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer) IoUtils(org.drools.core.util.IoUtils) Locale(java.util.Locale) StringTokenizer(java.util.StringTokenizer) Map(java.util.Map) ResourceReader(org.kie.memorycompiler.resources.ResourceReader) ClassFileReader(org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader) IProblemFactory(org.eclipse.jdt.internal.compiler.IProblemFactory) ClassUtils(org.drools.core.util.ClassUtils) IErrorHandlingPolicy(org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy) Collection(java.util.Collection) ClassFile(org.eclipse.jdt.internal.compiler.ClassFile) IOException(java.io.IOException) ICompilerRequestor(org.eclipse.jdt.internal.compiler.ICompilerRequestor) Compiler(org.eclipse.jdt.internal.compiler.Compiler) DefaultProblemFactory(org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory) DefaultErrorHandlingPolicies(org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies) IProblem(org.eclipse.jdt.core.compiler.IProblem) CompilerOptions(org.eclipse.jdt.internal.compiler.impl.CompilerOptions) JavaCompilerSettings(org.kie.memorycompiler.JavaCompilerSettings) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ICompilationUnit(org.eclipse.jdt.internal.compiler.env.ICompilationUnit) InputStream(java.io.InputStream) NameEnvironmentAnswer(org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer) ClassFileReader(org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader) ArrayList(java.util.ArrayList) CompilationProblem(org.kie.memorycompiler.CompilationProblem) ClassFormatException(org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException) INameEnvironment(org.eclipse.jdt.internal.compiler.env.INameEnvironment) DefaultProblemFactory(org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory) IProblemFactory(org.eclipse.jdt.internal.compiler.IProblemFactory) ICompilationUnit(org.eclipse.jdt.internal.compiler.env.ICompilationUnit) ICompilationUnit(org.eclipse.jdt.internal.compiler.env.ICompilationUnit) AbstractJavaCompiler(org.kie.memorycompiler.AbstractJavaCompiler) Compiler(org.eclipse.jdt.internal.compiler.Compiler) ClassFile(org.eclipse.jdt.internal.compiler.ClassFile) ICompilerRequestor(org.eclipse.jdt.internal.compiler.ICompilerRequestor) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) IProblem(org.eclipse.jdt.core.compiler.IProblem) CompilerOptions(org.eclipse.jdt.internal.compiler.impl.CompilerOptions) Collection(java.util.Collection) KiePath(org.kie.memorycompiler.resources.KiePath) CompilationResult(org.kie.memorycompiler.CompilationResult) Map(java.util.Map)

Example 8 with ClassFileReader

use of org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader in project Japid by branaway.

the class NameEnv method findType.

private NameEnvironmentAnswer findType(final String name) {
    try {
        if (!name.startsWith("japidviews.")) {
            // let super class loader to load the bytecode
            // byte[] bytes = this.rendererCompiler.crlr.getClassDefinition(name);
            byte[] bytes = this.rendererCompiler.crlr.getClassDefinition(name);
            return bytes == null ? null : new NameEnvironmentAnswer(new ClassFileReader(bytes, name.toCharArray(), true), null);
        } else {
            char[] fileName = name.toCharArray();
            RendererClass applicationClass = this.rendererCompiler.japidClasses.get(name);
            // ApplicationClass exists
            if (applicationClass != null) {
                byte[] bytecode = applicationClass.getBytecode();
                if (bytecode != null) {
                    ClassFileReader classFileReader = new ClassFileReader(bytecode, fileName, true);
                    return new NameEnvironmentAnswer(classFileReader, null);
                }
                // Cascade compilation
                ICompilationUnit compilationUnit = new CompilationUnit(this.rendererCompiler, name);
                return new NameEnvironmentAnswer(compilationUnit, null);
            }
            return null;
        }
    } catch (ClassFormatException e) {
        // Something very very bad
        throw new RuntimeException(e);
    }
}
Also used : ICompilationUnit(org.eclipse.jdt.internal.compiler.env.ICompilationUnit) ICompilationUnit(org.eclipse.jdt.internal.compiler.env.ICompilationUnit) NameEnvironmentAnswer(org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer) ClassFileReader(org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader) ClassFormatException(org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException)

Example 9 with ClassFileReader

use of org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader in project querydsl by querydsl.

the class ECJEvaluatorFactory method compile.

protected void compile(String source, ClassType projectionType, String[] names, Type[] types, String id, Map<String, Object> constants) throws IOException {
    // create source
    source = createSource(source, projectionType, names, types, id, constants);
    // compile
    final char[] targetContents = source.toCharArray();
    final String targetName = id;
    final ICompilationUnit[] targetCompilationUnits = new ICompilationUnit[] { new ICompilationUnit() {

        @Override
        public char[] getContents() {
            return targetContents;
        }

        @Override
        public char[] getMainTypeName() {
            int dot = targetName.lastIndexOf('.');
            if (dot > 0) {
                return targetName.substring(dot + 1).toCharArray();
            } else {
                return targetName.toCharArray();
            }
        }

        @Override
        public char[][] getPackageName() {
            StringTokenizer tok = new StringTokenizer(targetName, ".");
            char[][] result = new char[tok.countTokens() - 1][];
            for (int j = 0; j < result.length; j++) {
                result[j] = tok.nextToken().toCharArray();
            }
            return result;
        }

        @Override
        public char[] getFileName() {
            return CharOperation.concat(targetName.toCharArray(), ".java".toCharArray());
        }

        @Override
        public boolean ignoreOptionalProblems() {
            return true;
        }
    } };
    INameEnvironment env = new INameEnvironment() {

        private String join(char[][] compoundName, char separator) {
            if (compoundName == null) {
                return "";
            } else {
                List<String> parts = new ArrayList<>(compoundName.length);
                for (char[] part : compoundName) {
                    parts.add(new String(part));
                }
                return parts.stream().collect(Collectors.joining(new String(new char[] { separator })));
            }
        }

        @Override
        public NameEnvironmentAnswer findType(char[][] compoundTypeName) {
            return findType(join(compoundTypeName, '.'));
        }

        @Override
        public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName) {
            return findType(CharOperation.arrayConcat(packageName, typeName));
        }

        private boolean isClass(String result) {
            if (result == null || result.isEmpty()) {
                return false;
            }
            // if it's the class we're compiling, then of course it's a class
            if (result.equals(targetName)) {
                return true;
            }
            InputStream is = null;
            try {
                // if this is a class we've already compiled, it's a class
                is = loader.getResourceAsStream(result);
                if (is == null) {
                    // use our normal class loader now...
                    String resourceName = result.replace('.', '/') + ".class";
                    is = parentClassLoader.getResourceAsStream(resourceName);
                    if (is == null && !result.contains(".")) {
                        // we couldn't find the class, and it has no package; is it a core class?
                        is = parentClassLoader.getResourceAsStream("java/lang/" + resourceName);
                    }
                }
                return is != null;
            } finally {
                if (is != null) {
                    try {
                        is.close();
                    } catch (IOException ex) {
                    }
                }
            }
        }

        @Override
        public boolean isPackage(char[][] parentPackageName, char[] packageName) {
            // if the parent is a class, the child can't be a package
            String parent = join(parentPackageName, '.');
            if (isClass(parent)) {
                return false;
            }
            // if the child is a class, it's not a package
            String qualifiedName = (parent.isEmpty() ? "" : parent + ".") + new String(packageName);
            return !isClass(qualifiedName);
        }

        @Override
        public void cleanup() {
        }

        private NameEnvironmentAnswer findType(String className) {
            String resourceName = className.replace('.', '/') + ".class";
            InputStream is = null;
            try {
                // we're only asking ECJ to compile a single class; we shouldn't need this
                if (className.equals(targetName)) {
                    return new NameEnvironmentAnswer(targetCompilationUnits[0], null);
                }
                is = loader.getResourceAsStream(resourceName);
                if (is == null) {
                    is = parentClassLoader.getResourceAsStream(resourceName);
                }
                if (is != null) {
                    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
                    int nRead;
                    byte[] data = new byte[1024];
                    while ((nRead = is.read(data, 0, data.length)) != -1) {
                        buffer.write(data, 0, nRead);
                    }
                    buffer.flush();
                    ClassFileReader cfr = new ClassFileReader(buffer.toByteArray(), className.toCharArray(), true);
                    return new NameEnvironmentAnswer(cfr, null);
                } else {
                    return null;
                }
            } catch (ClassFormatException | IOException ex) {
                throw new RuntimeException(ex);
            } finally {
                if (is != null) {
                    try {
                        is.close();
                    } catch (IOException e) {
                    }
                }
            }
        }
    };
    ICompilerRequestor requestor = new ICompilerRequestor() {

        @Override
        public void acceptResult(CompilationResult result) {
            if (result.hasErrors()) {
                for (CategorizedProblem problem : result.getProblems()) {
                    if (problem.isError()) {
                        problemList.add(problem.getMessage());
                    }
                }
            } else {
                for (ClassFile clazz : result.getClassFiles()) {
                    try {
                        MemJavaFileObject jfo = (MemJavaFileObject) fileManager.getJavaFileForOutput(StandardLocation.CLASS_OUTPUT, new String(clazz.fileName()), JavaFileObject.Kind.CLASS, null);
                        OutputStream os = jfo.openOutputStream();
                        os.write(clazz.getBytes());
                    } catch (IOException ex) {
                        throw new RuntimeException(ex);
                    }
                }
            }
        }
    };
    problemList.clear();
    IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.exitAfterAllProblems();
    IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault());
    try {
        // Compiler compiler = new Compiler(env, policy, getCompilerOptions(), requestor, problemFactory, true);
        Compiler compiler = new Compiler(env, policy, compilerOptions, requestor, problemFactory);
        compiler.compile(targetCompilationUnits);
        if (!problemList.isEmpty()) {
            StringBuilder sb = new StringBuilder();
            for (String problem : problemList) {
                sb.append("\t").append(problem).append("\n");
            }
            throw new CodegenException("Compilation of " + id + " failed:\n" + source + "\n" + sb.toString());
        }
    } catch (RuntimeException ex) {
        // if we encountered an IOException, unbox and throw it;
        // if we encountered a ClassFormatException, box it as an IOException and throw it
        // otherwise, it's a legit RuntimeException,
        // not one of our checked exceptions boxed as unchecked; just rethrow
        Throwable cause = ex.getCause();
        if (cause != null) {
            if (cause instanceof IOException) {
                throw (IOException) cause;
            } else if (cause instanceof ClassFormatException) {
                throw new IOException(cause);
            }
        }
        throw ex;
    }
}
Also used : NameEnvironmentAnswer(org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer) ClassFileReader(org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) ArrayList(java.util.ArrayList) ClassFormatException(org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException) INameEnvironment(org.eclipse.jdt.internal.compiler.env.INameEnvironment) DefaultProblemFactory(org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory) ICompilationUnit(org.eclipse.jdt.internal.compiler.env.ICompilationUnit) Compiler(org.eclipse.jdt.internal.compiler.Compiler) InputStream(java.io.InputStream) IOException(java.io.IOException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) CategorizedProblem(org.eclipse.jdt.core.compiler.CategorizedProblem) StringTokenizer(java.util.StringTokenizer)

Aggregations

ClassFileReader (org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader)9 IOException (java.io.IOException)8 ICompilationUnit (org.eclipse.jdt.internal.compiler.env.ICompilationUnit)8 NameEnvironmentAnswer (org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer)8 InputStream (java.io.InputStream)7 INameEnvironment (org.eclipse.jdt.internal.compiler.env.INameEnvironment)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 ArrayList (java.util.ArrayList)6 Compiler (org.eclipse.jdt.internal.compiler.Compiler)6 ClassFormatException (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException)6 DefaultProblemFactory (org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory)6 StringTokenizer (java.util.StringTokenizer)5 IProblem (org.eclipse.jdt.core.compiler.IProblem)5 ClassFile (org.eclipse.jdt.internal.compiler.ClassFile)5 ICompilerRequestor (org.eclipse.jdt.internal.compiler.ICompilerRequestor)5 IErrorHandlingPolicy (org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy)5 IProblemFactory (org.eclipse.jdt.internal.compiler.IProblemFactory)5 CompilerOptions (org.eclipse.jdt.internal.compiler.impl.CompilerOptions)5 File (java.io.File)4 CompilationResult (org.eclipse.jdt.internal.compiler.CompilationResult)4