예제 #1
0
 /** @param jvmClassName a class name. Not a package name. */
 public void recordPackage(String jvmClassName) {
   String classname = jvmToJavaName(jvmClassName);
   for (; ; ) {
     int i = classname.lastIndexOf('.');
     if (i > 0) {
       classname = classname.substring(0, i);
       classPool.recordInvalidClassName(classname);
     } else break;
   }
 }
예제 #2
0
  private CtClass searchImports(String orgName) throws CompileError {
    if (orgName.indexOf('.') < 0) {
      Iterator it = classPool.getImportedPackages();
      while (it.hasNext()) {
        String pac = (String) it.next();
        String fqName = pac + '.' + orgName;
        try {
          CtClass cc = classPool.get(fqName);
          // if the class is found,
          classPool.recordInvalidClassName(orgName);
          return cc;
        } catch (NotFoundException e) {
          classPool.recordInvalidClassName(fqName);
        }
      }
    }

    throw new CompileError("no such class: " + orgName);
  }