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

Unable to work with Google Collections - SetMultimap #132

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

Unable to work with Google Collections - SetMultimap #132

eladh opened this issue Mar 19, 2015 · 5 comments
Assignees
Labels

Comments

@eladh
Copy link

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
Copy link
Author

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
Copy link
Author

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
Copy link
Member

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
Copy link
Contributor

bgalek commented May 8, 2015

looking forward for users contribution :)

@akrystian akrystian self-assigned this Jan 18, 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 akrystian changed the title Unable to work with Google Collections - SetMultimap Unable to work with Google Collections - SetMultimap Apr 10, 2016
akrystian added a commit that referenced this issue Jun 12, 2016
@bartoszwalacik
Copy link
Member

released in 2.9.0

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

No branches or pull requests

4 participants