@Test public void testNullValue() throws Exception { assertThat(SerializedConstant.of(null), is((StackManipulation) NullConstant.INSTANCE)); }
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); } }
SerializedConstant implements StackManipulation { 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); } } }
SerializedConstant implements StackManipulation { 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); } } protected  SerializedConstant(String serialization); }
SerializedConstant implements StackManipulation { 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); } } protected  SerializedConstant(String serialization); static StackManipulation of(Serializable value); boolean isValid(); Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext); }
SerializedConstant implements StackManipulation { 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); } } protected  SerializedConstant(String serialization); static StackManipulation of(Serializable value); boolean isValid(); Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext);  }