Beispiel #1
0
 byte[] nullAdaptClass(final InputStream is, final String name) throws Exception {
   if (c != null) {
     p.removeClass(c);
   }
   c = p.loadClass(is);
   BCField[] fields = c.getDeclaredFields();
   BCMethod[] methods = c.getDeclaredMethods();
   for (int i = 0; i < methods.length; ++i) {
     Code code = methods[i].getCode(false);
     if (code != null) {
       while (code.hasNext()) {
         Instruction ins = code.next();
       }
       if (compute) {
         code.calculateMaxStack();
         code.calculateMaxLocals();
       }
     }
   }
   return c.toByteArray();
 }
 static BCClass nullSERPAdapt(Project p, BCClass c, final byte[] b) throws Exception {
   if (c != null) {
     p.removeClass(c);
   }
   c = p.loadClass(new ByteArrayInputStream(b));
   c.getDeclaredFields();
   BCMethod[] methods = c.getDeclaredMethods();
   for (int i = 0; i < methods.length; ++i) {
     Code code = methods[i].getCode(false);
     if (code != null) {
       while (code.hasNext()) {
         code.next();
       }
       if (compute) {
         code.calculateMaxStack();
         code.calculateMaxLocals();
       }
     }
   }
   c.toByteArray();
   return c;
 }