@Test(expected = IllegalStateException.class) public void testIllegalTransformer() throws Exception { LambdaFactory.register(classFileTransformer, new Object()); }
@SuppressWarnings("all") public static boolean register(ClassFileTransformer classFileTransformer, Object classFileFactory) { try { TypeDescription typeDescription = TypeDescription.ForLoadedType.of(LambdaFactory.class); Class<?> lambdaFactory = ClassInjector.UsingReflection.ofSystemClassLoader() .inject(Collections.singletonMap(typeDescription, ClassFileLocator.ForClassLoader.read(LambdaFactory.class))) .get(typeDescription); @SuppressWarnings("unchecked") Map<ClassFileTransformer, Object> classFileTransformers = (Map<ClassFileTransformer, Object>) lambdaFactory .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { try { return classFileTransformers.isEmpty(); } finally { classFileTransformers.put(classFileTransformer, lambdaFactory .getConstructor(Object.class, Method.class) .newInstance(classFileFactory, classFileFactory.getClass().getMethod("make", Object.class, String.class, Object.class, Object.class, Object.class, Object.class, boolean.class, List.class, List.class, Collection.class))); } } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not register class file transformer", exception); } }
LambdaFactory { @SuppressWarnings("all") public static boolean register(ClassFileTransformer classFileTransformer, Object classFileFactory) { try { TypeDescription typeDescription = TypeDescription.ForLoadedType.of(LambdaFactory.class); Class<?> lambdaFactory = ClassInjector.UsingReflection.ofSystemClassLoader() .inject(Collections.singletonMap(typeDescription, ClassFileLocator.ForClassLoader.read(LambdaFactory.class))) .get(typeDescription); @SuppressWarnings("unchecked") Map<ClassFileTransformer, Object> classFileTransformers = (Map<ClassFileTransformer, Object>) lambdaFactory .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { try { return classFileTransformers.isEmpty(); } finally { classFileTransformers.put(classFileTransformer, lambdaFactory .getConstructor(Object.class, Method.class) .newInstance(classFileFactory, classFileFactory.getClass().getMethod("make", Object.class, String.class, Object.class, Object.class, Object.class, Object.class, boolean.class, List.class, List.class, Collection.class))); } } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not register class file transformer", exception); } } }
LambdaFactory { @SuppressWarnings("all") public static boolean register(ClassFileTransformer classFileTransformer, Object classFileFactory) { try { TypeDescription typeDescription = TypeDescription.ForLoadedType.of(LambdaFactory.class); Class<?> lambdaFactory = ClassInjector.UsingReflection.ofSystemClassLoader() .inject(Collections.singletonMap(typeDescription, ClassFileLocator.ForClassLoader.read(LambdaFactory.class))) .get(typeDescription); @SuppressWarnings("unchecked") Map<ClassFileTransformer, Object> classFileTransformers = (Map<ClassFileTransformer, Object>) lambdaFactory .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { try { return classFileTransformers.isEmpty(); } finally { classFileTransformers.put(classFileTransformer, lambdaFactory .getConstructor(Object.class, Method.class) .newInstance(classFileFactory, classFileFactory.getClass().getMethod("make", Object.class, String.class, Object.class, Object.class, Object.class, Object.class, boolean.class, List.class, List.class, Collection.class))); } } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not register class file transformer", exception); } } LambdaFactory(Object target, Method dispatcher); }
LambdaFactory { @SuppressWarnings("all") public static boolean register(ClassFileTransformer classFileTransformer, Object classFileFactory) { try { TypeDescription typeDescription = TypeDescription.ForLoadedType.of(LambdaFactory.class); Class<?> lambdaFactory = ClassInjector.UsingReflection.ofSystemClassLoader() .inject(Collections.singletonMap(typeDescription, ClassFileLocator.ForClassLoader.read(LambdaFactory.class))) .get(typeDescription); @SuppressWarnings("unchecked") Map<ClassFileTransformer, Object> classFileTransformers = (Map<ClassFileTransformer, Object>) lambdaFactory .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { try { return classFileTransformers.isEmpty(); } finally { classFileTransformers.put(classFileTransformer, lambdaFactory .getConstructor(Object.class, Method.class) .newInstance(classFileFactory, classFileFactory.getClass().getMethod("make", Object.class, String.class, Object.class, Object.class, Object.class, Object.class, boolean.class, List.class, List.class, Collection.class))); } } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not register 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 register(ClassFileTransformer classFileTransformer, Object classFileFactory) { try { TypeDescription typeDescription = TypeDescription.ForLoadedType.of(LambdaFactory.class); Class<?> lambdaFactory = ClassInjector.UsingReflection.ofSystemClassLoader() .inject(Collections.singletonMap(typeDescription, ClassFileLocator.ForClassLoader.read(LambdaFactory.class))) .get(typeDescription); @SuppressWarnings("unchecked") Map<ClassFileTransformer, Object> classFileTransformers = (Map<ClassFileTransformer, Object>) lambdaFactory .getField(FIELD_NAME) .get(null); synchronized (classFileTransformers) { try { return classFileTransformers.isEmpty(); } finally { classFileTransformers.put(classFileTransformer, lambdaFactory .getConstructor(Object.class, Method.class) .newInstance(classFileFactory, classFileFactory.getClass().getMethod("make", Object.class, String.class, Object.class, Object.class, Object.class, Object.class, boolean.class, List.class, List.class, Collection.class))); } } } catch (RuntimeException exception) { throw exception; } catch (Exception exception) { throw new IllegalStateException("Could not register 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; }