{"id":15068765,"url":"https://github.com/retropiler/retropiler","last_synced_at":"2026-03-04T18:02:53.675Z","repository":{"id":66138539,"uuid":"81319165","full_name":"retropiler/retropiler","owner":"retropiler","description":"PoC of Java8 Standard Library for Android for API version \u003e= 15","archived":false,"fork":false,"pushed_at":"2018-05-16T11:12:29.000Z","size":197,"stargazers_count":155,"open_issues_count":3,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-19T16:50:11.849Z","etag":null,"topics":["android","gradle-plugin","java8","retropiler"],"latest_commit_sha":null,"homepage":"https://gitter.im/retropiler/Lobby","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/retropiler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-02-08T10:45:06.000Z","updated_at":"2024-09-24T13:17:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"6527149a-4334-4f85-9de0-581ac44637b5","html_url":"https://github.com/retropiler/retropiler","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/retropiler/retropiler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retropiler%2Fretropiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retropiler%2Fretropiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retropiler%2Fretropiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retropiler%2Fretropiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/retropiler","download_url":"https://codeload.github.com/retropiler/retropiler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retropiler%2Fretropiler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30088340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","gradle-plugin","java8","retropiler"],"created_at":"2024-09-25T01:39:10.779Z","updated_at":"2026-03-04T18:02:53.667Z","avatar_url":"https://github.com/retropiler.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Retropiler [![CircleCI](https://circleci.com/gh/retropiler/retropiler.svg?style=svg)](https://circleci.com/gh/retropiler/retropiler) [ ![Download](https://api.bintray.com/packages/retropiler/maven/retropiler-gradle-plugin/images/download.svg) ](https://bintray.com/retropiler/maven/retropiler-gradle-plugin/_latestVersion)\n\n\"Java8 support\" in Android is sometimes misunderstood because it includes a few independent issues.\n\nJava8 Language Feature is usually syntactic one, for example lambda expressions or default methods; in Android, this is solved by tools like `retrolambda` or `desugar`.\n\nJava8 API, or Standard Library, is runtime library on the platform. The support of Standard Library in Android is more difficult than Language Feature, because dex, Dalvik executable file format, does not allow bundle Standard Library in APK. In fact, it was considered impossible -- before this project shows its possibility.\n\nRetropiler deals with the latter: it makes dex to bundle Java8 standard library by replacing\nits references to the original ones.\n\nFor example, the following code works on devices with Android API level 15 after processing by retropiler:\n\n```java\nimport java.util.Optional;\n\nOptional\u003cString\u003e optStr = Optional.of(\"foo\");\n\nassertThat(optStr.get(), is(\"foo\")); // it works!\n```\n\nHere is the magic.\n\nThe basic idea is that replacing Java8-specifc classes / methods to the bundled version of them\nwith bytecode weaving.\n\nThat is, the above code is transformed into:\n\n```java\nimport io.github.retropiler.runtime.java.util._Optional;\n\n_Optional\u003cString\u003e optStr = _Optional.of(\"foo\");\n\nassertThat(optStr.get(), is(\"foo\")); // it works!\n```\n\nIt can work even on Android API 15.\n\n## Installation\n\n```groovy:build.gradle\nbuildscript {\n    repositories {\n        jcenter()\n    }\n\n    dependencies {\n        classpath 'io.github.retropiler:retropiler-gradle-plugin:0.0.5'\n    }\n}\n\napply plugin: 'io.github.retropiler'\n```\n\n## Supported Classes\n\n### `Iterable#forEach()`\n\n```java\nArrays.asList(\"foo\", \"bar\").forEach(item -\u003e {\n    Log.d(\"XXX\", item);\n});\n```\n\n### `java.util.Optional`\n\n```java\nOptional\u003cString\u003e optStr = Optional.of(\"baz\");\noptStr.ifPresent(str -\u003e {\n    Log.d(\"XXX\", str);\n});\n```\n\n### Part of `java.util.function` package\n\nNot all the functions are tested yet.\n\n## Customizing Runtime Class Mapping\n\nYou can customize mapping of stndard class to alternative runtime class:\n\n```groovy:build.gradle\napply plugin: 'io.github.retropiler'\n\nretropiler {\n    // the default runtime package\n    runtimePackage \"io.github.retropiler.runtime\"\n\n    // the default mapping function\n    mapClassName { ext, ctClass -\u003e\n        // e.g. map java.util.Optional to io.github.retropiler.runtime.java.util._Optional\n        \"${ext.runtimePackage}.${ctClass.packageName}._${ctClass.simpleName}\"\n    }\n}\n```\n\n## Methods Count\n\nRetropiler depends on Retrolambda to transform lambda expressions to anonymous classes.\n\nThe methods defined in `runtime/` are here:\n\n[io.github.retropiler:retropiler-runtime:0.0.5](http://www.methodscount.com/?lib=io.github.retropiler%3Aretropiler-runtime%3A0.0.5)\n\n## Caveats\n\n* This project is incubating so use of it in production is not recommended.\n* The gradle plugin automatically applies `retrolambda`\n* The gradle plugin does not support Android SDK's desugar (bundled in the build tools for Android O)\n  * Will support desugar after its stable release\n\n## See Also\n\n* [Use Java 8 language features \\| Android Studio](https://developer.android.com/studio/preview/features/java8-support.html) explains the \"desugar\" process that, for example, transforms lambda expressions to anonymous class expressions\n* [Retrolambda](https://github.com/orfjackal/retrolambda)\n\n## Release Engineering\n\nThere are three modules to publish:\n\n* `plugin/` - Gradle plugin\n* `runtime/` - runtime library\n* `annotations/` - annotation library\n\nYou can publish them by:\n\n```shell\nmake publish\n```\n\nwith properties in `~/.gradle/gradle.properties`:\n\n```gradle.properties\nbintrayUser=$user\nbintrayKey=$key\n```\n\n## Authors and Contributors\n\nFUJI Goro ([gfx](https://github.com/gfx)).\n\nAnd contributors are listed here: [Contributors](https://github.com/retropiler/retropiler/graphs/contributors)\n\nThe class library in [runtime](https://github.com/retropiler/retropiler/tree/master/runtime) module comes from Open JDK via AOSP.\n\n## Licenses\n\nThe Java source files in `runtime/` module which were copied from AOSP, are licensed under GPL v2+CE as described in each file.\n\nOther modules except for `runtime/` are licensed under Apache License 2.0:\n\nCopyright (c) 2017 The Retropiler Project.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretropiler%2Fretropiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretropiler%2Fretropiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretropiler%2Fretropiler/lists"}