Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaggedFieldSerializer broken (issue with fix #158) #192

Closed
Senth opened this issue Feb 7, 2014 · 0 comments
Closed

TaggedFieldSerializer broken (issue with fix #158) #192

Senth opened this issue Feb 7, 2014 · 0 comments

Comments

@Senth
Copy link

Senth commented Feb 7, 2014

I recently updated from kryo 2.21 to 2.23 and noticed that TaggedFieldSerializer had stopped working.

I think I narrowed it down to this commit: fa2f729

This test-case throws the exception. Initially I thought it was necessary to have a derived class to throw the exception, but that didn't seem to be the case.

public class Main {
    public static void main(String[] args) {
        Kryo kryo = new Kryo();
        new TaggedFieldSerializer<Derived>(kryo, Derived.class);
    }

    public static class Base {
        @Tag(1) public int baseTagged;
        public int baseUntagged; // If derivedUntagged is commented, this will also throw an error.
    }

    public static class Derived extends Base {
        @Tag(2) public int derivedTagged;
        public int derivedUntagged; // This field will make FieldSerializer throw an exception
    }
}

Stack Trace of interest:

Exception in thread "LWJGL Application" java.lang.IllegalArgumentException: Field "mSelected" not found on class: com.spiddekauga.voider.game.actors.BulletActor
    at com.esotericsoftware.kryo.serializers.FieldSerializer.removeField(FieldSerializer.java:524)
    at com.esotericsoftware.kryo.serializers.TaggedFieldSerializer.removeField(TaggedFieldSerializer.java:58)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.rebuildCachedFields(FieldSerializer.java:226)
    at com.esotericsoftware.kryo.serializers.FieldSerializer.<init>(FieldSerializer.java:127)
    at com.esotericsoftware.kryo.serializers.TaggedFieldSerializer.<init>(TaggedFieldSerializer.java:29)
@romix romix closed this as completed in 90fd4c4 Feb 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant