Support for standard library polyfills
See original GitHub issueI really like the idea behind this project. What the frontpage does not mention, is that a valid Java 8 bytecode can’t still have a hard time running on actual JRE8 because of missing pieces of the standard library like List.of()
.
So the idea is that the plugin could somehow rewrite references of java.util.List#of()
to a different static method in a specially created polyfill library.
What do you think?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Standard Library Polyfills Package - Pitches - Swift Forums
This library would backport standard library features to the minimum platform that would support their functionality.
Read more >Babel 6: configuring ES6 standard library and helpers - 2ality
This blog post explains how to configure how Babel 6 accesses its own helper functions and the ES6 standard library.
Read more >Polyfills and transpilers - The Modern JavaScript Tutorial
polyfill.io service that provides a script with polyfills, depending on the features and user's browser.
Read more >Polyfill - MDN Web Docs Glossary: Definitions of Web-related ...
The polyfill uses non-standard features in a certain browser to give JavaScript a standards-compliant way to access the feature.
Read more >Polyfill (programming) - Wikipedia
Most often, it refers to a JavaScript library that implements an HTML5 or CSS web standard, either an established standard (supported by some...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It also worth mentioning that the language features enabled by Jabel do not require any new stdlib methods btw
Hi, you might be interested in UniJ, which provides a backport of JDK 9+ APIs in the form of a facade.
E.g.
UniLists.of(1, 2)
corresponds toList.of(1, 2)
. At runtime, it delegates to:List.of(1, 2)
(for JDK 9+)Collections.unmodifiableList(Arrays.asList(1, 2))
(for JDK 8)If:
List.of
references intoUniLists.of
onesyou’d achieve the effect you want.
Instance methods (like
Optional.stream()
) would be much more problematic to rewrite, though.Disclaimer: I’m the author of UniJ.