Skip to content
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

use scala primitives (e.g. Integer -> Int) #271

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

mpollmeier
Copy link
Contributor

motivation: minify diff for flatgraph migration

motivation: minify diff for flatgraph migration
attention with autoconversions around `Option[Int]` and similar:

```
scala> Option(null: Integer)
val res0: Option[Integer] = None

scala> val o: Option[Int] = Option(null: Integer)
val o: Option[Int] = Some(0)

scala> val o: Option[Int] = Option(null: Integer).asInstanceOf[Option[Int]]
val o: Option[Int] = None
```
scala performs quite some magic to handle Option[Int], and the bytecode looks
differently if javac or scalac compile something like `val x: Option[Int]`:
```
// scalac:
public static flatgraph.SinglePropertyKey<java.lang.Object> ArgumentIndex();

//javac:
public static final overflowdb.PropertyKey<scala.Int> ARGUMENT_INDEX;
```

Hence, the best way forward is to define these constants in scala.
@mpollmeier mpollmeier merged commit 5042694 into master Jun 26, 2024
1 check passed
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