Package org.eclipse.jdt.internal.compiler.env

Examples of org.eclipse.jdt.internal.compiler.env.ICompilationUnit


                private NameEnvironmentAnswer findType(String className) {

                    InputStream is = null;
                    try {
                        if (className.equals(targetClassName)) {
                            ICompilationUnit compilationUnit =
                                new CompilationUnit(sourceFile, className);
                            return
                                new NameEnvironmentAnswer(compilationUnit, null);
                        }
                        String resourceName =
View Full Code Here


                private NameEnvironmentAnswer findType(String className) {

                    InputStream is = null;
                    try {
                        if (className.equals(targetClassName)) {
                            ICompilationUnit compilationUnit =
                                new CompilationUnit(sourceFile, className);
                            return
                                new NameEnvironmentAnswer(compilationUnit, null);
                        }
                        String resourceName =
View Full Code Here

               
                private NameEnvironmentAnswer findType(String className) {

                    try {
                        if (className.equals(targetClassName)) {
                            ICompilationUnit compilationUnit =
                                new CompilationUnit(sourceFile, className);
                            return
                                new NameEnvironmentAnswer(compilationUnit, null);
                        }
                        String resourceName =
View Full Code Here

      FindTypesInCud typeFinder = new FindTypesInCud();
      cud.traverse(typeFinder, cud.scope);
      List<CompiledClass> compiledClasses = typeFinder.getClasses();
      addBinaryTypes(compiledClasses);

      ICompilationUnit icu = cud.compilationResult().compilationUnit;
      Adapter adapter = (Adapter) icu;
      CompilationUnitBuilder builder = adapter.getBuilder();
      contentIdMap.put(builder.getLocation(), builder.getContentId());
      processor.process(builder, cud, compiledClasses);
    }
View Full Code Here

          unit.compilationResult.totalUnitsKnown = totalUnits;

          this.lookupEnvironment.unitBeingCompleted = null;
        }

        ICompilationUnit cu = unit.compilationResult.compilationUnit;
        String loc = String.valueOf(cu.getFileName());
        TreeLogger branch = logger.branch(TreeLogger.SPAM,
            "Scanning for additional dependencies: " + loc, null);

        // Examine the cud for magic types.
        //
View Full Code Here

        }
        CompilationUnit unit = findCompilationUnit(qname);
        if (unit != null) {
          branch.log(TreeLogger.SPAM, "Found type in compilation unit: "
              + unit.getDisplayLocation());
          ICompilationUnit icu = new CompilationUnitAdapter(unit);
          return new NameEnvironmentAnswer(icu, null);
        } else {
          ClassLoader classLoader = getClassLoader();
          URL resourceURL = classLoader.getResource(className.replace('.', '/')
              + ".class");
View Full Code Here

    private CompilationUtils() {}

    public static JavaCompilation compileSource(String source) {
        CompilerOptions options = getDefaultCompilerOptions();
        Parser parser = createCommentRecorderParser(options);
        ICompilationUnit cu = createCompilationunit(source, "");
        CompilationResult compilationResult = createDefaultCompilationResult(cu, options);
        return new JavaCompilation(parser.parse(cu, compilationResult), parser.scanner);
    }
View Full Code Here

        CompilationResult compilationResult = new CompilationResult(cu, 0, 0, options.maxProblemsPerUnit);
        return compilationResult;
    }

    private static ICompilationUnit createCompilationunit(String source, String filename) {
        ICompilationUnit cu = new CompilationUnit(source.toCharArray(), filename, null);
        return cu;
    }
View Full Code Here

     * @return the compilation of the file
     */
    public static JavaCompilation compileFile(String filename) {
        CompilerOptions options = getDefaultCompilerOptions();
        Parser parser = createCommentRecorderParser(options);
        ICompilationUnit cu = createCompilationunit(getContentOfFile(TEST_DATA_BASE_DIR + filename), filename);
        CompilationResult compilationResult = createDefaultCompilationResult(cu, options);
        return new JavaCompilation(parser.parse(cu, compilationResult), parser.scanner);
    }
View Full Code Here

     * @throws InvalidSyntaxException if the file has syntax errors.
     */
    public static JavaCompilation compile(String source, String fileName) {
        CompilerOptions options = getDefaultCompilerOptions();
        Parser parser = createCommentRecorderParser(options);
        ICompilationUnit cu = createCompilationUnit(source, fileName);
        CompilationResult compilationResult = createDefaultCompilationResult(cu, options);
        JavaCompilation javaCompilation = new JavaCompilation(parser.parse(cu, compilationResult), parser.scanner);
       
        if (compilationResult.hasSyntaxError) {
          throw new InvalidSyntaxException(new String(compilationResult.getFileName()), compilationResult.toString());
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.env.ICompilationUnit

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.