Skip to content

Conversation

@d-michail
Copy link
Member

This is a very small backport to fix the issue that was reported in the mailing-list.

Android SDK 24 and newer versions include support for Java8 using the Jack and Jill tools. There are some bugs remaining which means that some code is still not yet supported. In our case this manifested in the vertex cover code as well as with serializable lambdas.

I tested the library and android studio manages to generate the apk using this setup

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "org.jgrapht.demo"
        minSdkVersion 24
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        jackOptions {
            enabled true
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

@jkinable
Copy link
Collaborator

I have mixed feelings about this PR. It's nice to support the people who are using Android, but personally I prefer the current version with the java 8 features. This update rolls back some code to a pre-java-8 state. The fact that Android still doesn't officially support java 8 is simply disappointing, especially if you take into account that the first java 8 release was in 2014. If developers start to make compromises (i.e. refraining from using java 8 features to support android), then there's even less motivation to finally add native java 8 support to Android... Even for the development of future code, we would have to check whether the code is written within the 'limitations' of Android.

What's your take on this @jsichi

@d-michail
Copy link
Member Author

They do support Java 8 but they still have a few bugs left. In our case all the other code of the library (including the other packages) compiles nicely, the only problem is the 2 small changes I made. I wouldn't bother if there were more problems.

Since we have added a significant amount of functionality from the 0.9 release, it would be nice to have a 1.0.x or 1.x release which is usable at least with Android SDK 24.

@jsichi
Copy link
Member

jsichi commented Mar 13, 2017

Since it's minor, seems reasonable to do it, but as Joris says, if major stuff starts coming up, we should punt.

I find it amusing that I'm able to compile my Scala projects for Android without issues.

@d-michail
Copy link
Member Author

d-michail commented Mar 15, 2017

The funny thing is that I tried to isolate the code that does not compile (in order to file a bug-report) and failed. If you start simplifying the code, it starts compiling even with the use all the Java 8 features.

So they have some strange bug that gets triggered by this specific code. This is the reason I am proposing to backport. It might also be the case that we could refactor a bit without backporting and not trigger their bug.

@d-michail
Copy link
Member Author

d-michail commented Mar 15, 2017

ok, took back the vertex cover backports, but slightly reformulated the stream operations to avoid unboxing.

This version works.

The only backport is the Serializable Lambda which they do not support yet (they actually issue a warning about that), and it is not really a backport as the code of the last release was not using a lambda.

@jsichi
Copy link
Member

jsichi commented Mar 20, 2017

Thanks!

@jsichi jsichi merged commit 231e897 into jgrapht:master Mar 20, 2017
@d-michail d-michail deleted the android-sdk-24-backport branch March 20, 2017 19:16
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.

3 participants