public static void defrostClassIfExists(AOPClassPool pool, String className) { // In some cases we get a class frozen exception. I guess if the invocation class // existed, method was unwrapped and the wrapped again CtClass existing = pool.getCached(className); if (existing != null) { existing.defrost(); } }