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

Unable to work with Google Collections - SetMultimap #132

Closed
eladh opened this Issue Mar 19, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@eladh

eladh commented Mar 19, 2015

Hi.

as a first setup i need to investigate changes on complex Aggregator MD object graph.

one of the data structures is Google Collections - SetMultimap and when i start the Javers JaversBuilder i got the following error :

given javaClass 'com.google.common.collect.AbstractMultimap$WrappedSet' is mapped to SetType, ManagedType expected

after registering the inner we getting error in BeanBasedPropertyScanner->ReflectionUtils->isPersistentGetter->isGetter

10x

@eladh

This comment has been minimized.

eladh commented Mar 19, 2015

error :

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 3
at java.lang.String.substring(String.java:1907)
at org.javers.common.reflection.ReflectionUtil.isGetter(ReflectionUtil.java:100)
at org.javers.common.reflection.ReflectionUtil.isPersistentGetter(ReflectionUtil.java:83)
at org.javers.common.reflection.ReflectionUtil.findAllPersistentGetters(ReflectionUtil.java:55)
at org.javers.core.metamodel.property.BeanBasedPropertyScanner.scan(BeanBasedPropertyScanner.java:23)
at org.javers.core.metamodel.clazz.ManagedClassFactory.create(ManagedClassFactory.java:90)
at org.javers.core.metamodel.clazz.ManagedClassFactory.create(ManagedClassFactory.java:64)
at org.javers.core.metamodel.type.TypeFactory.createFromDefinition(TypeFactory.java:29)
at org.javers.core.metamodel.type.TypeMapper.registerClientsClass(TypeMapper.java:163)
at org.javers.core.JaversBuilder.mapRegisteredClasses(JaversBuilder.java:328)
at org.javers.core.JaversBuilder.bootManagedClasses(JaversBuilder.java:346)
at org.javers.core.JaversBuilder.assembleJaversInstance(JaversBuilder.java:99)
at org.javers.core.JaversBuilder.build(JaversBuilder.java:88)

@eladh

This comment has been minimized.

eladh commented Mar 19, 2015

hi

the issue here :

what if the method name is just "is" , then you will get the following exception

public static boolean isGetter(Method m) {
return (m.getName().substring(0,3).equals("get") ||
m.getName().substring(0,2).equals("is") ) &&
m.getParameterTypes().length == 0;
}

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Mar 20, 2015

JaVers does not support Guava collection types out-of-the-box.
Take look at http://javers.org/documentation/diff-configuration/#custom-comparators
this is know issue

We need a set of custom-comparators for Guava collection types, you can write it and then we encourage you to contribute this to JaVers

@bgalek

This comment has been minimized.

Contributor

bgalek commented May 8, 2015

looking forward for users contribution :)

@bartoszwalacik bartoszwalacik added enhancement and removed question labels Jul 18, 2015

@akrystian akrystian self-assigned this Jan 18, 2016

@akrystian akrystian added in progress and removed ready labels Feb 7, 2016

akrystian added a commit that referenced this issue Feb 28, 2016

akrystian added a commit that referenced this issue Mar 15, 2016

akrystian added a commit that referenced this issue Apr 3, 2016

akrystian added a commit that referenced this issue Apr 10, 2016

@akrystian akrystian changed the title from Unable to work with Google Collections - SetMultimap to Unable to work with Google Collections - SetMultimap Apr 10, 2016

@akrystian akrystian added review and removed in progress labels Apr 10, 2016

akrystian added a commit that referenced this issue Jun 12, 2016

bartoszwalacik added a commit that referenced this issue Jan 10, 2017

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Jan 14, 2017

released in 2.9.0

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