Exemplo n.º 1
0
  /** Find a type by name. */
  @Override
  public Named find(String name) throws SemanticException {
    if (Report.should_report(report_topics, 3)) Report.report(3, "MemberCR.find(" + name + ")");

    if (nocache.contains(name)) {
      throw new NoClassException(name);
    }

    Named n = ts.systemResolver().check(name);

    if (n != null) {
      return n;
    }

    SemanticException error = null;

    // First, just try the long name.
    try {
      if (Report.should_report(report_topics, 2))
        Report.report(2, "MCR: loading " + name + " from " + inner);
      return inner.find(name);
    } catch (SemanticException e) {
      if (Report.should_report(report_topics, 2)) Report.report(2, "MCR: " + e.getMessage());
      if (StringUtil.isNameShort(name)) {
        throw e;
      }
      error = e;
    }

    boolean install = true;

    // Now try the prefix of the name and look for a member class
    // within it named with the suffix.
    String prefix = StringUtil.getPackageComponent(name);
    String suffix = StringUtil.getShortNameComponent(name);

    // Try the full name of the prefix first, then the raw class name,
    // so that encoded type information and source files are preferred
    // to the raw class file.
    try {
      if (Report.should_report(report_topics, 2)) Report.report(2, "MCR: loading prefix " + prefix);

      n = find(prefix);

      // This may be called during deserialization; n's
      // member classes might not be initialized yet.
      if (n instanceof ParsedTypeObject) {
        return findMember(n, suffix);
      }
    } catch (SemanticException e) {
    }

    if (install) {
      nocache.add(name);
    }

    throw error;
  }
Exemplo n.º 2
0
 @Override
 public boolean packageExists(String name) {
   return inner.packageExists(name);
 }