Пример #1
0
 public void addPackages(Package pkg, GwtcServiceImpl gwtc, boolean recursive) {
   Iterable<ClassFile> iter;
   if (recursive) {
     iter = classpath.get().findClassesBelowPackage(pkg.getName());
   } else {
     iter = classpath.get().findClassesInPackage(pkg.getName());
   }
   for (ClassFile file : iter) {
     X_Log.info(getClass(), "Scanning file ", file);
     if ("package-info".equals(file.getEnclosedName())) {
       Package p = GwtReflect.getPackage(file.getPackage());
       if (!finishedPackages.contains(p)) {
         gwtcService.addPackage(p, false);
       }
     } else {
       try {
         Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass(file.getName());
         if (!finishedClasses.contains(cls)) {
           gwtc.addClass(cls);
         }
       } catch (ClassNotFoundException e) {
         X_Log.warn(getClass(), "Unable to load class ", file);
       }
     }
   }
 }
Пример #2
0
 private void scanPackage(Package pkg) {
   GwtcUnit data = nodes.get(pkg);
   if (data == null) {
     Object ancestor = findAncestor(pkg);
     if (ancestor != null) {
       addPackage((Package) ancestor);
     }
     return;
   } else if (data.gwtc == null) {
     return;
   }
   Gwtc gwtc = pkg.getAnnotation(Gwtc.class);
   addGwtcPackage(gwtc, pkg, false);
   X_Log.trace(getClass(), "Parent of ", pkg, "is", data.getParent());
   ClassLoader cl = Thread.currentThread().getContextClassLoader();
   for (ClassFile file : classpath.get().findClassesInPackage(pkg.getName())) {
     X_Log.trace(getClass(), "Checking class file ", file.getName());
     try {
       if (file.getEnclosedName().equals("package-info")) {
         X_Log.info(getClass(), "Loading package", file);
         Package p = GwtReflectJre.getPackage(file.getPackage(), cl);
         if (!finishedPackages.contains(p)) {
           gwtcService.addPackage(p, false);
         }
       } else {
         Class<?> clazz = cl.loadClass(file.getName());
         X_Log.trace(getClass(), "Loaded class", clazz);
         if (!finishedClasses.contains(clazz)) {
           X_Log.info(getClass(), "Adding class", clazz);
           gwtcService.addClass(clazz);
         }
       }
     } catch (Exception e) {
       X_Log.warn(getClass(), "Error encountered trying to load class ", file.getName(), e);
     }
   }
 }
Пример #3
0
 @Override
 public String toString() {
   return getFieldName() + " from " + owner.getName();
 }
Пример #4
0
 public String getSimpleName() {
   return owner.getSimpleName();
 }
Пример #5
0
 @Override
 public int hashCode() {
   return owner.getSimpleName().hashCode();
 }