Package com.google.gwt.core.ext

Examples of com.google.gwt.core.ext.Generator


      Class<? extends Generator> generatorClass, String typeName)
      throws UnableToCompleteException {
    String msg = "Invoking " + toString();
    logger = logger.branch(TreeLogger.DEBUG, msg, null);

    Generator generator = generators.get(generatorClass);
    if (generator == null) {
      try {
        generator = generatorClass.newInstance();
        generators.put(generatorClass, generator);
      } catch (Throwable e) {
        logger.log(TreeLogger.ERROR,
            "Unexpected error trying to instantiate Generator '"
                + generatorClass.getName() + "'", e);
        throw new UnableToCompleteException();
      }
    }

    setCurrentGenerator(generatorClass);

    long before = System.currentTimeMillis();
    PerfLogger.start("Generator '" + generator.getClass().getName()
        + "' produced '" + typeName + "'");
    try {
      String className = generator.generate(logger, this, typeName);
      long after = System.currentTimeMillis();
      if (className == null) {
        msg = "Generator returned null, so the requested type will be used as is";
      } else {
        msg = "Generator returned class '" + className + "'";
View Full Code Here


      Class<? extends Generator> generatorClass, String typeName)
      throws UnableToCompleteException {
    String msg = "Invoking generator " + generatorClass.getName();
    logger = logger.branch(TreeLogger.DEBUG, msg, null);

    Generator generator = generators.get(generatorClass);
    if (generator == null) {
      try {
        generator = generatorClass.newInstance();
        generators.put(generatorClass, generator);
      } catch (Throwable e) {
        logger.log(TreeLogger.ERROR,
            "Unexpected error trying to instantiate Generator '"
                + generatorClass.getName() + "'", e);
        throw new UnableToCompleteException();
      }
    }

    setCurrentGenerator(generatorClass);

    long before = System.currentTimeMillis();
    PerfLogger.start("Generator '" + generator.getClass().getName()
        + "' produced '" + typeName + "'");
    try {
      String className = generator.generate(logger, this, typeName);
      long after = System.currentTimeMillis();
      if (className == null) {
        msg = "Generator returned null, so the requested type will be used as is";
      } else {
        msg = "Generator returned class '" + className + "'";
View Full Code Here

  public RebindResult runGeneratorIncrementally(TreeLogger logger,
      Class<? extends Generator> generatorClass, String typeName) throws UnableToCompleteException {
    String msg = "Invoking generator " + generatorClass.getName();
    logger = logger.branch(TreeLogger.DEBUG, msg, null);

    Generator generator = generators.get(generatorClass);
    if (generator == null) {
      try {
        generator = generatorClass.newInstance();
        generators.put(generatorClass, generator);
      } catch (Throwable e) {
        logger.log(TreeLogger.ERROR, "Unexpected error trying to instantiate Generator '"
            + generatorClass.getName() + "'", e);
        throw new UnableToCompleteException();
      }
    }

    setCurrentGenerator(generatorClass);

    // Avoid call to System.currentTimeMillis() if not logging DEBUG level
    boolean loggable = logger.isLoggable(TreeLogger.DEBUG);
    long before = loggable ? System.currentTimeMillis() : 0L;

    String generatorClassName = generator.getClass().getName();
    CompilerEventType type = eventsByGeneratorType.get(generatorClassName);

    if (type == null) {
      type = CompilerEventType.GENERATOR_OTHER;
    }

    Event generatorEvent =
        SpeedTracerLogger.start(type, "class", generatorClassName, "type", typeName);

    PropertyOracle originalPropertyOracle = propertyOracle;
    try {
      RebindResult result;
      // TODO(stalcup): refactor the Generator/PropertyOracle system (in a potentially backwards
      // incompatible way) so that all Generators are forced to accurately declare the names of
      // properties they care about.
      propertyOracle = new SubsetFilteringPropertyOracle(
          RuleGenerateWith.getAccessedPropertyNames(generator.getClass()), originalPropertyOracle,
          generatorClassName + "'s RunsLocal annotation may need to be updated.");
      if (generator instanceof IncrementalGenerator) {
        IncrementalGenerator incGenerator = (IncrementalGenerator) generator;

        // check version id for any previously cached rebind result
View Full Code Here

      Class<? extends Generator> generatorClass, String typeName)
      throws UnableToCompleteException {
    String msg = "Invoking generator " + generatorClass.getName();
    logger = logger.branch(TreeLogger.DEBUG, msg, null);

    Generator generator = generators.get(generatorClass);
    if (generator == null) {
      try {
        generator = generatorClass.newInstance();
        generators.put(generatorClass, generator);
      } catch (Throwable e) {
        logger.log(TreeLogger.ERROR,
            "Unexpected error trying to instantiate Generator '"
                + generatorClass.getName() + "'", e);
        throw new UnableToCompleteException();
      }
    }

    setCurrentGenerator(generatorClass);

    long before = System.currentTimeMillis();
    String generatorClassName = generator.getClass().getName();
    CompilerEventType type = eventsByGeneratorType.get(generatorClassName);

    if (type == null) {
      type = CompilerEventType.GENERATOR_OTHER;
    }
View Full Code Here

  public RebindResult runGeneratorIncrementally(TreeLogger logger,
      Class<? extends Generator> generatorClass, String typeName) throws UnableToCompleteException {
    String msg = "Invoking generator " + generatorClass.getName();
    logger = logger.branch(TreeLogger.DEBUG, msg, null);

    Generator generator = generators.get(generatorClass);
    if (generator == null) {
      try {
        generator = generatorClass.newInstance();
        generators.put(generatorClass, generator);
      } catch (Throwable e) {
        logger.log(TreeLogger.ERROR, "Unexpected error trying to instantiate Generator '"
            + generatorClass.getName() + "'", e);
        throw new UnableToCompleteException();
      }
    }

    setCurrentGenerator(generatorClass);

    // Avoid call to System.currentTimeMillis() if not logging DEBUG level
    boolean loggable = logger.isLoggable(TreeLogger.DEBUG);
    long before = loggable ? System.currentTimeMillis() : 0L;

    String generatorClassName = generator.getClass().getName();
    CompilerEventType type = eventsByGeneratorType.get(generatorClassName);

    if (type == null) {
      type = CompilerEventType.GENERATOR_OTHER;
    }

    Event generatorEvent =
        SpeedTracerLogger.start(type, "class", generatorClassName, "type", typeName);

    PropertyOracle originalPropertyOracle = propertyOracle;
    try {
      RebindResult result;
      // TODO(stalcup): refactor the Generator/PropertyOracle system (in a potentially backwards
      // incompatible way) so that all Generators are forced to accurately declare the names of
      // properties they care about.
      propertyOracle = new SubsetFilteringPropertyOracle(
          RuleGenerateWith.getAccessedPropertyNames(generator.getClass()), originalPropertyOracle,
          generatorClassName + "'s RunsLocal annotation may need to be updated.");
      if (generator instanceof IncrementalGenerator) {
        IncrementalGenerator incGenerator = (IncrementalGenerator) generator;

        // check version id for any previously cached rebind result
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.Generator

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.