Package com.google.gwt.dev.javac

Examples of com.google.gwt.dev.javac.CompilationState


  private HorizontalAlignmentConstantParser parser;

  @Override
  public void setUp() throws Exception {
    super.setUp();
    CompilationState state = CompilationStateBuilder.buildFrom(TreeLogger.NULL,
        new CompilerContext(), UiJavaResources.getUiResources());
    TypeOracle types = state.getTypeOracle();
    parser = new HorizontalAlignmentConstantParser(new FieldReferenceConverter(
        null), types.parse(HHA + ".HorizontalAlignmentConstant"),
        MortalLogger.NULL);
  }
View Full Code Here


      CompilerContext.Builder compilerContextBuilder = new CompilerContext.Builder();
      CompilerContext compilerContext = compilerContextBuilder.build();
      ModuleDef module = ModuleDefLoader.loadFromClassPath(logger,
          compilerContext, Child.class.getPackage().getName() + ".Testing");
      compilerContext = compilerContextBuilder.module(module).build();
      CompilationState compilationState = module.getCompilationState(logger, compilerContext);
      TypeOracle typeOracle = compilationState.getTypeOracle();
      classType = typeOracle.findType(TEST_CLASS.getCanonicalName());
    } catch (UnableToCompleteException e) {
      throw new RuntimeException(e);
    }
    return new TypeOracleMessageInterface(new GwtLocaleFactoryImpl(),
View Full Code Here

  private TextAlignConstantParser parser;

  @Override
  public void setUp() throws Exception {
    super.setUp();
    CompilationState state = CompilationStateBuilder.buildFrom(
        TreeLogger.NULL, new CompilerContext(), UiJavaResources.getUiResources());
    TypeOracle types = state.getTypeOracle();
    parser = new TextAlignConstantParser(new FieldReferenceConverter(null),
        types.parse(TAC), MortalLogger.NULL);
  }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    comparator = new MostToLeastDerivedPlaceTypeComparator();

    TreeLogger logger = createCompileLogger();
    CompilationState state =
        CompilationStateBuilder.buildFrom(logger, new CompilerContext(), getJavaResources());
    typeOracle = state.getTypeOracle();

    place = typeOracle.getType("com.google.gwt.app.place.shared.Place");
    assertNotNull(place);
    place1 = typeOracle.getType("com.google.gwt.app.place.shared.testplaces.Place1");
    assertNotNull(place1);
View Full Code Here

  private UiBinderContext uiBinderCtx;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    CompilationState state = CompilationStateBuilder.buildFrom(
        createCompileLogger(), new CompilerContext(), getJavaResources());
    types = state.getTypeOracle();
    uiBinderCtx = new UiBinderContext();
    labelType = types.findType("com.google.gwt.user.client.ui.Label");
    buttonType = types.findType("com.google.gwt.user.client.ui.Button");
    clickEventType = types.findType("com.google.gwt.event.dom.client.ClickEvent");
    mouseOverEventType = types.findType("com.google.gwt.event.dom.client.MouseOverEvent");
View Full Code Here

      throws UnableToCompleteException {
    boolean gwtAstWasEnabled = GwtAstBuilder.ENABLED;
    try {
      GwtAstBuilder.ENABLED = true;
      long start = System.currentTimeMillis();
      final CompilationState compilationState = module.getCompilationState(logger);
      logger.log(TreeLogger.INFO, (System.currentTimeMillis() - start)
          + " time to get compilation state");
      return compilationState;
    } finally {
      GwtAstBuilder.ENABLED = gwtAstWasEnabled;
View Full Code Here

  }

  public boolean run(final TreeLogger logger) {
    try {
      ModuleDef module = ModuleDefLoader.loadFromClassPath(logger, options.getModuleNames().get(0));
      final CompilationState compilationState = buildGwtAst(logger, module);

      long start = System.currentTimeMillis();
      Map<String, JDeclaredType> compStateTypes = new HashMap<String, JDeclaredType>();
      for (CompilationUnit unit : compilationState.getCompilationUnits()) {
        for (JDeclaredType type : unit.getTypes()) {
          compStateTypes.put(type.getName(), type);
        }
      }
      logger.log(TreeLogger.INFO, (System.currentTimeMillis() - start) + " time to get all types");

      start = System.currentTimeMillis();
      JProgram jprogram = buildGenerateJavaAst(logger, module, compilationState);
      logger.log(TreeLogger.INFO, (System.currentTimeMillis() - start) + " time to build old AST");

      for (JDeclaredType genJavaAstType : jprogram.getDeclaredTypes()) {
        String typeName = genJavaAstType.getName();
        if ("com.google.gwt.core.client.JavaScriptObject".equals(typeName)) {
          // Known mismatch; genJavaAst version implements all JSO interfaces.
          continue;
        }
        JDeclaredType compStateType = compStateTypes.get(typeName);
        if (compStateType == null) {
          System.out.println("No matching prebuilt type for '" + typeName + "'");
        } else {
          String oldSource = genJavaAstType.toSource();
          String newSource = compStateType.toSource();
          if (!oldSource.equals(newSource)) {
            System.out.println("Mismatched output for '" + typeName + "'");
            System.out.println("GenerateJavaAST:");
            System.out.println(oldSource);
            System.out.println("GwtAstBuilder:");
            System.out.println(newSource);
          }
        }
      }

      return !compilationState.hasErrors();
    } catch (Throwable e) {
      logAndTranslateException(logger, e);
      return false;
    }
  }
View Full Code Here

  }

  public synchronized CompilationState getCompilationState(TreeLogger logger)
      throws UnableToCompleteException {
    doRefresh();
    CompilationState compilationState = CompilationStateBuilder.buildFrom(
        logger, lazySourceOracle.getResources());
    checkForSeedTypes(logger, compilationState);
    return compilationState;
  }
View Full Code Here

   */
  public static boolean validate(TreeLogger logger, JJSOptions jjsOptions, ModuleDef module,
      File genDir) {
    Event validateEvent = SpeedTracerLogger.start(CompilerEventType.VALIDATE);
    try {
      CompilationState compilationState = module.getCompilationState(logger);
      if (jjsOptions.isStrict() && compilationState.hasErrors()) {
        abortDueToStrictMode(logger);
      }
      String[] declEntryPts = module.getEntryPointTypeNames();
      String[] additionalRootTypes = null;
      if (declEntryPts.length == 0) {
        // No declared entry points, just validate all visible classes.
        Collection<CompilationUnit> compilationUnits = compilationState.getCompilationUnits();
        additionalRootTypes = new String[compilationUnits.size()];
        int i = 0;
        for (CompilationUnit unit : compilationUnits) {
          additionalRootTypes[i++] = unit.getTypeName();
        }
View Full Code Here

    // This initializes the Java2D library in a thread so that the main program
    // doesn't block when the library is accessed for the first time.
    new GraphicsInitThread().start();

    try {
      CompilationState compilationState = module.getCompilationState(logger);
      if (jjsOptions.isStrict() && compilationState.hasErrors()) {
        abortDueToStrictMode(logger);
      }

      List<String> initialTypeOracleTypes = new ArrayList<String>();
      if (jjsOptions.isCompilerMetricsEnabled()) {
        for (JClassType type : compilationState.getTypeOracle().getTypes()) {
          initialTypeOracleTypes.add(type.getPackage().getName() + "." + type.getName());
        }
      }

      // Track information about the module load including initial type
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.javac.CompilationState

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.