Skip to content

contribute upickle codec #1164

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

Merged
merged 5 commits into from
Jul 2, 2024
Merged

Conversation

jam01
Copy link

@jam01 jam01 commented Jun 30, 2024

Here we go!

I tried to configure the upickle crossProject, but not very familiar with sbt to be honest.

I also took a look at the tests, but that I wasn't sure where/how to start. Here are my tests.

@plokhotnyuk
Copy link
Owner

@jam01 Thank you, Jose!

You can add your tests as is using Jupiter dependency at least for JVM sub-project. Later I will convert them to scala-test to be runnable on all platforms.

@jam01
Copy link
Author

jam01 commented Jul 2, 2024

Added the tests. Hoping they run on CI, not sure if JUnit5 requires further setup in sbt

@plokhotnyuk
Copy link
Owner

@jam01 Could you please fetch upstream & rebase to pick support of Scala Native 0.5?

@jam01
Copy link
Author

jam01 commented Jul 2, 2024

Fixed the ujson dependency so the suffix can be replaced by the build framework. Jupiter will continue to fail though.

@plokhotnyuk
Copy link
Owner

plokhotnyuk commented Jul 2, 2024

Please try % instead of %%% for jupiter and java.lang.Double.isFinite(y) instead of y.isFinite to fix isFinite is not a member of Double compilation error

@jam01
Copy link
Author

jam01 commented Jul 2, 2024

Just realized I probably should've done a readLong and then checked for validity instead of readBigInt since Long is probably gonna be the common case

@plokhotnyuk
Copy link
Owner

plokhotnyuk commented Jul 2, 2024

A better option would be adding parsing of java.lang.Number in the JsonReader in a most efficient way to avoid redundant scanning or exception handling. That could be reused in the jsoniter-scala-circe module and for other applications that parse to some JSON AST.

Let's postpone that for follow up optimizations.

@plokhotnyuk
Copy link
Owner

plokhotnyuk commented Jul 2, 2024

There is a couple unit test compilation errors yet:

/home/runner/work/jsoniter-scala/jsoniter-scala/jsoniter-scala-upickle/jvm/src/test/scala/upickle/jsoniter/VisitorEncoderTest.scala:5:12: object skyscreamer is not a member of package org
[error] import org.skyscreamer.jsonassert.JSONAssert
[error]            ^
[error] /home/runner/work/jsoniter-scala/jsoniter-scala/jsoniter-scala-upickle/jvm/src/test/scala/upickle/jsoniter/VisitorEncoderTest.scala:25:34: type mismatch;
[error]  found   : upickle.jsoniter.ValueEncoder.type
[error]  required: com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec[ujson.Arr]
[error] Note: ujson.Value >: ujson.Arr (and upickle.jsoniter.ValueEncoder.type <: upickle.jsoniter.VisitorEncoder[ujson.Value]), but trait JsonValueCodec is invariant in type A.
[error] You may wish to define A as -A instead. (SLS 4.5)
[error]     val res = writeToString(arr)(ValueEncoder)
[error]                                  ^
[error] /home/runner/work/jsoniter-scala/jsoniter-scala/jsoniter-scala-upickle/jvm/src/test/scala/upickle/jsoniter/VisitorEncoderTest.scala:26:5: not found: value JSONAssert
[error]     JSONAssert.assertEquals(jsonStr, res, true)
[error]     ^
[error] three errors found

You can reproduce them by sbt jsoniter-scala-upickleJVM/test

@jam01
Copy link
Author

jam01 commented Jul 2, 2024

fixing the jsonassert dependency. The invariant error is strange, because it compiles and passes in my project... 🤔

@plokhotnyuk plokhotnyuk changed the base branch from master to upickle-visitor July 2, 2024 13:48
@plokhotnyuk
Copy link
Owner

I've changed the base branch to merge and see locally

@plokhotnyuk plokhotnyuk merged commit 0760465 into plokhotnyuk:upickle-visitor Jul 2, 2024
0 of 2 checks passed
plokhotnyuk pushed a commit that referenced this pull request Jul 3, 2024
contribute upickle codec
plokhotnyuk pushed a commit that referenced this pull request Dec 10, 2024
contribute upickle codec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants