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
Work around limitation for JDK12+ about j.l.constant.Constable #1941
Conversation
2a1110e
to
08433f5
Compare
If we're going that route, we should also add However, I'm not a fan of adding those, because we will have to leave their methods undeclared, given that we cannot implement them. We're only pushing problems a bit further. Can we fix the test suite so that those types are not inferred instead? |
@sjrd yes, you raised a very good point. Let split it to two separated topic:
|
I could just add these changes to the JUnit PR so I don't have to rebase these. |
Gosh, I was trying the latest with AdoptOpenJDK 15 and got this.
|
@errikos yes, scala doesn't compatible with JDK15+. You can use this branch that fixes the issue: scala/scala#9239 |
@sjrd let me rebase this branch |
@catap Thanks for being patient with your change. Not sure that the second file got rebased correctly. |
`java.lang.Constable` was introduced at JDK12 and simple case: ``` Seq(Double.box(1d), "") ``` has type such as `Seq[java.lang.constant.Constable with ...]` Because Scala-Native hasn't got `java.lang.constant.Constable` and it is impossibly to implement it forces build of test to fail. This way is allow to fix build by forces compiler to use `Object`.
@sjrd maybe move forward on it? |
…-native#1941) `java.lang.constant.Constable` was introduced at JDK12 and is a super trait of core boxed classes. This causes code like val seq = Seq(Double.box(1d), "") val elem = seq.head to infer types that mention `Constable`: `seq` is of type `Seq[Constable with ...]` and `elem` of type `Constable with ...`. The latter erases to `Constable`, which results in linking errors. It is unfortunately impossible to correctly implement `Constable` in Scala Native, because it requires reflection, so the general issue is not fixable. This commit works around the issue in our own test suite, by ascribing some values with explicit types, so that `Constable` does not appear in erased types.
scala-native#1941)" This reverts commit 51576dc.
scala-native#1941)" This reverts commit 51576dc.
…-native#1941) `java.lang.constant.Constable` was introduced at JDK12 and is a super trait of core boxed classes. This causes code like val seq = Seq(Double.box(1d), "") val elem = seq.head to infer types that mention `Constable`: `seq` is of type `Seq[Constable with ...]` and `elem` of type `Constable with ...`. The latter erases to `Constable`, which results in linking errors. It is unfortunately impossible to correctly implement `Constable` in Scala Native, because it requires reflection, so the general issue is not fixable. This commit works around the issue in our own test suite, by ascribing some values with explicit types, so that `Constable` does not appear in erased types.
…-native#1941) `java.lang.constant.Constable` was introduced at JDK12 and is a super trait of core boxed classes. This causes code like val seq = Seq(Double.box(1d), "") val elem = seq.head to infer types that mention `Constable`: `seq` is of type `Seq[Constable with ...]` and `elem` of type `Constable with ...`. The latter erases to `Constable`, which results in linking errors. It is unfortunately impossible to correctly implement `Constable` in Scala Native, because it requires reflection, so the general issue is not fixable. This commit works around the issue in our own test suite, by ascribing some values with explicit types, so that `Constable` does not appear in erased types.
java.lang.Constable was introduced at JDK12 and it requires to link an application by scala-native via JDK12+.
It oversteps #1938