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

JaversException CLASS_MAPPING_ERROR when committing generic-tuple-like object #948

Closed
stun4j opened this issue Mar 21, 2020 · 1 comment
Closed

Comments

@stun4j
Copy link

@stun4j stun4j commented Mar 21, 2020

I found org.javers.core.Javers#commit not works when committing generic-tuple-like object(i.e. org.apache.commons.lang3.tuple.MutablePair etc.)

This exception can be reproduced using the following simple test case:

class Case948CommitGenericTupleLikeObject extends Specification {
    class Pair<L, R> {
        L left;
        R right;

        public Pair(L left, R right) {
            this.left = left;
            this.right = right;
        }

        @Override
        public String toString() {
            return "Pair [left=" + left + ", right=" + right + "]";
        }
    }

    def "should tracking work when committing generic-tuple-like object"(){
        given:
        Javers javers = JaversBuilder.javers().build();
        //Pair<Long, String> obj = org.apache.commons.lang3.tuple.MutablePair.of(1L, "foo");
        Pair<Long, String> obj = new Pair<>(1L, "foo");
        //    Map<Long,String> obj = new HashMap();
        //    obj.put(1L, "foo")

        when:
        javers.commit("jay", obj);

        //obj.setValue("bar");
        obj.right = "bar";
        //    obj.put(1L, "bar")

        Commit commit = javers.commit("jay", obj);

        then:
        commit.getChanges().size() == 1
    }
}
@stun4j stun4j changed the title JaversException CLASS_MAPPING_ERROR when committing tuple-like object JaversException CLASS_MAPPING_ERROR when committing generic-tuple-like object Mar 21, 2020
bartoszwalacik added a commit that referenced this issue Apr 6, 2020
#948 better support for Type t…
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Apr 7, 2020

fixed in 5.8.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants