Extension and top-level functions to use JDK7/JDK8 features in Kotlin 1.0

Overview

kotlinx.support

Provides extension and top-level functions to use JDK7/JDK8 features in Kotlin 1.0.

In Kotlin 1.1+ please use the standard library artifacts instead: kotlin-stdlib-jdk7 and kotlin-stdlib-jdk8.

obsolete JetBrains project Download

Maven

Add jcenter repository (if you don't have it yet)

<repository>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <id>central</id>
    <name>bintray</name>
    <url>https://jcenter.bintray.com</url>
</repository>

Add a dependency:

<dependency>
    <groupId>org.jetbrains.kotlinx</groupId>
    <artifactId>kotlinx-support-jdk8</artifactId>
    <version>0.3</version>
</dependency>

Gradle

Just add a dependency:

compile 'org.jetbrains.kotlinx:kotlinx-support-jdk8:0.3'

jcenter repository should be configured by default in gradle, but if it's not you may need to include it:

repositories {
    jcenter()
}
You might also like...
Notemarks-app - An application that functions to take notes, there is a priority label to categorize which priority is more important find the top coffee shop near by a given location
find the top coffee shop near by a given location

YelpCoffee&Tea 2 Different Activities (Screens): coffee shop List, coffee shop detail View Android app displays coffee shop locations in specified loc

Bego Chat is chat application in Kotlin and Firebase with the following features: last seen , user status like typing ,online and last seen with MVVM pattern and clean architecture

Compose ChatApp(Bego Chat) Bego Chat is Compose chat application in Kotlin and Firebase with the following features: sending all file types and abilit

An extension of EditText with pin style written in Kotlin
An extension of EditText with pin style written in Kotlin

pin-edittext An extension of EditText with pin style Usage Include PinCodeEditText in your layout XML com.oakkub.android.PinEditText android:layo

A collection of useful Kotlin extension for Android

karamba A collection of useful Kotlin extension for Android Install Add to gradle in allprojects maven { url 'https://jitpack.io' } then add this com

Most used extension methods for Kotlin

Extensify Most used extension methods for Kotlin Download Step 1. Add the JitPack repository to your build file allprojects { repositories {

LifecycleMvp 1.2 0.0 Kotlin  is MVP architecture implementation with Android Architecture Components and Kotlin language features
LifecycleMvp 1.2 0.0 Kotlin is MVP architecture implementation with Android Architecture Components and Kotlin language features

MinSDK 14+ Download Gradle Add to project level build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' }

Provides Kotlin libs and some features for building Kotlin plugins
Provides Kotlin libs and some features for building Kotlin plugins

Kotlin Plugin Provides Kotlin libs and some features for building awesome Kotlin plugins. Can be used instead of CreeperFace's KotlinLib (don't use to

A collection of useful extension methods for Android

Kotlin Jetpack A collection of useful extension methods for Android Arguments Bindings Preferences Bindings Resources Bindings Arguments Bindings publ

Comments
  • AutoCloseable.use with null receiver causes cryptic exception

    AutoCloseable.use with null receiver causes cryptic exception

    Test code:

    // Kotlin
    fun main(args: Array<String>) {
      MyResourceFactory.get().use {
        throw Exception("1")
      }
    }
    
    class MyResource : AutoCloseable {
      override fun close() {
        println("close")
      }
    }
    
    // Java
    public class MyResourceFactory {
        public static MyResource get() {
            return null;
        }
    }
    

    This code results in this exception:

    Exception in thread "main" java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlinx.support.jdk7.AutoCloseableKt.closeSuppressed, parameter $receiver
        at kotlinx.support.jdk7.AutoCloseableKt.closeSuppressed(AutoCloseable.kt)
        at test.MainKt.main(main.kt:31)
    

    and original exception is eaten.

    If I use Closeable and use from a standard library, error message is much clearer:

    Exception in thread "main" java.lang.Exception: 1
    
    opened by vbezhenar 2
  • Extensions for 'Path' from JDK7

    Extensions for 'Path' from JDK7

    This is a work in progress.

    The current version is basically a copy/paste of the extensions we use internally. I think this already allows for much better code than Files.foo(Files.bar(...), Files.boo()). However, there's also an option of mirroring the API Kotlin provides for File.

    I'm not sure which way is best, what do you think?

    opened by superbobry 2
  • AutoCloseable.use must be implemented using try-finally

    AutoCloseable.use must be implemented using try-finally

    Example to reproduce:

    import kotlinx.support.jdk7.use
    
    fun main(args: Array<String>) {
      MyAutoCloseable().use {
        return
      }
    }
    
    class MyAutoCloseable : AutoCloseable {
      override fun close() {
        println("AutoCloseable.close")
      }
    }
    

    This example doesn't call close(). Standard library's Closeable.use correctly closes resource even with return.

    opened by vbezhenar 1
Releases(0.3)
  • 0.3(Aug 9, 2016)

  • 0.2(Jun 30, 2016)

    Changes in this release:

    • expose Throwable.suppressed as a property, in addition to getSuppressed() function;
    • utility extensions for Streams to convert them to List and Sequence;
    • fix bug #3 with non-local returns in AutoCloseable.use.
    Source code(tar.gz)
    Source code(zip)
Owner
Kotlin
Kotlin Tools and Libraries
Kotlin
A library provides some useful kotlin extension functions

ktext ?? A library provides some useful kotlin extension functions. Including in your project Gradle Add below codes to your root build.gradle file (n

热心市民苏苏仔 76 Oct 26, 2022
Use Flink's Stateful Functions as a control-plane technology for operating a streaming-platform

statefun-ops Use ?? Flink Stateful Functions as a control-plane technology for operating a streaming-platform based on Apache Kafka. Walkthrough Ensur

Dylan Meissner 8 Oct 1, 2022
A light weight Compose Animation library to choreograph low level Animation API through Kotlin DSL.

Koreography Choreograph your Compose Animation ?? ?? A lightweight Compose Animation utility library to choreograph low-level Animation API (https://d

Sagar Viradiya 107 Jan 8, 2023
A library with many useful and easy-to-use features

This library was made as a replacement for qLib and in the future cubed. These 2 plugins are hard to get you hands on and one of them has many outdated methods so this is a more modern version of those things

Max 1 May 6, 2022
Basic Android app to use Jetpack WorkManager API features

jetpack-work-manager-playground Basic Android app to use Jetpack WorkManager API features Jetpack WorkManager Playground Demo app Jetpack WorkManager

Raheem 0 Dec 9, 2021
ListUtil.kt ListUtils - Advance list functions from kotlin standard library

ListUtils - Advance list functions from kotlin standard library A set of utility functions to work with lists in a robust way. It is based on a patter

Zain Ul Hassan 1 May 6, 2022
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Practical Kotlin Multiplatform on the Web 본 저장소는 코틀린 멀티플랫폼 기반 웹 프로그래밍 워크숍(강좌)을 위해 작성된 템플릿 프로젝트가 있는 곳입니다. 워크숍 과정에서 코틀린 멀티플랫폼을 기반으로 프론트엔드(front-end)는 Ko

SpringRunner 14 Nov 5, 2022
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Building a Full Stack Web App with Kotlin Multiplatform 본 저장소는 INFCON 2022에서 코틀린 멀티플랫폼 기반 웹 프로그래밍 핸즈온랩을 위해 작성된 템플릿 프로젝트가 있는 곳입니다. 핸즈온 과정에서 코틀린 멀티플랫폼을

Arawn Park 19 Sep 8, 2022
A set of extension properties on Int, Long, Double, and Duration, that makes it easier to work with Kotlin Duration

Kotlin Duration Extensions Gradle Groovy repositories { mavenCentral() } implementation 'com.eygraber:kotlin-duration-extensions:1.0.1' Kotlin rep

Eliezer Graber 8 Nov 8, 2022
A collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android.

requireKTX requireKTX is a collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android, using the sam

Márton Braun 82 Oct 1, 2022