Esempio n. 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;
   }
 }
Esempio n. 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);
  }
Esempio n. 3
0
 private CtClass lookupClass0(String classname, boolean notCheckInner) throws NotFoundException {
   CtClass cc = null;
   do {
     try {
       cc = classPool.get(classname);
     } catch (NotFoundException e) {
       int i = classname.lastIndexOf('.');
       if (notCheckInner || i < 0) throw e;
       else {
         StringBuffer sbuf = new StringBuffer(classname);
         sbuf.setCharAt(i, '$');
         classname = sbuf.toString();
       }
     }
   } while (cc == null);
   return cc;
 }