Example usage for com.google.gwt.core.ext TreeLogger WARN

List of usage examples for com.google.gwt.core.ext TreeLogger WARN

Introduction

In this page you can find the example usage for com.google.gwt.core.ext TreeLogger WARN.

Prototype

Type WARN

To view the source code for com.google.gwt.core.ext TreeLogger WARN.

Click Source Link

Document

Logs a warning.

Usage

From source file:com.arcbees.chosen.rebind.Logger.java

License:Apache License

public void warn(String message, Object... params) {
    internalLog(TreeLogger.WARN, String.format(message, params));
}

From source file:com.dom_distiller.client.JsTestEntryGenerator.java

License:Open Source License

public static List<TestCase> getTestCases(TreeLogger logger, GeneratorContext context)
        throws UnableToCompleteException {
    if (DEBUG)/*ww  w  .ja v a 2s . c o  m*/
        logger = logger.branch(TreeLogger.WARN, "Getting test cases", null, null);
    TypeOracle oracle = context.getTypeOracle();
    JClassType jsTestCaseClass = oracle.findType(JsTestCase.class.getName());

    List<TestCase> testCases = new ArrayList<TestCase>();

    for (JClassType classType : oracle.getTypes()) {
        if (classType.equals(jsTestCaseClass) || !classType.isAssignableTo(jsTestCaseClass)) {
            continue;
        }

        if (classType.getEnclosingType() != null) {
            if (DEBUG)
                logger.log(TreeLogger.WARN, "Skipping nested class: " + classType.getEnclosingType().getName()
                        + "." + classType.getName());
            continue;
        }

        if (DEBUG)
            logger.log(TreeLogger.WARN, "Found class: " + classType.getName());
        testCases.add(new TestCase(classType, findTests(logger, context, classType)));
    }
    return testCases;
}

From source file:com.dom_distiller.client.JsTestEntryGenerator.java

License:Open Source License

public static List<JMethod> findTests(TreeLogger logger, GeneratorContext context, JClassType classType)
        throws UnableToCompleteException {
    if (DEBUG)/*  w w  w .  j a  va  2 s .  c o m*/
        logger = logger.branch(TreeLogger.WARN, "Finding tests for class: " + classType.getName());

    List<JMethod> tests = new ArrayList<JMethod>();
    for (JMethod method : classType.getMethods()) {
        if (method.getName().startsWith("test")) {
            if (DEBUG)
                logger.log(TreeLogger.WARN, "Found test: " + method.getName());
            verifyTestSignature(logger, classType, method);
            tests.add(method);
        }
    }
    return tests;
}

From source file:com.emitrom.ti4j.mobile.hybrid.linker.TiMobileHybridLinker.java

License:Apache License

public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts)
        throws UnableToCompleteException {

    ArtifactSet toReturn = new ArtifactSet(artifacts);
    DefaultTextOutput out = new DefaultTextOutput(true);
    long compilationTime = System.currentTimeMillis();
    out.print("(function(){");
    out.newline();//w w w  .java  2s .  co m

    // get compilation result
    Set<CompilationResult> results = artifacts.find(CompilationResult.class);
    if (results.size() == 0) {
        logger.log(TreeLogger.WARN, "Requested 0 permutations");
        return toReturn;
    }

    CompilationResult result = results.iterator().next();

    // get the generated javascript
    String[] javaScript = result.getJavaScript();
    out.print("var $wnd;var $doc;");
    out.print("var $moduleName, $moduleBase;");
    out.newline();
    out.print("if(typeof(window) != 'undefined'){ $wnd = window;  $doc = $wnd.document; }");
    out.newline();
    out.print("var $gwt_version = \"" + About.getGwtVersionNum() + "\";");
    out.newlineOpt();
    out.print(javaScript[0]);
    out.newline();
    out.print("var $stats = function(){};");
    out.newline();
    out.print("var $sessionId = function(){};");
    out.newline();
    out.print("var navigator = {};");
    out.newline();
    out.print("navigator.userAgent = 'timobile';");
    out.newline();
    out.print("$strongName = '" + result.getStrongName() + "';");
    out.newline();
    out.print("$ti4jCompilationDate = " + compilationTime + ";");
    out.newline();
    out.print("gwtOnLoad(null,'" + context.getModuleName() + "',null);");
    out.newline();
    out.print("})();");
    out.newline();

    toReturn.add(emitString(logger, out.toString(), context.getModuleName() + ".js"));
    // toReturn.add(emitString(logger, Long.toString(compilationTime),
    // APP_COMPILATION_FILE_NAME));

    return toReturn;
}

From source file:com.github.nmorel.gwtjackson.rebind.RebindConfiguration.java

License:Apache License

/**
 * @param clazz class to find the type//from  w  w w. j  a va  2s .  c  om
 *
 * @return the {@link JType} denoted by the class given in parameter
 */

private JType findType(Class<?> clazz) {
    if (clazz.isPrimitive()) {

        return JPrimitiveType.parse(clazz.getCanonicalName());

    } else if (clazz.isArray()) {

        try {
            return context.getTypeOracle().parse(clazz.getCanonicalName());
        } catch (TypeOracleException e) {
            logger.log(TreeLogger.WARN,
                    "Cannot find the array denoted by the class " + clazz.getCanonicalName());
            return null;
        }

    } else {
        return findClassType(clazz);
    }
}

From source file:com.google.code.gwt.appcache.rebind.ApplicationCacheNetworkSectionGenerator.java

License:Apache License

/**
 * Invokes the deferred binding rule(s) in the specified module to the
 * specified typeName./* w  w  w.java 2  s . c  o m*/
 * 
 * @param module the module (which is already inherited!) to use as 'parent'
 *          module
 * @param logger
 * @param context
 * @param typeName the name of the type to rebind
 * @throws UnableToCompleteException if the module can't provide a substitute
 * @return the rebound typeName, or <code>null</code> if no binding took place
 */
private String rebindTypeByInheritedModule(String module, TreeLogger logger, GeneratorContext context,
        String typeName) throws UnableToCompleteException {
    ModuleDef rpcModule = ModuleDefLoader.loadFromClassPath(logger, module);
    Iterator<Rule> iter = rpcModule.getRules().iterator();
    while (iter.hasNext()) {
        Rule r = iter.next();
        if (r.isApplicable(logger, context, typeName)) {
            logger.log(TreeLogger.DEBUG, "The inherited module " + module + " found a rebinder for type "
                    + typeName + " by rule " + r);
            return r.realize(logger, context, typeName);
        }
    }
    logger.log(TreeLogger.WARN, "The inherit module rebinder did not rebind anything for type " + typeName
            + " in inherited module " + module);
    return null;
}

From source file:com.google.code.gwt.database.rebind.ServiceMethodCreator.java

License:Apache License

/**
 * Generates an iterating <code>tx.executeSql(...);</code> call statement.
 * /*ww w.  j ava2s .  c o  m*/
 * @throws UnableToCompleteException
 */
protected void generateExecuteIteratedSqlStatements() throws UnableToCompleteException {
    if (StringUtils.isNotEmpty(foreach)) {
        // Generate code to loop over a collection to create a tx.executeSql()
        // call for each item.

        // Ensure no parameters are specified on the service method named '_':
        if (!"_".equals(GeneratorUtils.getVariableName("_", service.getParameters()))) {
            logger.log(TreeLogger.ERROR, "The service method cannot apply a parameter named '_' when "
                    + "the 'foreach' attribute is also specified on the @Update " + "annotation");
            throw new UnableToCompleteException();
        }

        // Find the types, parameters, assert not-nulls, etc.:
        JType collection = GeneratorUtils.findType(foreach, service.getParameters());
        String forEachType = null;
        if (collection == null) {
            logger.log(TreeLogger.WARN, "no parameter on the service method named '" + foreach
                    + "' found. Using Object as the type for the loop variable '_'");
        } else if (collection.isParameterized() != null) {
            forEachType = genUtils.getTypeParameter(collection);
        } else if (collection.isArray() != null) {
            forEachType = genUtils.getClassName(collection.isArray().getComponentType());
        }
        if (forEachType == null) {
            forEachType = "Object";
        }

        sw.println("for (" + forEachType + " _ : " + foreach + ") {");
        sw.indent();
        generateExecuteSqlStatement();
        sw.outdent();
        sw.println("}");
    }
}

From source file:com.google.gwt.dev.typeinfo.test.InteractiveTypeOracle.java

License:Apache License

public boolean processCommand(TreeLogger logger, String[] tokens) {
    if (tokens.length == 0) {
        logger.log(TreeLogger.WARN, "Expecting a command", null);
        return false;
    }/* w  w w.j a  va  2 s.  co m*/

    CommandHandler handler = handlers.get(tokens[0]);
    if (handler == null) {
        logger.log(TreeLogger.WARN, "Unknown command: " + tokens[0], null);
        cmdHelp.process(logger, new String[0]);
        return false;
    }

    if (currType == null && handler.requiresCurrentType()) {
        logger.log(TreeLogger.WARN, "This command requires a current type to be selected", null);
        return false;
    }

    String[] args = new String[tokens.length - 1];
    System.arraycopy(tokens, 1, args, 0, args.length);
    return handler.process(logger, args);
}

From source file:com.googlecode.mgwt.useragent.rebind.UserAgentAsserterGenerator.java

License:Apache License

@Override
public String generate(TreeLogger logger, GeneratorContext context, String typeName)
        throws UnableToCompleteException {
    try {/*from w  w w  .ja v a  2  s.c om*/
        ConfigurationProperty property = context.getPropertyOracle()
                .getConfigurationProperty(PROPERTY_USER_AGENT_RUNTIME_WARNING);
        if (Boolean.valueOf(property.getValues().get(0)) == false) {
            return USER_AGENT_ASSERTER_DISABLED;
        }
    } catch (BadPropertyValueException e) {
        logger.log(TreeLogger.WARN, "Unable to find value for '" + PROPERTY_USER_AGENT_RUNTIME_WARNING + "'",
                e);
    }
    return USER_AGENT_ASSERTER;
}

From source file:com.googlecode.mgwt.useragent.rebind.UserAgentPropertyGenerator.java

License:Apache License

private static void assertUserAgents(TreeLogger logger, SortedSet<String> possibleValues) {
    HashSet<String> unknownValues = new HashSet<String>(possibleValues);
    unknownValues.removeAll(UserAgent.getKnownAgents());
    if (!unknownValues.isEmpty()) {
        logger.log(TreeLogger.WARN,
                "Unrecognized user.agent" + " values " + unknownValues
                        + ", possibly due to UserAgent.gwt.xml and "
                        + UserAgentPropertyGenerator.class.getName() + " being out of sync.");
    }//  w w w  .  jav a2s.com
}