@Test public void testCached() throws Exception { StackManipulation stackManipulation = new FieldConstant(fieldDescription).cached(); assertThat(stackManipulation.isValid(), is(true)); StackManipulation.Size size = stackManipulation.apply(methodVisitor, implementationContext); assertThat(size.getSizeImpact(), is(1)); assertThat(size.getMaximalSize(), is(1)); verify(implementationContext).cache(new FieldConstant(fieldDescription), TypeDescription.ForLoadedType.of(Field.class)); verifyNoMoreInteractions(implementationContext); verify(methodVisitor).visitFieldInsn(Opcodes.GETSTATIC, BAZ, FOO + BAR, QUX + BAZ); verifyNoMoreInteractions(methodVisitor); }
public StackManipulation cached() { return new Cached(this); }
FieldConstant implements StackManipulation { public StackManipulation cached() { return new Cached(this); } }
FieldConstant implements StackManipulation { public StackManipulation cached() { return new Cached(this); } FieldConstant(FieldDescription.InDefinedShape fieldDescription); }
FieldConstant implements StackManipulation { public StackManipulation cached() { return new Cached(this); } FieldConstant(FieldDescription.InDefinedShape fieldDescription); StackManipulation cached(); boolean isValid(); Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext); @Override int hashCode(); @Override boolean equals(Object other); }
FieldConstant implements StackManipulation { public StackManipulation cached() { return new Cached(this); } FieldConstant(FieldDescription.InDefinedShape fieldDescription); StackManipulation cached(); boolean isValid(); Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext); @Override int hashCode(); @Override boolean equals(Object other);  }