Junfeic / kryo

Automatically exported from code.google.com/p/kryo
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Kryo#setInstantiatorStrategy has no effect if constructor is not accessable #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set a new strategy with Kryo#setInstantiatorStrategy(myStrategy)
2. Watch how Kryo#newInstantiator ignores it for classes that have private 
no-arg constructors.

What is the expected output? What do you see instead?
It's obvious. :-) And that there is a test verifying this behaviour.

What version of the Kryo are you using?
2.05

Please provide any additional information below.
The problem is, that Kryo#newInstantiator always tries to use a default 
constructor first. Only if there is none, the strategy is used. But if there is 
one that is not accessable it fails later on.

Original issue reported on code.google.com by honkbert@gmail.com on 21 Apr 2012 at 3:10

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r216.

Original comment by nathan.s...@gmail.com on 25 Apr 2012 at 7:27

GoogleCodeExporter commented 9 years ago
Fixed in r216, thanks. Kryo now tries the public constructor, if unavailable 
tries to use setAccessible on any private no-arg constructor, if none of that 
worked out, it uses the InstantiatorStrategy.

Original comment by nathan.s...@gmail.com on 25 Apr 2012 at 7:28