• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java StackManipulation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.bytebuddy.implementation.bytecode.StackManipulation的典型用法代码示例。如果您正苦于以下问题:Java StackManipulation类的具体用法?Java StackManipulation怎么用?Java StackManipulation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StackManipulation类属于net.bytebuddy.implementation.bytecode包,在下文中一共展示了StackManipulation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: result

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Override
public final Result<StackManipulation> result() {
    final TypeDescription declaringType = field.getDeclaringType().asErasure();
    final TypeDescription fieldType = field.getType().asErasure();
    if(new NaturalJavaAtom().matches(fieldType)) {
        return new SmtInvokeMethod(
            new TypeDescription.ForLoadedType(Object.class),
            ElementMatchers.named("equals")
        );
    } else {
        return new SmtInvokeMethod(
            declaringType,
            new ConjunctionMatcher<>(
                ElementMatchers.isSynthetic(),
                ElementMatchers.named("atom$equal")
            )
        );
    }
}
 
开发者ID:project-avral,项目名称:oo-atom,代码行数:20,代码来源:SmtCompareAtomFields.java


示例2: SmtCombinedTest

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
public SmtCombinedTest() {
    super(
        new TestCase(
            "combines two StackManipulation tokens into one",
            new AssertTokenToRepresentExpectedStackManipulation(
                new SmtCombined(
                    new SmtLoadReference(5),
                    new SmtLoadReference(6)
                ),
                () -> new StackManipulation.Compound(
                    MethodVariableAccess.REFERENCE.loadFrom(5),
                    MethodVariableAccess.REFERENCE.loadFrom(6)
                )
            )
        )
    );
}
 
开发者ID:project-avral,项目名称:oo-atom,代码行数:18,代码来源:SmtCombinedTest.java


示例3: beforeDelegation

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Override
protected StackManipulation beforeDelegation(MethodDescription instrumentedMethod) {
  // Parameters of the wrapper invoker method:
  //   DoFnInvoker.ArgumentProvider
  // Parameters of the wrapped DoFn method:
  //   [DoFn.ProcessContext, BoundedWindow, InputProvider, OutputReceiver] in any order
  ArrayList<StackManipulation> pushParameters = new ArrayList<>();

  // To load the delegate, push `this` and then access the field
  StackManipulation pushDelegate =
      new StackManipulation.Compound(
          MethodVariableAccess.REFERENCE.loadFrom(0),
          FieldAccess.forField(delegateField).read());

  StackManipulation pushExtraContextFactory = MethodVariableAccess.REFERENCE.loadFrom(1);

  // Push the arguments in their actual order.
  for (DoFnSignature.Parameter param : signature.extraParameters()) {
    pushParameters.add(
        new StackManipulation.Compound(
            pushExtraContextFactory, getExtraContextParameter(param, pushDelegate)));
  }
  return new StackManipulation.Compound(pushParameters);
}
 
开发者ID:apache,项目名称:beam,代码行数:25,代码来源:ByteBuddyDoFnInvokerFactory.java


示例4: beforeDelegation

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Override
protected StackManipulation beforeDelegation(MethodDescription instrumentedMethod) {
  // Parameters of the wrapper invoker method:
  //   DoFn.ArgumentProvider
  // Parameters of the wrapped DoFn method:
  //   a dynamic set of allowed "extra" parameters in any order subject to
  //   validation prior to getting the DoFnSignature
  ArrayList<StackManipulation> parameters = new ArrayList<>();

  // To load the delegate, push `this` and then access the field
  StackManipulation pushDelegate =
      new StackManipulation.Compound(
          MethodVariableAccess.REFERENCE.loadFrom(0),
          FieldAccess.forField(delegateField).read());

  StackManipulation pushExtraContextFactory = MethodVariableAccess.REFERENCE.loadFrom(1);

  // Push the extra arguments in their actual order.
  for (DoFnSignature.Parameter param : signature.extraParameters()) {
    parameters.add(
        new StackManipulation.Compound(
            pushExtraContextFactory,
            ByteBuddyDoFnInvokerFactory.getExtraContextParameter(param, pushDelegate)));
  }
  return new StackManipulation.Compound(parameters);
}
 
开发者ID:apache,项目名称:beam,代码行数:27,代码来源:ByteBuddyOnTimerInvokerFactory.java


示例5: apply

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext,
    MethodDescription instrumentedMethod) {

  checkMethodSignature(instrumentedMethod);

  try {
    StackManipulation stack = buildStack();
    StackManipulation.Size finalStackSize = stack.apply(methodVisitor, implementationContext);

    return new Size(finalStackSize.getMaximalSize(),
        instrumentedMethod.getStackSize() + 2); // 2 stack slots for a single local variable

  } catch (NoSuchMethodException | NoSuchFieldException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:bramp,项目名称:unsafe,代码行数:17,代码来源:CopierImplementation.java


示例6: apply

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Override
public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext,
                MethodDescription instrumentedMethod) {
    int numArgs = instrumentedMethod.getParameters().asTypeList().getStackSize();
    /**
     * Load the desired id
     * relative to the method arguments.
     * The idea here would be to load references
     * to declared variables
     */
    //references start with zero if its an instance or zero if its static
    //think of it like an implicit self in python without actually being defined
    int start = instrumentedMethod.isStatic() ? 1 : 0;
    StackManipulation arg0 = MethodVariableAccess.REFERENCE
                    .loadOffset(numArgs + start + OpCodeUtil.getAloadInstructionForReference(refId));
    StackManipulation.Size size = arg0.apply(methodVisitor, implementationContext);
    return new Size(size.getMaximalSize(), instrumentedMethod.getStackSize());
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:19,代码来源:LoadDeclaredInternalReference.java


示例7: opFor

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
/**
 * Returns the proper stack manipulation
 * for the given operation
 * @param operation the arithmetic operation to do
 * @return the stack manipulation for the given operation
 */
public static StackManipulation opFor(Operation operation) {
    switch (operation) {
        case ADD:
            return IntegerAddition.INSTANCE;
        case SUB:
            return IntegerSubtraction.INSTANCE;
        case MUL:
            return IntegerMultiplication.INSTANCE;
        case DIV:
            return IntegerDivision.INSTANCE;
        case MOD:
            return IntegerMod.INSTANCE;
        default:
            throw new IllegalArgumentException("Illegal opType of operation ");
    }
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:23,代码来源:ByteBuddyIntArithmetic.java


示例8: inPlaceSet

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Test
public void inPlaceSet() throws Exception {
    DynamicType.Unloaded<SetValueInPlace> val =
                    new ByteBuddy().subclass(SetValueInPlace.class)
                                    .method(ElementMatchers.isDeclaredBy(SetValueInPlace.class))
                                    .intercept(new StackManipulationImplementation(new StackManipulation.Compound(
                                                    MethodVariableAccess.REFERENCE.loadOffset(1),
                                                    MethodVariableAccess.INTEGER.loadOffset(2),
                                                    MethodVariableAccess.INTEGER.loadOffset(3),
                                                    ArrayStackManipulation.store(), MethodReturn.VOID)))
                                    .make();

    val.saveIn(new File("target"));
    SetValueInPlace dv = val.load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER).getLoaded()
                    .newInstance();
    int[] ret = {2, 4};
    int[] assertion = {1, 4};
    dv.update(ret, 0, 1);
    assertArrayEquals(assertion, ret);
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:21,代码来源:AssignImplementationTest.java


示例9: inPlaceDivide

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Test
public void inPlaceDivide() throws Exception {
    DynamicType.Unloaded<SetValueInPlace> val = new ByteBuddy().subclass(SetValueInPlace.class)
                    .method(ElementMatchers.isDeclaredBy(SetValueInPlace.class))
                    .intercept(new StackManipulationImplementation(new StackManipulation.Compound(
                                    MethodVariableAccess.REFERENCE.loadOffset(1),
                                    MethodVariableAccess.INTEGER.loadOffset(2), Duplication.DOUBLE,
                                    ArrayStackManipulation.load(), MethodVariableAccess.INTEGER.loadOffset(3),
                                    OpStackManipulation.div(), ArrayStackManipulation.store(), MethodReturn.VOID)))
                    .make();

    val.saveIn(new File("target"));
    SetValueInPlace dv = val.load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER).getLoaded()
                    .newInstance();
    int[] ret = {2, 4};
    int[] assertion = {1, 4};
    dv.update(ret, 0, 2);
    assertArrayEquals(assertion, ret);
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:20,代码来源:AssignImplementationTest.java


示例10: testEmptyValue

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Test
public void testEmptyValue() throws Exception {
    when(target.getType()).thenReturn(typeDescription);
    TargetMethodAnnotationDrivenBinder.ParameterBinding<?> binding = Empty.Binder
            .INSTANCE.bind(annotationDescription,
                    source,
                    target,
                    implementationTarget,
                    assigner,
                    Assigner.Typing.STATIC);
    assertThat(binding.isValid(), is(true));
    StackManipulation.Size size = binding.apply(methodVisitor, implementationContext);
    assertThat(size.getSizeImpact(), is(typeDescription.getStackSize().getSize()));
    assertThat(size.getMaximalSize(), is(typeDescription.getStackSize().getSize()));
    verify(methodVisitor).visitInsn(opcode);
    verifyNoMoreInteractions(methodVisitor);
    verifyZeroInteractions(implementationContext);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:19,代码来源:EmptyBinderTest.java


示例11: apply

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Override
public StackManipulation apply(TypeDescription instrumentedType,
                               ByteCodeElement target,
                               TypeList.Generic arguments,
                               TypeDescription.Generic result) {
    if (!methodDescription.isAccessibleTo(instrumentedType)) {
        throw new IllegalStateException(instrumentedType + " cannot access " + methodDescription);
    }
    TypeList.Generic mapped = methodDescription.isStatic()
            ? methodDescription.getParameters().asTypeList()
            : new TypeList.Generic.Explicit(CompoundList.of(methodDescription.getDeclaringType(), methodDescription.getParameters().asTypeList()));
    if (!methodDescription.getReturnType().asErasure().isAssignableTo(result.asErasure())) {
        throw new IllegalStateException("Cannot assign return value of " + methodDescription + " to " + result);
    } else if (mapped.size() != arguments.size()) {
        throw new IllegalStateException("Cannot invoke " + methodDescription + " on " + arguments);
    }
    for (int index = 0; index < mapped.size(); index++) {
        if (!mapped.get(index).asErasure().isAssignableTo(arguments.get(index).asErasure())) {
            throw new IllegalStateException("Cannot invoke " + methodDescription + " on " + arguments);
        }
    }
    return methodDescription.isVirtual()
            ? MethodInvocation.invoke(methodDescription).virtual(target.getDeclaringType().asErasure())
            : MethodInvocation.invoke(methodDescription);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:26,代码来源:MemberSubstitution.java


示例12: apply

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
/**
 * Applies an implementation that delegates to a invocation handler.
 *
 * @param methodVisitor         The method visitor for writing the byte code to.
 * @param implementationContext The implementation context for the current implementation.
 * @param instrumentedMethod    The method that is instrumented.
 * @param preparingManipulation A stack manipulation that applies any preparation to the operand stack.
 * @param fieldDescription      The field that contains the value for the invocation handler.
 * @return The size of the applied assignment.
 */
protected ByteCodeAppender.Size apply(MethodVisitor methodVisitor,
                                      Context implementationContext,
                                      MethodDescription instrumentedMethod,
                                      StackManipulation preparingManipulation,
                                      FieldDescription fieldDescription) {
    if (instrumentedMethod.isStatic()) {
        throw new IllegalStateException("It is not possible to apply an invocation handler onto the static method " + instrumentedMethod);
    }
    StackManipulation.Size stackSize = new StackManipulation.Compound(
            preparingManipulation,
            FieldAccess.forField(fieldDescription).read(),
            MethodVariableAccess.loadThis(),
            cacheMethods
                    ? MethodConstant.forMethod(instrumentedMethod.asDefined()).cached()
                    : MethodConstant.forMethod(instrumentedMethod.asDefined()),
            ArrayFactory.forType(TypeDescription.Generic.OBJECT).withValues(argumentValuesOf(instrumentedMethod)),
            MethodInvocation.invoke(INVOCATION_HANDLER_TYPE.getDeclaredMethods().getOnly()),
            assigner.assign(TypeDescription.Generic.OBJECT, instrumentedMethod.getReturnType(), Assigner.Typing.DYNAMIC),
            MethodReturn.of(instrumentedMethod.getReturnType())
    ).apply(methodVisitor, implementationContext);
    return new ByteCodeAppender.Size(stackSize.getMaximalSize(), instrumentedMethod.getStackSize());
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:33,代码来源:InvocationHandlerAdapter.java


示例13: prepareArgumentBinder

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static MethodDelegationBinder.ParameterBinding<?> prepareArgumentBinder(TargetMethodAnnotationDrivenBinder.ParameterBinder<?> parameterBinder,
                                                                                Class<? extends Annotation> annotationType,
                                                                                Object identificationToken) {
    doReturn(annotationType).when(parameterBinder).getHandledType();
    MethodDelegationBinder.ParameterBinding<?> parameterBinding = mock(MethodDelegationBinder.ParameterBinding.class);
    when(parameterBinding.isValid()).thenReturn(true);
    when(parameterBinding.apply(any(MethodVisitor.class), any(Implementation.Context.class))).thenReturn(new StackManipulation.Size(0, 0));
    when(parameterBinding.getIdentificationToken()).thenReturn(identificationToken);
    when(((TargetMethodAnnotationDrivenBinder.ParameterBinder) parameterBinder).bind(any(AnnotationDescription.Loadable.class),
            any(MethodDescription.class),
            any(ParameterDescription.class),
            any(Implementation.Target.class),
            any(Assigner.class),
            any(Assigner.Typing.class)))
            .thenReturn(parameterBinding);
    return parameterBinding;
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:19,代码来源:TargetMethodAnnotationDrivenBinderTest.java


示例14: testConstantCreationModernInvisible

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Test
public void testConstantCreationModernInvisible() throws Exception {
    when(classFileVersion.isAtLeast(ClassFileVersion.JAVA_V5)).thenReturn(true);
    when(declaringType.isVisibleTo(instrumentedType)).thenReturn(false);
    StackManipulation stackManipulation = new FieldConstant(fieldDescription);
    assertThat(stackManipulation.isValid(), is(true));
    StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext);
    assertThat(size.getSizeImpact(), is(1));
    assertThat(size.getMaximalSize(), is(2));
    verify(methodVisitor).visitLdcInsn(BAZ);
    verify(methodVisitor).visitMethodInsn(Opcodes.INVOKESTATIC,
            Type.getInternalName(Class.class),
            "forName",
            Type.getMethodDescriptor(Type.getType(Class.class), Type.getType(String.class)),
            false);
    verify(methodVisitor).visitLdcInsn(BAR);
    verify(methodVisitor).visitMethodInsn(Opcodes.INVOKEVIRTUAL,
            "java/lang/Class",
            "getDeclaredField",
            "(Ljava/lang/String;)Ljava/lang/reflect/Field;",
            false);
    verifyNoMoreInteractions(methodVisitor);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:24,代码来源:FieldConstantTest.java


示例15: testNonRebasedMethodIsInvokable

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Test
public void testNonRebasedMethodIsInvokable() throws Exception {
    when(invokableMethod.getDeclaringType()).thenReturn(instrumentedType);
    when(invokableMethod.isSpecializableFor(instrumentedType)).thenReturn(true);
    when(resolution.isRebased()).thenReturn(false);
    when(resolution.getResolvedMethod()).thenReturn(invokableMethod);
    Implementation.SpecialMethodInvocation specialMethodInvocation = makeImplementationTarget().invokeSuper(rebasedSignatureToken);
    assertThat(specialMethodInvocation.isValid(), is(true));
    assertThat(specialMethodInvocation.getMethodDescription(), is((MethodDescription) invokableMethod));
    assertThat(specialMethodInvocation.getTypeDescription(), is(instrumentedType));
    MethodVisitor methodVisitor = mock(MethodVisitor.class);
    Implementation.Context implementationContext = mock(Implementation.Context.class);
    StackManipulation.Size size = specialMethodInvocation.apply(methodVisitor, implementationContext);
    verify(methodVisitor).visitMethodInsn(Opcodes.INVOKESPECIAL, BAZ, FOO, QUX, false);
    verifyNoMoreInteractions(methodVisitor);
    verifyZeroInteractions(implementationContext);
    assertThat(size.getSizeImpact(), is(0));
    assertThat(size.getMaximalSize(), is(0));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:20,代码来源:RebaseImplementationTargetTest.java


示例16: testExplicitTypeInitializer

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Test
public void testExplicitTypeInitializer() throws Exception {
    assertThat(createPlain()
            .defineField(FOO, String.class, Ownership.STATIC, Visibility.PUBLIC)
            .initializer(new ByteCodeAppender() {
                @Override
                public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod) {
                    return new Size(new StackManipulation.Compound(
                            new TextConstant(FOO),
                            FieldAccess.forField(instrumentedMethod.getDeclaringType().getDeclaredFields().filter(named(FOO)).getOnly()).write()
                    ).apply(methodVisitor, implementationContext).getMaximalSize(), instrumentedMethod.getStackSize());
                }
            }).make()
            .load(ClassLoadingStrategy.BOOTSTRAP_LOADER, ClassLoadingStrategy.Default.WRAPPER)
            .getLoaded()
            .getDeclaredField(FOO)
            .get(null), is((Object) FOO));
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:19,代码来源:AbstractDynamicTypeBuilderTest.java


示例17: of

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
/**
 * Creates a new stack manipulation to load the supplied value onto the stack.
 *
 * @param value The value to serialize.
 * @return A stack manipulation to serialize the supplied value.
 */
public static StackManipulation of(Serializable value) {
    if (value == null) {
        return NullConstant.INSTANCE;
    }
    try {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
        try {
            objectOutputStream.writeObject(value);
        } finally {
            objectOutputStream.close();
        }
        return new SerializedConstant(byteArrayOutputStream.toString(CHARSET));
    } catch (IOException exception) {
        throw new IllegalStateException("Cannot serialize " + value, exception);
    }
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:24,代码来源:SerializedConstant.java


示例18: testConstantCreationLegacy

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Test
public void testConstantCreationLegacy() throws Exception {
    when(classFileVersion.isAtLeast(ClassFileVersion.JAVA_V5)).thenReturn(false);
    when(declaringType.isVisibleTo(instrumentedType)).thenReturn(true);
    StackManipulation stackManipulation = new FieldConstant(fieldDescription);
    assertThat(stackManipulation.isValid(), is(true));
    StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext);
    assertThat(size.getSizeImpact(), is(1));
    assertThat(size.getMaximalSize(), is(2));
    verify(methodVisitor).visitLdcInsn(BAZ);
    verify(methodVisitor).visitMethodInsn(Opcodes.INVOKESTATIC,
            Type.getInternalName(Class.class),
            "forName",
            Type.getMethodDescriptor(Type.getType(Class.class), Type.getType(String.class)),
            false);
    verify(methodVisitor).visitLdcInsn(BAR);
    verify(methodVisitor).visitMethodInsn(Opcodes.INVOKEVIRTUAL,
            "java/lang/Class",
            "getDeclaredField",
            "(Ljava/lang/String;)Ljava/lang/reflect/Field;",
            false);
    verifyNoMoreInteractions(methodVisitor);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:24,代码来源:FieldConstantTest.java


示例19: testCreationUsing

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
protected void testCreationUsing(Class<?> componentType, int storageOpcode) throws Exception {
    defineComponentType(componentType);
    CollectionFactory arrayFactory = ArrayFactory.forType(this.componentType);
    StackManipulation arrayStackManipulation = arrayFactory.withValues(Collections.singletonList(stackManipulation));
    assertThat(arrayStackManipulation.isValid(), is(true));
    verify(stackManipulation, atLeast(1)).isValid();
    StackManipulation.Size size = arrayStackManipulation.apply(methodVisitor, implementationContext);
    assertThat(size.getSizeImpact(), is(1));
    assertThat(size.getMaximalSize(), is(3 + StackSize.of(componentType).toIncreasingSize().getSizeImpact()));
    verify(methodVisitor).visitInsn(Opcodes.ICONST_1);
    verifyArrayCreation(methodVisitor);
    verify(methodVisitor).visitInsn(Opcodes.DUP);
    verify(methodVisitor).visitInsn(Opcodes.ICONST_0);
    verify(stackManipulation).apply(methodVisitor, implementationContext);
    verify(methodVisitor).visitInsn(storageOpcode);
    verifyNoMoreInteractions(methodVisitor);
    verifyNoMoreInteractions(stackManipulation);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:19,代码来源:AbstractArrayFactoryTest.java


示例20: testImplicitUnboxingAssignment

import net.bytebuddy.implementation.bytecode.StackManipulation; //导入依赖的package包/类
@Test
public void testImplicitUnboxingAssignment() {
    StackManipulation stackManipulation = primitiveAssigner.assign(source, target, Assigner.Typing.DYNAMIC);
    assertThat(stackManipulation.isValid(), is(assignable));
    verify(chainedStackManipulation).isValid();
    verifyNoMoreInteractions(chainedStackManipulation);
    verify(source, atLeast(0)).represents(any(Class.class));
    verify(source, atLeast(1)).isPrimitive();
    verify(source).asGenericType();
    verifyNoMoreInteractions(source);
    verify(target, atLeast(0)).represents(any(Class.class));
    verify(target, atLeast(1)).isPrimitive();
    verifyNoMoreInteractions(target);
    verify(chainedAssigner).assign(source, new TypeDescription.Generic.OfNonGenericType.ForLoadedType(wrapperType), Assigner.Typing.DYNAMIC);
    verifyNoMoreInteractions(chainedAssigner);
}
 
开发者ID:raphw,项目名称:byte-buddy,代码行数:17,代码来源:PrimitiveTypeAwareAssignerImplicitUnboxingTest.java



注:本文中的net.bytebuddy.implementation.bytecode.StackManipulation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Reference类代码示例发布时间:2022-05-22
下一篇:
Java Id类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap