-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Fixed a bug in #512. #533
Fixed a bug in #512. #533
Conversation
@@ -7,6 +7,6 @@ internal class ConstructorValueCreator<T>(override val callable: KFunction<T>) : | |||
override val accessible: Boolean = callable.isAccessible | |||
|
|||
init { | |||
callable.isAccessible = true | |||
if (!accessible) callable.isAccessible = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you add a note here or in the class comment as to why isAccessible
is being forced to true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
5eca9cd
@@ -23,14 +23,18 @@ internal class MethodValueCreator<T> private constructor( | |||
// abort, we have some unknown case here | |||
if (!possibleCompanion.isCompanion) return null | |||
|
|||
val initialCallableAccessible = callable.isAccessible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good name 👍
companion object Named { | ||
@JvmStatic @JsonCreator fun create(@JsonProperty("name") nameThing: String, @JsonProperty("age") age: Int, @JsonProperty("primaryAddress") primaryAddress: String, @JsonProperty("renamed") wrongName: Boolean, @JsonProperty("createdDt") createdDt: Date): StateObjectWithFactoryOnNamedCompanion { | ||
private companion object Named { | ||
@JvmStatic @JsonCreator private fun create(@JsonProperty("name") nameThing: String, @JsonProperty("age") age: Int, @JsonProperty("primaryAddress") primaryAddress: String, @JsonProperty("renamed") wrongName: Boolean, @JsonProperty("createdDt") createdDt: Date): StateObjectWithFactoryOnNamedCompanion { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All lines that were exceeding 120 characters in length depending on the parameter were modified to break lines.
b19c44f
@dinomite |
@k163377 The error I get when I run via the command line (
My system setup:
I don't see this error when running in IntelliJ :-/ |
@dinomite The same problem occurred when I checked eb7a12a with the factory function set to This may be related to #514. |
Hrm, yay for platform-independent languages. I'm not sure what to do about this, I'd like to avoid ignoring tests if at all possible. |
@dinomite This test does not seem to succeed when running on For this reason, I think it would be better to merge this PR with |
A `private` and `JvmStatic` function was broken in `Kotlin 1.5.x`. See GitHub Comment below for details. FasterXML#533 (comment)
In the #512 changing, the rewrite of the
isAccessible
property of the factory function was missing, which could cause the call to fail, so it has been fixed.Also, I found a new problem where the call fails if the
companion object
isprivate
, so I fixed it at the same time (this problem existed before #438).I have also added a test pattern to prevent these omissions.