{"action":"created","issue":{"url":"https://api.github.com/repos/EsotericSoftware/kryo/issues/314","labels_url":"https://api.github.com/repos/EsotericSoftware/kryo/issues/314/labels{/name}","comments_url":"https://api.github.com/repos/EsotericSoftware/kryo/issues/314/comments","events_url":"https://api.github.com/repos/EsotericSoftware/kryo/issues/314/events","html_url":"https://github.com/EsotericSoftware/kryo/issues/314","id":84297947,"number":314,"title":"Generic serialization failure (v3.0.1)","user":{"login":"isakidbn","id":10616227,"avatar_url":"https://avatars.githubusercontent.com/u/10616227?v=3","gravatar_id":"","url":"https://api.github.com/users/isakidbn","html_url":"https://github.com/isakidbn","followers_url":"https://api.github.com/users/isakidbn/followers","following_url":"https://api.github.com/users/isakidbn/following{/other_user}","gists_url":"https://api.github.com/users/isakidbn/gists{/gist_id}","starred_url":"https://api.github.com/users/isakidbn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isakidbn/subscriptions","organizations_url":"https://api.github.com/users/isakidbn/orgs","repos_url":"https://api.github.com/users/isakidbn/repos","events_url":"https://api.github.com/users/isakidbn/events{/privacy}","received_events_url":"https://api.github.com/users/isakidbn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-06-03T01:29:45Z","updated_at":"2015-06-04T03:28:55Z","closed_at":null,"body":"Overview:\r\n\r\nWhen attempting to serialize a parameterized class that contains a parameterized type, it fails.\r\n\r\nExample:\r\n\r\n```java\r\n\r\n// Note these are nested classes in a unit test created to simulate what\r\n// I am seeing in production code.\r\n\r\nprivate static class BaseGeneric<T extends Serializable> {\r\n    private final List<T> listPayload;\r\n\r\n    /**\r\n     * Kryo Constructor\r\n     */\r\n    protected BaseGeneric() {\r\n        super();\r\n        this.listPayload = null;\r\n    }\r\n\r\n    protected BaseGeneric(final List<T> listPayload) {\r\n        super();\r\n        // Defensive copy, listPayload is mutable\r\n        this.listPayload = new ArrayList<T>(listPayload);\r\n    }\r\n\r\n    public final List<T> getPayload() {\r\n        return this.listPayload;\r\n    }\r\n}\r\n\r\nprivate static final class ConcreteClass extends BaseGeneric<SerializableObjectFoo> {\r\n\r\n    // Child class specifics are irrelevant here.\r\n\r\n    /**\r\n     * Kryo Constructor\r\n     */\r\n    @SuppressWarnings(\"unused\")\r\n    private ConcreteClass() {\r\n        super();\r\n    }\r\n\r\n    public ConcreteClass(final List<T> listPayload) {\r\n        super(listPayload);\r\n    }\r\n}\r\n```\r\n\r\nNow, when either ConcreteClass is serialized or BaseGeneric<SerializedObjectFoo>, you get exceptions like this:\r\n\r\n```\r\ncom.esotericsoftware.kryo.KryoException: java.lang.IllegalArgumentException: type cannot be null.\r\nSerialization trace:\r\nlistPayload (com.dbn.demo.serialization.KryoSerializationTest$ConcreteClass)\r\n\tat com.esotericsoftware.kryo.serializers.ObjectField.write(ObjectField.java:101)\r\n\tat com.esotericsoftware.kryo.serializers.FieldSerializer.write(FieldSerializer.java:524)\r\n\tat com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:625)\r\n```\r\n\r\n```java\r\n\r\n// My Kryo instance configuration (I have my own ImmutableSet and UUID serializers):\r\n    private static Kryo kryoGen() {\r\n        final Kryo kryo = new Kryo();\r\n        kryo.setReferences(false);\r\n        kryo.setRegistrationRequired(false);\r\n        kryo.setAsmEnabled(true);\r\n        kryo.setAutoReset(false);\r\n        kryo.addDefaultSerializer(UUID.class, new KryoUUIDSerializer());\r\n        kryo.addDefaultSerializer(ImmutableSet.class, new KryoImmutableSetSerializer());\r\n\r\n        return kryo;\r\n    }\r\n````\r\n This happens every time. According to the following stack overflow, this is an issue in 3.0.0 as well:\r\n\r\nhttp://stackoverflow.com/questions/27909061/cant-serialize-generic-class-with-generic-field-in-kryo\r\n"},"comment":{"url":"https://api.github.com/repos/EsotericSoftware/kryo/issues/comments/108704177","html_url":"https://github.com/EsotericSoftware/kryo/issues/314#issuecomment-108704177","issue_url":"https://api.github.com/repos/EsotericSoftware/kryo/issues/314","id":108704177,"user":{"login":"isakidbn","id":10616227,"avatar_url":"https://avatars.githubusercontent.com/u/10616227?v=3","gravatar_id":"","url":"https://api.github.com/users/isakidbn","html_url":"https://github.com/isakidbn","followers_url":"https://api.github.com/users/isakidbn/followers","following_url":"https://api.github.com/users/isakidbn/following{/other_user}","gists_url":"https://api.github.com/users/isakidbn/gists{/gist_id}","starred_url":"https://api.github.com/users/isakidbn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isakidbn/subscriptions","organizations_url":"https://api.github.com/users/isakidbn/orgs","repos_url":"https://api.github.com/users/isakidbn/repos","events_url":"https://api.github.com/users/isakidbn/events{/privacy}","received_events_url":"https://api.github.com/users/isakidbn/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T03:28:55Z","updated_at":"2015-06-04T03:28:55Z","body":"My brief test shows that serialization and deserialization work with my custom 3.0.2-SNAPSHOT (your code, my pom) build. Thank you for your help!\r\n\r\nAs for Java 7, I'm certain it would have built without issue (as your continues build link highlighted); I wanted to get to the bottom of the Java 8 issue out of my own personal curiousity."}}