net.bytebuddy.dynamic.scaffold.InstrumentedType Java Examples
The following examples show how to use
net.bytebuddy.dynamic.scaffold.InstrumentedType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AgentBuilderTypeStrategyTest.java From byte-buddy with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings("unchecked") public void testRedefineFrozen() throws Exception { when(byteBuddy.with(InstrumentedType.Factory.Default.FROZEN)).thenReturn(byteBuddy); when(byteBuddy.with(VisibilityBridgeStrategy.Default.NEVER)).thenReturn(byteBuddy); when(byteBuddy.redefine(typeDescription, classFileLocator)).thenReturn((DynamicType.Builder) dynamicTypeBuilder); when(dynamicTypeBuilder.ignoreAlso(LatentMatcher.ForSelfDeclaredMethod.NOT_DECLARED)).thenReturn((DynamicType.Builder) dynamicTypeBuilder); assertThat(AgentBuilder.TypeStrategy.Default.REDEFINE_FROZEN.builder(typeDescription, byteBuddy, classFileLocator, methodNameTransformer, classLoader, module, protectionDomain), is((DynamicType.Builder) dynamicTypeBuilder)); verify(byteBuddy).with(InstrumentedType.Factory.Default.FROZEN); verify(byteBuddy).with(VisibilityBridgeStrategy.Default.NEVER); verify(byteBuddy).redefine(typeDescription, classFileLocator); verifyNoMoreInteractions(byteBuddy); verify(dynamicTypeBuilder).ignoreAlso(LatentMatcher.ForSelfDeclaredMethod.NOT_DECLARED); verifyNoMoreInteractions(dynamicTypeBuilder); }
Example #2
Source File: TypePoolDefaultWithLazyResolutionTypeDescriptionTest.java From byte-buddy with Apache License 2.0 | 5 votes |
@Test public void testGenericResolutionIsLazyForSimpleCreation() throws Exception { ClassFileLocator classFileLocator = spy(ClassFileLocator.ForClassLoader.ofSystemLoader()); new ByteBuddy() .with(TypeValidation.DISABLED) .with(MethodGraph.Empty.INSTANCE) .with(InstrumentedType.Factory.Default.FROZEN) .redefine(describe(GenericType.class, classFileLocator, new TypePool.CacheProvider.Simple()), classFileLocator) .make(); verify(classFileLocator, times(2)).locate(GenericType.class.getName()); verifyNoMoreInteractions(classFileLocator); }
Example #3
Source File: MethodCall.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType .withField(new FieldDescription.Token(name, Opcodes.ACC_SYNTHETIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(value.getClass()))) .withInitializer(new LoadedTypeInitializer.ForStaticField(name, value)); }
Example #4
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { for (ArgumentProvider argumentProvider : argumentProviders) { instrumentedType = argumentProvider.prepare(instrumentedType); } return instrumentedType; }
Example #5
Source File: AbstractDynamicTypeBuilderTest.java From byte-buddy with Apache License 2.0 | 5 votes |
public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType.withMethod(new MethodDescription.Token(FOO, MODIFIERS, Collections.<TypeVariableToken>emptyList(), TypeDescription.Generic.OBJECT, Collections.singletonList(new ParameterDescription.Token(TypeDescription.Generic.OBJECT, Collections.singletonList(AnnotationDescription.Builder.ofType(SampleAnnotation.class).define(FOO, QUX).build()))), Collections.singletonList(TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(Exception.class)), Collections.singletonList(AnnotationDescription.Builder.ofType(SampleAnnotation.class).define(FOO, BAR).build()), AnnotationValue.UNDEFINED, TypeDescription.Generic.UNDEFINED)); }
Example #6
Source File: MethodCall.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { for (InstrumentedType.Prepareable prepareable : argumentLoaders) { instrumentedType = prepareable.prepare(instrumentedType); } return targetHandler.prepare(instrumentedType); }
Example #7
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType .withField(new FieldDescription.Token(name, Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC, fieldType.asGenericType())) .withInitializer(new LoadedTypeInitializer.ForStaticField(name, value)); }
Example #8
Source File: FixedValue.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType .withField(new FieldDescription.Token(fieldName, Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC, fieldType)) .withInitializer(new LoadedTypeInitializer.ForStaticField(fieldName, value)); }
Example #9
Source File: MethodCall.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType .withField(new FieldDescription.Token(name, Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC, fieldType)) .withInitializer(new LoadedTypeInitializer.ForStaticField(name, target)); }
Example #10
Source File: MethodDelegation.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType .withField(new FieldDescription.Token(fieldName, Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE | Opcodes.ACC_SYNTHETIC, fieldType)) .withInitializer(new LoadedTypeInitializer.ForStaticField(fieldName, target)); }
Example #11
Source File: TypePoolDefaultWithLazyResolutionTypeDescriptionTest.java From byte-buddy with Apache License 2.0 | 5 votes |
@Test public void testNonGenericResolutionIsLazyForSimpleCreation() throws Exception { ClassFileLocator classFileLocator = spy(ClassFileLocator.ForClassLoader.ofSystemLoader()); new ByteBuddy() .with(TypeValidation.DISABLED) .with(MethodGraph.Empty.INSTANCE) .with(InstrumentedType.Factory.Default.FROZEN) .redefine(describe(NonGenericType.class, classFileLocator, new TypePool.CacheProvider.Simple()), classFileLocator) .make(); verify(classFileLocator, times(2)).locate(NonGenericType.class.getName()); verifyNoMoreInteractions(classFileLocator); }
Example #12
Source File: Implementation.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { for (Implementation implementation : implementations) { instrumentedType = implementation.prepare(instrumentedType); } return instrumentedType; }
Example #13
Source File: Implementation.java From byte-buddy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { for (Implementation implementation : implementations) { instrumentedType = implementation.prepare(instrumentedType); } return composable.prepare(instrumentedType); }
Example #14
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #15
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #16
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #17
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #18
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #19
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #20
Source File: TypeProxy.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType.withField(new FieldDescription.Token(INSTANCE_FIELD, Opcodes.ACC_PUBLIC | Opcodes.ACC_VOLATILE, implementationTarget.getInstrumentedType().asGenericType())); }
Example #21
Source File: EqualsMethod.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #22
Source File: FieldAccessor.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #23
Source File: FieldAccessor.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #24
Source File: AdviceInconsistentStackSizeTest.java From byte-buddy with Apache License 2.0 | 4 votes |
public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #25
Source File: AbstractDynamicTypeBuilderTest.java From byte-buddy with Apache License 2.0 | 4 votes |
public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType.withField(new FieldDescription.Token(FOO, MODIFIERS, TypeDescription.Generic.OBJECT, Collections.singletonList(AnnotationDescription.Builder.ofType(SampleAnnotation.class).define(FOO, BAR).build()))); }
Example #26
Source File: FixedValue.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #27
Source File: FixedValue.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #28
Source File: FixedValue.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #29
Source File: FixedValue.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }
Example #30
Source File: InvokeDynamic.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public InstrumentedType prepare(InstrumentedType instrumentedType) { return instrumentedType; }