question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for standard library polyfills

See original GitHub issue

I 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:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
bsideupcommented, Sep 1, 2019

It also worth mentioning that the language features enabled by Jabel do not require any new stdlib methods btw

1reaction
tlinkowskicommented, Oct 7, 2019

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 to List.of(1, 2). At runtime, it delegates to:

  • either List.of(1, 2) (for JDK 9+)
  • or Collections.unmodifiableList(Arrays.asList(1, 2)) (for JDK 8)

If:

  • you added a dependency on UniJ
  • and Jabel could rewrite List.of references into UniLists.of ones

you’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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found