[Resolved] ObjectMappingException: No TypeSerializer found for field weights of type [ insert garbage]

Hey all,

Ninja configurate problems again. This time it seems like I don’t have a type serializer, although I can’t figure out where or why.
It breaks on me making the defaults here.
Here’s the plugin its from:

Here’s the error message:

and here are the geoworld modules I’m running it with:

It should be noted that you can actually play GeoWorld with the libs from all four modules, but at the moment I can’t confirm that any of the gameplay will be nice or enjoyable. It’s locked in a debug setting.

Also, I’ve thrown a lot of debugger time at this problem to no avail.

That’s Configurate’s way of saying, “I have no idea what to do with this object”. Presuming you have already created a serializer for your class, you must also register it with Configurate as shown here.

I thought @ConfigSerializable and @Setting take care of that?

Theoretically. Do you have a public empty constructor for your StratigraphicDefaults class?

No TypeSerializer found for field weights of type [D

[D means you have a double[] somewhere in your config, and Configurate doesn’t work with array types. Simplest solution is to find where your double[] is and convert it into a List<Double>.

Yep public empty constructor @Simon_Flash

@dualspiral was right though, I was trying to set double arrays. I see that from the original output that that is what it was trying to tell me. In the future, how do I look up these error messages? “field weights of type [D” is not very transparent unless you have some reference for the error msgs.

Fixed it, but theres this weird thing where Collection thinks I’m passing a null pointer?

File:

Output:

Line 14 should be this.weights = Doubles.asList(weights);, not this.frequencies. Copy/paste error.

Also, make sure you have a public no-args constructor in that file, otherwise configurate will complain when constructing the object itself.

-___-.

Thanks for that.
I’ll mark this as solved.

This is a Java thing. I is int, D is double, F is float, J is long, S is short, B is byte, C is char, Z is boolean, L followed by a slash-separated class path is that class (e.g. Ljava/lang/String), and any type preceded by a [ is an array of that type. These are the representations of the types in class bytecode.

1 Like