Coder implements Serializable { @Experimental(Kind.CODER_TYPE_ENCODING) public TypeDescriptor<T> getEncodedTypeDescriptor() { return (TypeDescriptor<T>) TypeDescriptor.of(getClass()).resolveType(new TypeDescriptor<T>() {}.getType()); }  abstract void encode(T value, OutputStream outStream); @Deprecated @Experimental(Kind.CODER_CONTEXT) void encode(T value, OutputStream outStream, Context context); abstract T decode(InputStream inStream); @Deprecated @Experimental(Kind.CODER_CONTEXT) T decode(InputStream inStream, Context context); abstract List<? extends Coder<?>> getCoderArguments(); abstract void verifyDeterministic(); static void verifyDeterministic(Coder<?> target, String message, Iterable<Coder<?>> coders); static void verifyDeterministic(Coder<?> target, String message, Coder<?>... coders); boolean consistentWithEquals(); Object structuralValue(T value); boolean isRegisterByteSizeObserverCheap(T value); void registerByteSizeObserver(T value, ElementByteSizeObserver observer); @Experimental(Kind.CODER_TYPE_ENCODING) TypeDescriptor<T> getEncodedTypeDescriptor();  }
@Test public void testTypeIsPreserved() throws Exception { assertThat(VoidCoder.of().getEncodedTypeDescriptor(), equalTo(TypeDescriptor.of(Void.class))); }