https://kotlinlang.org logo
#arrow-contributors
Title
# arrow-contributors
p

pablisco

05/09/2020, 7:55 PM
Hey everyone, I’m wondering if anyone has had this issue before and how to resolve it. I’m creating a new module in the
arrow-fx
project and I need to target
jdk8
. I’ve changed the dependency to kotlin to use
kotlin-stdlib-jdk8
and I’ve added the following:
Copy code
compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

sourceCompatibility = "1.8"
targetCompatibility = "1.8"
I wasn’t sure if I needed both (kotlin and java compatibility markers) but I was trying to make it work. I’ve even changed
JAVA_VERSION
to be
1.8
on the modules
gradle.properties
file. Any who, despite all these changes, I’m getting the following errors from Animal Sniffer:
Copy code
[Undefined reference] arrow.fx.(_IO.kt:19)
  >> boolean java.util.concurrent.CompletableFuture.complete(Object)

[Undefined reference] arrow.fx.(_IO.kt:20)
  >> boolean java.util.concurrent.CompletableFuture.completeExceptionally(Throwable)

[Undefined reference] arrow.fx.(_IO.kt:21)
  >> boolean java.util.concurrent.CompletableFuture.completeExceptionally(Throwable)

[Undefined reference] arrow.fx.(_IO.kt:8)
  >> Object java.util.concurrent.CompletableFuture.get()

[Undefined reference] arrow.fx.(_IO.kt:16)
  >> java.util.concurrent.CompletableFuture

[Undefined reference] arrow.fx.(_IO.kt:16)
  >> void java.util.concurrent.CompletableFuture.<init>()

[Undefined reference] arrow.fx.(_IO.kt:12)
  >> boolean java.util.concurrent.CompletableFuture.cancel(boolean)
I’m having a look at this ticket: https://github.com/arrow-kt/arrow-fx/issues/153 These APIs were introduced on the jdk8, so this module needs to target that version (hence why it’s a separate module) Anyone has experienced on how to configure animal sniffer in this instance? If you want to check it locally this is the branch: https://github.com/arrow-kt/arrow-fx/tree/pabs-completable-future-integration
s

stojan

05/09/2020, 8:00 PM
this is what I have in my Android project
Copy code
compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    // For Kotlin projects
    kotlinOptions {
        jvmTarget = "1.8"
    }
not sure if it helps 🙂
p

pablisco

05/09/2020, 8:05 PM
Thanks for the suggestion. However, I think that those are inside the
android { }
closure, right? This is a plain kotlin.
s

stojan

05/09/2020, 8:35 PM
yup...
IMO it's time for arrow to move to Java8 min
p

pablisco

05/09/2020, 9:02 PM
That’s probably not a bad idea. Android (I think was the reason to keep it on 7) has great support for j8. And we can check for bytecode compatibility for Android 24, which is when CompletableFuture was introduced fully to Android.
Tat said I think we are checking against version 21 as defined on the root build script: https://github.com/arrow-kt/arrow-fx/blob/pabs-completable-future-integration/build.gradle#L38
And I think I just found the source of the problem 🎉
🎉 1
s

stojan

05/09/2020, 9:13 PM
at work we have been targeting Java8 bytecode since forever.... no problems at all
p

pablisco

05/09/2020, 9:55 PM
Yeah, should be ok. We should still check bytecode compatibility with Android SDK 21 though, as it supports a subset of what’s available in J8. It would be interesting to see if there is any performance benefits at compile and runtime 🤔 I’ve created this ticket: https://github.com/arrow-kt/arrow/issues/2138
Also, for reference, this is the fix for animal sniffer: https://github.com/arrow-kt/arrow-fx/commit/f529f3190d003028712a0074ab1345e79fb90e06
3 Views