@Test public void testUnknownTransformer() throws Exception { assertThat(LambdaFactory.release(classFileTransformer), is(false)); }
@SuppressWarnings("all") public static boolean release(ClassFileTransformer classFileTransformer) { try { @SuppressWarnings("unchecked") Map<ClassFileTransformer, ?> classFileTransformers = (Map<ClassFileTransformer, ?>) ClassLoader.getSystemClassLoader() .loadClass(LambdaFactory.class.getName()) .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { return classFileTransformers.remove(classFileTransformer) != null && classFileTransformers.isEmpty(); } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not release class file transformer", exception); } }
LambdaFactory { @SuppressWarnings("all") public static boolean release(ClassFileTransformer classFileTransformer) { try { @SuppressWarnings("unchecked") Map<ClassFileTransformer, ?> classFileTransformers = (Map<ClassFileTransformer, ?>) ClassLoader.getSystemClassLoader() .loadClass(LambdaFactory.class.getName()) .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { return classFileTransformers.remove(classFileTransformer) != null && classFileTransformers.isEmpty(); } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not release class file transformer", exception); } } }
LambdaFactory { @SuppressWarnings("all") public static boolean release(ClassFileTransformer classFileTransformer) { try { @SuppressWarnings("unchecked") Map<ClassFileTransformer, ?> classFileTransformers = (Map<ClassFileTransformer, ?>) ClassLoader.getSystemClassLoader() .loadClass(LambdaFactory.class.getName()) .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { return classFileTransformers.remove(classFileTransformer) != null && classFileTransformers.isEmpty(); } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not release class file transformer", exception); } } LambdaFactory(Object target, Method dispatcher); }
LambdaFactory { @SuppressWarnings("all") public static boolean release(ClassFileTransformer classFileTransformer) { try { @SuppressWarnings("unchecked") Map<ClassFileTransformer, ?> classFileTransformers = (Map<ClassFileTransformer, ?>) ClassLoader.getSystemClassLoader() .loadClass(LambdaFactory.class.getName()) .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { return classFileTransformers.remove(classFileTransformer) != null && classFileTransformers.isEmpty(); } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not release class file transformer", exception); } } LambdaFactory(Object target, Method dispatcher); @SuppressWarnings("all") static boolean register(ClassFileTransformer classFileTransformer, Object classFileFactory); @SuppressWarnings("all") static boolean release(ClassFileTransformer classFileTransformer); static byte[] make(Object caller,
                              String invokedName,
                              Object invokedType,
                              Object samMethodType,
                              Object implMethod,
                              Object instantiatedMethodType,
                              boolean serializable,
                              List<Class<?>> markerInterfaces,
                              List<?> additionalBridges); }
LambdaFactory { @SuppressWarnings("all") public static boolean release(ClassFileTransformer classFileTransformer) { try { @SuppressWarnings("unchecked") Map<ClassFileTransformer, ?> classFileTransformers = (Map<ClassFileTransformer, ?>) ClassLoader.getSystemClassLoader() .loadClass(LambdaFactory.class.getName()) .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { return classFileTransformers.remove(classFileTransformer) != null && classFileTransformers.isEmpty(); } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not release class file transformer", exception); } } LambdaFactory(Object target, Method dispatcher); @SuppressWarnings("all") static boolean register(ClassFileTransformer classFileTransformer, Object classFileFactory); @SuppressWarnings("all") static boolean release(ClassFileTransformer classFileTransformer); static byte[] make(Object caller,
                              String invokedName,
                              Object invokedType,
                              Object samMethodType,
                              Object implMethod,
                              Object instantiatedMethodType,
                              boolean serializable,
                              List<Class<?>> markerInterfaces,
                              List<?> additionalBridges); @SuppressFBWarnings(value = "MS_MUTABLE_COLLECTION_PKGPROTECT", justification = "The field must be accessible by different class loader instances")
    static final Map<ClassFileTransformer, LambdaFactory> CLASS_FILE_TRANSFORMERS; }