public CtClass[] getInterfaces() throws NotFoundException { if (interfaces == null) { Class[] intfs = Object[].class.getInterfaces(); // java.lang.Cloneable and java.io.Serializable. // If the JVM is CLDC, intfs is empty. interfaces = new CtClass[intfs.length]; for (int i = 0; i < intfs.length; i++) interfaces[i] = pool.get(intfs[i].getName()); } return interfaces; }
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; }
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); }
public CtClass getSuperclass() throws NotFoundException { return pool.get(javaLangObject); }
public CtClass getComponentType() throws NotFoundException { String name = getName(); return pool.get(name.substring(0, name.length() - 2)); }