FelixGail / gplaymusic

A Google Play Music API in Java
MIT License
54 stars 15 forks source link

Don't use Java optional #37

Closed Alia5 closed 6 years ago

Alia5 commented 6 years ago

Java optional prevents use on Android < SDK24 ;)

BjoernPetersen commented 6 years ago

This project also uses Streams, method references (invokedynamic) and other Java 8 APIs, so I don't think it would be practical to retrofit it to Java 7 API-level.

FelixGail commented 6 years ago

You could try to use Retrolambda or force the compiler to emit java7 bytecode (https://stackoverflow.com/a/22610424), but i am not sure how good the result will be.

Alia5 commented 6 years ago

@BjoernPetersen You can add this to the android section of your build.gradle file to get many Java8 features on earlier SDKs

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

With this, "Java optional" and "java.awt.Color" are the things that hinder this form working on Android as far as I noticed yet.

BjoernPetersen commented 6 years ago

@Alia5 Those features exclude most Stream/functional APIs (for SDK < 24). You're right about method references though, I remembered that wrong.

FelixGail commented 6 years ago

java.awt.Color will be removed in the next version (#36) to make this library android compatible. But I don't plan on backporting it to java7.

FelixGail commented 6 years ago

Closed due to inactivity. Please reopen the issue if needed.