Package com.google.gwt.dev.javac

Examples of com.google.gwt.dev.javac.CompilationUnit$GeneratedClassnameFinder$AnonymousClassVisitor


        String className = qname;
        int pos = qname.indexOf('$');
        if (pos >= 0) {
          qname = qname.substring(0, pos);
        }
        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('.', '/')
View Full Code Here


    JClassType foundType = typeOracle.findType(typeName);
    if (foundType != null) {
      return null;
    }
    Map<String, CompilationUnit> unitMap = compilationState.getCompilationUnitMap();
    CompilationUnit unit = unitMap.get(typeName);
    String errMsg;
    if (unit == null) {
      errMsg = "The test class '" + typeName + "' was not found in module '" + moduleName
          + "'; no compilation unit for that type was seen";
    } else if (unit.isError()) {
      errMsg = "The test class '" + typeName + "' had compile errors; check log for details";
    } else {
      errMsg = "Unexpected error: the test class '" + typeName
          + "' appears to be valid, but no corresponding type was found in TypeOracle; please contact GWT support";
    }
View Full Code Here

    JClassType foundType = typeOracle.findType(typeName);
    if (foundType != null) {
      return null;
    }
    Map<String, CompilationUnit> unitMap = compilationState.getCompilationUnitMap();
    CompilationUnit unit = unitMap.get(typeName);
    String errMsg;
    if (unit == null) {
      errMsg = "The test class '" + typeName + "' was not found in module '" + moduleName
          + "'; no compilation unit for that type was seen";
    } else if (unit.isError()) {
      errMsg = "The test class '" + typeName + "' had compile errors; check log for details";
    } else {
      errMsg = "Unexpected error: the test class '" + typeName
          + "' appears to be valid, but no corresponding type was found in TypeOracle; please contact GWT support";
    }
View Full Code Here

    JClassType foundType = typeOracle.findType(typeName);
    if (foundType != null) {
      return null;
    }
    Map<String, CompilationUnit> unitMap = compilationState.getCompilationUnitMap();
    CompilationUnit unit = unitMap.get(typeName);
    String errMsg;
    if (unit == null) {
      errMsg = "The test class '" + typeName + "' was not found in module '" + moduleName
          + "'; no compilation unit for that type was seen";
    } else if (unit.isError()) {
      errMsg = "The test class '" + typeName + "' had compile errors; check log for details";
    } else {
      errMsg = "Unexpected error: the test class '" + typeName
          + "' appears to be valid, but no corresponding type was found in TypeOracle; please contact GWT support";
    }
View Full Code Here

    JClassType foundType = typeOracle.findType(typeName);
    if (foundType != null) {
      return null;
    }
    Map<String, CompilationUnit> unitMap = compilationState.getCompilationUnitMap();
    CompilationUnit unit = unitMap.get(typeName);
    String errMsg;
    if (unit == null) {
      errMsg = "The test class '" + typeName + "' was not found in module '"
          + moduleName + "'; no compilation unit for that type was seen";
    } else {
View Full Code Here

      // Then return it.
      return type;
    }

    // Otherwise load its compilation unit.
    CompilationUnit compilationUnit =
        compilerContext.getLibraryGroup().getCompilationUnitByTypeSourceName(typeSourceName);
    if (compilationUnit != null) {
      // Cache the compilation unit.
      compilerContext.getUnitCache().add(compilationUnit);
      // Transform the compilation unit into a type.
View Full Code Here

    zipLibraryWriter.setCompilationErrorsIndex(expectedCompilationErrorsIndex);
    zipLibraryWriter.write();

    // Read data back from disk.
    ZipLibrary zipLibrary = new ZipLibrary(zipFile.getPath());
    CompilationUnit barCompilationUnit =
        zipLibrary.getCompilationUnitByTypeSourceName(BAR.getTypeName());
    CompilationUnit superFooCompilationUnit =
        zipLibrary.getCompilationUnitByTypeSourceName(SUPER_FOO.getTypeName());

    // Compare it.
    assertEquals(expectedLibraryName, zipLibrary.getLibraryName());
    assertEquals(expectedResourceContents,
        Util.readStreamAsString(zipLibrary.getPublicResourceByPath("index.html").openContents()));
    assertEquals(expectedDependencyLibraryNames, zipLibrary.getDependencyLibraryNames());

    // CompilationUnit
    List<JDeclaredType> barTypes = barCompilationUnit.getTypes();
    assertEquals(1, barTypes.size());
    assertEquals(BAR.getTypeName(), barTypes.get(0).getName());
    assertEquals(BAR.getLocation(), barCompilationUnit.getResourceLocation());
    assertEquals(BAR.getTypeName(), barCompilationUnit.getTypeName());

    // SuperSourceCompilationUnit
    List<JDeclaredType> superFoo = superFooCompilationUnit.getTypes();
    assertEquals(1, superFoo.size());
    assertEquals(SUPER_FOO.getTypeName(), superFoo.get(0).getName());
    assertEquals(SUPER_FOO.getLocation(), superFooCompilationUnit.getResourceLocation());
    assertEquals(SUPER_FOO.getTypeName(), superFooCompilationUnit.getTypeName());

    // Can find inner classes by source name.
    assertTrue(zipLibrary.getNestedSourceNamesByCompilationUnitName().get(
        JdtCompilerTest.OUTER_INNER.getTypeName()).contains(
        JdtCompilerTest.OUTER_INNER.getTypeName() + ".Inner"));
View Full Code Here

    if (foundType != null) {
      return null;
    }
    Map<String, CompilationUnit> unitMap = currentModule.getCompilationState(
        logger).getCompilationUnitMap();
    CompilationUnit unit = unitMap.get(typeName);
    String errMsg;
    if (unit == null) {
      errMsg = "The test class '" + typeName + "' was not found in module '"
          + moduleName + "'; no compilation unit for that type was seen";
    } else if (unit.isError()) {
      errMsg = "The test class '" + typeName
          + "' had compile errors; check log for details";
    } else if (!unit.isCompiled()) {
      errMsg = "The test class '"
          + typeName
          + "' depends on a unit that had compile errors; check log for details";
    } else {
      errMsg = "Unexpected error: the test class '"
View Full Code Here

  }

  protected CompilationUnit findCompilationUnit(String qname) {
    // Build the initial set of compilation units.
    Map<String, CompilationUnit> unitMap = compilationState.getCompilationUnitMap();
    CompilationUnit unit = unitMap.get(qname);
    while (unit == null) {
      int pos = qname.lastIndexOf('.');
      if (pos < 0) {
        return null;
      }
View Full Code Here

        // Recheck the cache for the outer type.
        if (nameEnvironmentAnswerForTypeName.containsKey(qname)) {
          return (nameEnvironmentAnswerForTypeName.get(qname));
        }
      }
      CompilationUnit unit = findCompilationUnit(qname);
      if (unit != null) {
        logger.log(TreeLogger.SPAM, "Found type in compilation unit: "
            + unit.getDisplayLocation());
        ICompilationUnit icu = new CompilationUnitAdapter(unit);
        NameEnvironmentAnswer out = new NameEnvironmentAnswer(icu, null);
        nameEnvironmentAnswerForTypeName.put(qname, out);
        return out;
      } else {
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.javac.CompilationUnit$GeneratedClassnameFinder$AnonymousClassVisitor

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.