Package org.eclipse.jdt.internal.compiler

Examples of org.eclipse.jdt.internal.compiler.Compiler


            new ICompilationUnit[classNames.length];
        for (int i = 0; i < compilationUnits.length; i++) {
            String className = classNames[i];
            compilationUnits[i] = new CompilationUnit(fileNames[i], className);
        }
        Compiler compiler = new Compiler(env,
                                         policy,
                                         settings,
                                         requestor,
                                         problemFactory);
        compiler.compile(compilationUnits);

        if (!ctxt.keepGenerated()) {
            File javaFile = new File(ctxt.getServletJavaFileName());
            javaFile.delete();
        }
View Full Code Here


    }
  }

  // Compile compilation unit
  CompilerRequestor compilerRequestor = new CompilerRequestor();
  Compiler compiler = getCompiler(compilerRequestor);
  compiler.compile(new ICompilationUnit[] {new ICompilationUnit() {
    public char[] getFileName() {
       // Name of class is name of CU
      return CharOperation.concat(Evaluator.this.getClassName(), Util.defaultJavaExtension().toCharArray());
    }
    public char[] getContents() {
View Full Code Here

*/
Compiler getCompiler(ICompilerRequestor compilerRequestor) {
  CompilerOptions compilerOptions = new CompilerOptions(this.options);
  compilerOptions.performMethodsFullRecovery = true;
  compilerOptions.performStatementsRecovery = true;
  return new Compiler(
    this.environment,
    DefaultErrorHandlingPolicies.exitAfterAllProblems(),
    compilerOptions,
    compilerRequestor,
    this.problemFactory);
View Full Code Here

  // called once when the builder is initialized... can override if needed
  CompilerOptions compilerOptions = new CompilerOptions(projectOptions);
  compilerOptions.performMethodsFullRecovery = true;
  compilerOptions.performStatementsRecovery = true;
  Compiler newCompiler = new Compiler(
    this.nameEnvironment,
    DefaultErrorHandlingPolicies.proceedWithAllProblems(),
    compilerOptions,
    this,
    ProblemFactory.getProblemFactory(Locale.getDefault()));
View Full Code Here

  FileSystem environment = getLibraryAccess();
  this.compilerOptions = new CompilerOptions(this.options);
  this.compilerOptions.performMethodsFullRecovery = false;
  this.compilerOptions.performStatementsRecovery = false;
  this.batchCompiler =
    new Compiler(
      environment,
      getHandlingPolicy(),
      this.compilerOptions,
      getBatchRequestor(),
      getProblemFactory(),
View Full Code Here

                    }
                }
            }
        };

        final Compiler compiler = new Compiler(nameEnvironment, policy, settingsMap, compilerRequestor, problemFactory, false);

        compiler.compile(compilationUnits);

        final CompilationProblem[] result = new CompilationProblem[problems.size()];
        problems.toArray(result);
        return new org.drools.commons.jci.compilers.CompilationResult(result);
    }
View Full Code Here

        List<CompilerError> compilerErrors = new ArrayList<CompilerError>();
        INameEnvironment nameEnvironment =
            new ClassLoaderNameEnvironment(classLoader, configuration.getSourceLocations());
        ICompilerRequestor requestor =
            new CompilerRequestor(configuration.getOutputLocation(), configuration.isShowWarnings(), compilerErrors);
        Compiler compiler =
            new Compiler(nameEnvironment, proceedWithAllProblems(), new CompilerOptions(settings), requestor,
                         new DefaultProblemFactory(Locale.getDefault()));

        // Create compilation units for the source files
        List<FileCompilationUnit> compilationUnits = new ArrayList<FileCompilationUnit>();

        // Go over the input source locations
        List<String> sourceLocations = (List<String>)configuration.getSourceLocations();
        for (String sourceLocation : sourceLocations) {

            // Exclude nested source locations
            List<String> excludeLocations = new ArrayList<String>();
            for (String nestedLocation : sourceLocations) {
                if (nestedLocation != sourceLocation && nestedLocation.startsWith(sourceLocation)) {
                    excludeLocations.add(nestedLocation);
                }
            }

            // List source files in each source location
            for (String sourceFile : (Set<String>)getSourceFilesForSourceRoot(configuration, sourceLocation)) {

                // Exclude files from excluded nested locations
                boolean excluded = false;
                for (String excludeLocation : excludeLocations) {
                    if (sourceFile.startsWith(excludeLocation)) {
                        excluded = true;
                    }
                }
                if (!excluded) {

                    // Create a compilation unit for the source file
                    FileCompilationUnit compilationUnit =
                        new FileCompilationUnit(sourceFile, makeClassName(sourceFile, sourceLocation));
                    compilationUnits.add(compilationUnit);
                }
            }
        }

        // Compile all the compilation units
        getLogger().info("Compiling " + compilationUnits.size() + " to " + configuration.getOutputLocation());
        compiler.compile((ICompilationUnit[])compilationUnits.toArray(new ICompilationUnit[compilationUnits.size()]));

        // getLogger().info(configuration.getCustomCompilerArguments().toString());
        boolean osgi = "true".equals(configuration.getCustomCompilerArguments().get("-osgi"));
        File proj = new File(configuration.getOutputLocation());
View Full Code Here

                    }
                }
            }
        };

        final Compiler compiler = new Compiler(nameEnvironment, policy, settingsMap, compilerRequestor, problemFactory, false);

        compiler.compile(compilationUnits);

        final CompilationProblem[] result = new CompilationProblem[problems.size()];
        problems.toArray(result);
        return new org.drools.compiler.commons.jci.compilers.CompilationResult(result);
    }
View Full Code Here

        };

        /**
         * The JDT compiler
         */
        Compiler jdtCompiler = new Compiler(nameEnvironment, policy, settings, compilerRequestor, problemFactory) {

            @Override
            protected void handleInternalException(Throwable e, CompilationUnitDeclaration ud, CompilationResult result) {
            }
        };

        // Go !
        jdtCompiler.compile(compilationUnits);

    }
View Full Code Here

            new ICompilationUnit[classNames.length];
        for (int i = 0; i < compilationUnits.length; i++) {
            String className = classNames[i];
            compilationUnits[i] = new CompilationUnit(fileNames[i], className);
        }
        Compiler compiler = new Compiler(env,
                                         policy,
                                         settings,
                                         requestor,
                                         problemFactory,
                                         true);
        compiler.compile(compilationUnits);

        if (!ctxt.keepGenerated()) {
            File javaFile = new File(ctxt.getServletJavaFileName());
            javaFile.delete();
        }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.Compiler

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.