Restore the `Boolean` constructors for binary compatibility of dependent projects?
This recent commit
https://bitbucket.org/asomov/snakeyaml/commits/6cb855839ebc1f3796cff26aa6e5423f1395b975
changed the API in some places to take a DumperOptions.FlowStyle flowStyle
instead of a Boolean
. This has caused some downstream projects which used the old API to break if bundled with a more recent version of snakeyaml.
Would you consider accepting a PR that restores the old constructors, marked deprecated, and simply forwarding to the new constructors, and cutting a new version so that we could use an even newer version eg 1.22 and not lose hair & sleep over these delicate version alignments.
See for example:
https://github.com/FasterXML/jackson-dataformats-text/issues/81
(It would be fair for those projects to more accurately mark which versions of snakeyaml they are compatible with, e.g. as [1.18,1.20) but there are a few others I've encountered as well, e.g. jclouds-byon, so I for one would be grateful if snake could offer this compatibility for a while yet!)
Happy to help contribute this.
Comments (10)
-
-
reporter Thanks Andrey, this will be a lot easier than nested OSGi deps version wrangling!
I have taken a stab at this in https://bitbucket.org/asomov/snakeyaml/pull-requests/39 .
-
- changed status to resolved
I will be delivered in the release 1.22: https://bitbucket.org/asomov/snakeyaml/wiki/Changes
-
- changed status to open
The pipeline fails. The same error can be reproduced locally:
./docker-run-jdk9.sh
-
reporter I get the same errors on the revision immediately before my commits, and the problem doesn't seem related to my changes.
FWIW it looks like the problem is something attempting to access the private constructor
java.util.Optional(java.lang.Object)
.For the record, the errors are:
Tests in error: Java8OptionalTest.testJava8OptionalDumpLoad:35->OptionalTesting.dumpLoadOptional:152 » Constructor Java8OptionalTest.testJava8OptionalStringLoad:30->OptionalTesting.loadOptionalString:136 » Constructor
With detailed cause:
testJava8OptionalDumpLoad(org.yaml.snakeyaml.issues.issue310.Java8OptionalTest) Time elapsed: 0.007 sec <<< ERROR! org.yaml.snakeyaml.constructor.ConstructorException: Cannot create property=salary for JavaBean=Person{name='Neo Anderson', salary=Optional.empty} in 'string', line 1, column 1: !!org.yaml.snakeyaml.issues.issu ... ^ Cannot create property=income for JavaBean=Salary{income=Optional.empty} in 'string', line 3, column 10: salary: [!!org.yaml.snakeyaml.issues.issu ... ^ java.lang.reflect.InaccessibleObjectException: Unable to make private java.util.Optional(java.lang.Object) accessible: module java.base does not "opens java.util" to unnamed module @46897293 in 'string', line 3, column 79: ... OptionalTesting$Salary {income: [123456.78]}] ^ in 'string', line 3, column 9: salary: [!!org.yaml.snakeyaml.issues.iss ... ^ at org.yaml.snakeyaml.issues.issue310.Java8OptionalTest.testJava8OptionalDumpLoad(Java8OptionalTest.java:35) Caused by: org.yaml.snakeyaml.constructor.ConstructorException: Cannot create property=income for JavaBean=Salary{income=Optional.empty} in 'string', line 3, column 10: salary: [!!org.yaml.snakeyaml.issues.issu ... ^ java.lang.reflect.InaccessibleObjectException: Unable to make private java.util.Optional(java.lang.Object) accessible: module java.base does not "opens java.util" to unnamed module @46897293 in 'string', line 3, column 79: ... OptionalTesting$Salary {income: [123456.78]}] ^ at org.yaml.snakeyaml.issues.issue310.Java8OptionalTest.testJava8OptionalDumpLoad(Java8OptionalTest.java:35) Caused by: org.yaml.snakeyaml.error.YAMLException: java.lang.reflect.InaccessibleObjectException: Unable to make private java.util.Optional(java.lang.Object) accessible: module java.base does not "opens java.util" to unnamed module @46897293 at org.yaml.snakeyaml.issues.issue310.Java8OptionalTest.testJava8OptionalDumpLoad(Java8OptionalTest.java:35) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.util.Optional(java.lang.Object) accessible: module java.base does not "opens java.util" to unnamed module @46897293 at org.yaml.snakeyaml.issues.issue310.Java8OptionalTest.testJava8OptionalDumpLoad(Java8OptionalTest.java:35)
-
reporter Changing
<jdk9-illegal-access-level>deny</jdk9-illegal-access-level>
to<jdk9-illegal-access-level>permit</jdk9-illegal-access-level>
in thepom.xml
seems to solve the problem. It looks likedeny
was set explicitly (overriding the jdk9 default ofpermit
) in revision 1121. Withdeny
I believe the failure is the correct behaviour.This SO question has useful background: https://stackoverflow.com/questions/46230413/jdk9-an-illegal-reflective-access-operation-has-occurred-org-python-core-pysys/46230678
-
For your information: I have changed the Javadoc comment to normal comments to avoid build errors. If you want the proper Javadoc comments then you can submit another pull request (please check that Maven does not complain)
In the meantime you can test the latest SNAPSHOT from Sonatype
-
reporter Great - thanks for replacing javadoc to comments. (I don't mind at all!)
-
- changed status to open
Unfortunately, it does not solve the issue: https://github.com/spring-projects/spring-boot/issues/13191#issuecomment-416250859
The getters cannot be overloaded.
-
- changed status to resolved
Getters have been added
- Log in to comment
Yes, it will be accepted. Feel free to contribute.