Source:
public JBossLoadTimeWeaver(@Nullable ClassLoader classLoader) { Assert.notNull(classLoader, "ClassLoader must not be null"); this.classLoader = classLoader; try { Field transformer = ReflectionUtils.findField(classLoader.getClass(), "transformer"); if (transformer == null) { throw new IllegalArgumentException("Could not find 'transformer' field on JBoss ClassLoader: " + classLoader.getClass().getName()); } transformer.setAccessible(true); Object suggestedTransformer = transformer.get(classLoader); if (suggestedTransformer.getClass().getName().equals(WRAPPER_TRANSFORMER_CLASS_NAME)) { Field wrappedTransformer = ReflectionUtils.findField(suggestedTransformer.getClass(), "transformer"); if (wrappedTransformer == null) { throw new IllegalArgumentException("Could not find 'transformer' field on JBoss ClassTransformer: " + suggestedTransformer.getClass().getName()); } wrappedTransformer.setAccessible(true); suggestedTransformer = wrappedTransformer.get(suggestedTransformer); } if (!suggestedTransformer.getClass().getName().equals(DELEGATING_TRANSFORMER_CLASS_NAME)) { throw new IllegalStateException( "Transformer not of the expected type DelegatingClassFileTransformer: " + this.delegatingTransformer.getClass().getName()); } this.delegatingTransformer = suggestedTransformer; Method addTransformer = ReflectionUtils.findMethod(this.delegatingTransformer.getClass(), "addTransformer", ClassFileTransformer.class); if (addTransformer == null) { throw new IllegalArgumentException( "Could not find 'addTransformer' method on JBoss DelegatingClassFileTransformer: " + this.delegatingTransformer.getClass().getName()); } addTransformer.setAccessible(true); this.addTransformer = addTransformer; } catch (Throwable ex) { throw new IllegalStateException("Could not initialize JBoss LoadTimeWeaver", ex); } }

Target:
public JBossLoadTimeWeaver(@Nullable ClassLoader classLoader) { Assert.notNull(classLoader, "ClassLoader must not be null"); this.classLoader = classLoader; try { Field transformer = ReflectionUtils.findField(classLoader.getClass(), "transformer"); if (transformer == null) { throw new IllegalArgumentException("Could not find 'transformer' field on JBoss ClassLoader: " + classLoader.getClass().getName()); } transformer.setAccessible(true); Object suggestedTransformer = transformer.get(classLoader); if (suggestedTransformer.getClass().getName().equals(WRAPPER_TRANSFORMER_CLASS_NAME)) { Field wrappedTransformer = ReflectionUtils.findField(suggestedTransformer.getClass(), "transformer"); if (wrappedTransformer == null) { throw new IllegalArgumentException("Could not find 'transformer' field on JBoss ClassTransformer: " + suggestedTransformer.getClass().getName()); } wrappedTransformer.setAccessible(true); suggestedTransformer = wrappedTransformer.get(suggestedTransformer); } if (!suggestedTransformer.getClass().getName().equals(DELEGATING_TRANSFORMER_CLASS_NAME)) { throw new IllegalStateException( "Transformer not of the expected type DelegatingClassFileTransformer: " + suggestedTransformer.getClass().getName()); } this.delegatingTransformer = suggestedTransformer; Method addTransformer = ReflectionUtils.findMethod(this.delegatingTransformer.getClass(), "addTransformer", ClassFileTransformer.class); if (addTransformer == null) { throw new IllegalArgumentException( "Could not find 'addTransformer' method on JBoss DelegatingClassFileTransformer: " + this.delegatingTransformer.getClass().getName()); } addTransformer.setAccessible(true); this.addTransformer = addTransformer; } catch (Throwable ex) { throw new IllegalStateException("Could not initialize JBoss LoadTimeWeaver", ex); } }