code: public static boolean injectionNeeded() {
          // first check whether we need to modify ObjectInputStream
          boolean debugEnabled = PreMainUtil.isDebugEnabled();
          InputStream is = String.class.getResourceAsStream("/java/io/ObjectInputStream.class");
          if (is == null) {
              if (debugEnabled) {
                  System.out.println("Could not locate /java/io/ObjectInputStream.class as a resource");
              }
          } else {
              try {
                  ClassReader cr = new ClassReader(is);
                  final Set<String> fieldsToLookFor = new HashSet<String>(asList(FACTORY_FIELD, VALIDATOR_FIELD));
                  if (debugEnabled) {
                      System.out.println("Searching ObjectInputStream.class bytes for fields: " + fieldsToLookFor);
                  }
                  cr.accept(new ClassVisitor(Opcodes.ASM7) {
                      @Override
                      public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
                          if (PreMainUtil.isDebugEnabled()) {
                              System.out.println("Found field '" + name + "' with description '" + desc + "'");
                          }
                          fieldsToLookFor.remove(name);
                          return null;
                      }
                  }, 0);
                  if (fieldsToLookFor.isEmpty()) {
                      if (debugEnabled) {
                          System.out.println("Found all fields already in ObjectInputStream.class");
                      }
                      return false;
                  }
              } catch (IOException e) {
                  if (debugEnabled) {
                      System.out.println("Could not read /java/io/ObjectInputStream.class as a resource");
                  }
              }
          }
          return true;
      }
docs: Some IBM JVMs already support this feature. This method will check for that support
  <em>without loading ObjectInputStream.class</em>.
  @return true iff the support was detected