bitcoin-s / bitcoin-s/bitcoin-s

Add abillity to target java 7 for android

Open
#331 1 comment 0 reactions 0 assignees View on GitHub
platforms
Dominant language
Scala
Stars
382
Forks
105
Avg merge
1d 13h
Merged PRs (30d)
44

Description

Here is the android docs talking about java 8+ and how to make it work with android:

https://developer.android.com/studio/write/java8-support

and here is scalac docs talking about targeting different java platform versions, specifically the `-release` flag. The `-release` flag isn't available until java 9.

https://docs.scala-lang.org/overviews/compiler-options/index.html

Here is what I think we would need built.sbt to look like

```scala
lazy val compilerOpts = Seq(
"-release", "7",
"-encoding",
"UTF-8",
"-unchecked",
"-feature",
"-deprecation",
"-Xfuture",
"-Ywarn-dead-code",
"-Ywarn-unused-import",
"-Ywarn-value-discard",
"-Ywarn-unused",
"-unchecked",
"-deprecation",
"-feature"
) ++ commonCompilerOpts
```

again, the dev environment requires java9 else i end up with these errors when trying to compile

```
[info] Compiling 9 Scala sources to /home/chris/dev/bitcoin-s-core/eclair-rpc/target/scala-2.12/classes ...
[error] -release is only supported on Java 9 and higher
[info] Updating testkit...
Waiting for lock on /home/chris/.ivy2/.sbt.ivy.lock to be available...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies.
[warn] Run 'evicted' to see detailed eviction warnings
[warn] /home/chris/dev/bitcoin-s-core/eclair-rpc/src/main/scala/org/bitcoins/eclair/rpc/config/EclairInstance.scala:7:52: Unused import
[warn] import com.typesafe.config.{Config, ConfigFactory, ConfigValueFactory}
[warn] ^
[warn] one warning found
[info] Done compiling.
[info] Compiling 19 Scala sources to /home/chris/dev/bitcoin-s-core/testkit/target/scala-2.12/classes ...
[error] -release is only supported on Java 9 and higher
[info] Done compiling.
[success] Total time: 152 s, completed Feb 7, 2019 8:08:01 PM
```

Contributor guide

Open the contributing guide

Research direction

Start by locating built.sbt and running the reported compilation under the project's supported JDKs; compare the existing compiler options with the Scala compiler-option documentation linked in the issue. Done means the project can target Java 7 for Android without the reported -release error, while the existing compilation warnings and options remain covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, scala
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.