Пример #1
0
 private boolean isApplicableClass(ClassEditor ce, BloatLoaderContext loaderContext) {
   ClassEditor curEditor = ce;
   try {
     while (curEditor != null && !isApplicablePlatformClass(curEditor)) {
       if (BloatUtil.isPlatformClassName(BloatUtil.normalizeClassName(curEditor.type()))) {
         return false;
       }
       curEditor = loaderContext.classEditor(curEditor.superclass());
     }
   } catch (ClassNotFoundException exc) {
     return false;
   }
   return true;
 }
Пример #2
0
 public InstrumentationStatus enhance(
     ClassEditor ce, ClassLoader origLoader, BloatLoaderContext loaderContext) {
   try {
     if (ce.isInterface()) {
       return InstrumentationStatus.FAILED;
     }
     if (BloatUtil.extendsInHierarchy(ce, Enum.class, loaderContext)) {
       return InstrumentationStatus.FAILED;
     }
     if (!isApplicableClass(ce, loaderContext)) {
       return InstrumentationStatus.FAILED;
     }
   } catch (ClassNotFoundException e) {
     return InstrumentationStatus.FAILED;
   }
   return InstrumentationStatus.NOT_INSTRUMENTED;
 }
Пример #3
0
 private boolean isApplicablePlatformClass(ClassEditor ce) {
   String className = BloatUtil.normalizeClassName(ce.name());
   return Enum.class.getName().equals(className)
       || isSupportedCollection(className)
       || Object.class.getName().equals(className);
 }