Giter VIP home page Giter VIP logo

easy-random-protobuf's People

Contributors

actions-user avatar anton-shchyrov avatar dependabot[bot] avatar github-actions[bot] avatar moderneapp[bot] avatar murdos avatar tomikiss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

easy-random-protobuf's Issues

NoSuchMethodException when trying to randomize com.google.protobuf.MapEntry class

Hello,

I'm actually trying to use your amazing library but without success.

I used the exact same example you put in your README.

I have a class that has a property of type MapEntry (from com.google.protobuf) in it. And whenever I try to randomize it I keep getting this error:

org.jeasy.random.ObjectCreationException: Unable to create a random instance of type class openmatch.Messages$Assignment
...
Caused by: org.jeasy.random.ObjectCreationException: Unable to create a random instance of type class com.google.protobuf.MapEntry
	at app//org.jeasy.random.EasyRandom.doPopulateBean(EasyRandom.java:172)
	at app//org.jeasy.random.EasyRandom.nextObject(EasyRandom.java:100)
	at app//io.github.murdos.easyrandom.protobuf.ProtobufMessageRandomizer.lambda$new$8(ProtobufMessageRandomizer.java:77)
	at app//io.github.murdos.easyrandom.protobuf.ProtobufMessageRandomizer.populateField(ProtobufMessageRandomizer.java:121)
	at app//io.github.murdos.easyrandom.protobuf.ProtobufMessageRandomizer.getRandomValue(ProtobufMessageRandomizer.java:95)
	at app//io.github.murdos.easyrandom.protobuf.ProtobufMessageRandomizer.getRandomValue(ProtobufMessageRandomizer.java:43)
	at app//org.jeasy.random.EasyRandom.doPopulateBean(EasyRandom.java:133)
	... 88 more
Caused by: java.lang.IllegalArgumentException: java.lang.NoSuchMethodException: com.google.protobuf.MapEntry.getDefaultInstance()
	at io.github.murdos.easyrandom.protobuf.ProtobufMessageRandomizer.instantiateMessage(ProtobufMessageRandomizer.java:108)
	at io.github.murdos.easyrandom.protobuf.ProtobufMessageRandomizer.getRandomValue(ProtobufMessageRandomizer.java:85)
	at io.github.murdos.easyrandom.protobuf.ProtobufMessageRandomizer.getRandomValue(ProtobufMessageRandomizer.java:43)
	at org.jeasy.random.EasyRandom.doPopulateBean(EasyRandom.java:133)
	... 94 more
Caused by: java.lang.NoSuchMethodException: com.google.protobuf.MapEntry.getDefaultInstance()
	at java.base/java.lang.Class.getMethod(Class.java:2108)
	at io.github.murdos.easyrandom.protobuf.ProtobufMessageRandomizer.instantiateMessage(ProtobufMessageRandomizer.java:105)
	... 97 more

Do you, by chance, have already been facing that kind of problem? and is there any solution/workaround?

Thanks

"StackOverflowError" and "Unable to create a random instance of type class <Compiled Protobuf Class>"

First of all thanks for this plugin, it seems to be really helpful!

Sadly I have some problems to get it working in my project, I always get the following error message:
org.jeasy.random.ObjectCreationException: Unable to create a random instance of type class com.igdb.proto.Igdb$InvolvedCompany

I uploaded a small sample project to reproduce this error here: https://github.com/grimsi/easyrandom-protobuf-test
Simply running a mvn clean install will result in a Stack-Overflow and "Unable to create a random instance of type class XXX".

I am using the official protobuf file from IGDB and it works fine in my project: https://api.igdb.com/v4/igdbapi.proto
I am using the protoc-jar-maven-plugin to compile the .proto file to Java classes.
My project is using Java 18 (maybe that's an issue?).

If you need any further assistance just tell me and I will give my best to support you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.