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 { return classPool.get(fqName); } catch (NotFoundException e) { try { if (pac.endsWith("." + orgName)) return classPool.get(pac); } catch (NotFoundException e2) {} } } } getInvalidNames().put(orgName, INVALID); throw new CompileError("no such class: " + orgName); }
private CtClass searchImports(String orgName) throws CompileError { if (orgName.indexOf('.') < 0) { Iterator<String> it = classPool.getImportedPackages(); while (it.hasNext()) { String pac = it.next(); String fqName = pac.replaceAll("\\.$","") + "." + orgName; try { return classPool.get(fqName); } catch (NotFoundException e) { try { if (pac.endsWith("." + orgName)) return classPool.get(pac); } catch (NotFoundException e2) {} } } } getInvalidNames().put(orgName, INVALID); throw new CompileError("no such class: " + orgName); }
private void importPackageIfNeedBe(Class<?> rawClass, ClassPool defaultClassPool) { String packageName = rawClass.getPackage().getName(); Iterator importedPackages = defaultClassPool.getImportedPackages(); if (!Iterators.contains(importedPackages, packageName)) { defaultClassPool.importPackage(packageName); } } }
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 { return classPool.get(fqName); } catch (NotFoundException e) { try { if (pac.endsWith("." + orgName)) return classPool.get(pac); } catch (NotFoundException e2) {} } } } getInvalidNames().put(orgName, INVALID); throw new CompileError("no such class: " + orgName); }
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 { return classPool.get(fqName); } catch (NotFoundException e) { try { if (pac.endsWith("." + orgName)) return classPool.get(pac); } catch (NotFoundException e2) {} } } } getInvalidNames().put(orgName, INVALID); throw new CompileError("no such class: " + orgName); }
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 { return classPool.get(fqName); } catch (NotFoundException e) { try { if (pac.endsWith("." + orgName)) return classPool.get(pac); } catch (NotFoundException e2) {} } } } getInvalidNames().put(orgName, INVALID); throw new CompileError("no such class: " + orgName); }
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); }
Iterator it = classPool.getImportedPackages(); while (it.hasNext()) { String pac = (String)it.next();