Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 9, 10, 11 JRE Emulation #9547

Closed
slavap opened this issue Sep 7, 2017 · 19 comments · Fixed by #9833
Closed

Java 9, 10, 11 JRE Emulation #9547

slavap opened this issue Sep 7, 2017 · 19 comments · Fixed by #9833
Assignees

Comments

@slavap
Copy link

slavap commented Sep 7, 2017

Just for the future java 9 support in GWT.

https://blog.codefx.org/java/java-9-stream/

@niloc132
Copy link
Member

As this seems to be the only jre+java9 issue so far, adding this too: http://openjdk.java.net/jeps/269

@niloc132 niloc132 self-assigned this Oct 17, 2018
@niloc132
Copy link
Member

niloc132 commented Oct 18, 2018

Additions so far:

java.util.List

  • of (with its zero-10 overloads, plus a varargs overload)
  • List copyOf(Collection) (Java 10)

java.util.Map

  • of (with its zero-10 key/value pair overloads, plus a varargs overload)
  • entry(K, V)
  • ofEntries(Entry...)
  • Map copyOf(Map) (Java 10)

java.util.Set

  • of (with its zero-10 overloads, plus a varargs overload)
  • Set copyOf(Collection) (Java 10)

java.util.stream.Stream

  • static Stream<T> iterate(T, Predicate<T>, UnaryOperator<T>)
  • static Stream<T> ofNullable(T)
  • Stream<T> dropWhile(Predicate<T>)
  • Stream<T> takeWhile(Predicate<T>)

java.util.stream.Collectors

  • static Collector flatMapping(Function, Collector)
  • static Collector filtering(Predicate, Collector)
  • static Collector toUnmodifiableMap() (Java 10)
  • static Collector toUnmodifiableList() (Java 10)
  • static Collector toUnmodifiableSet() (Java 10)

Anything I'm missing?

@niloc132 niloc132 changed the title Java 9 stream API extension Java 9, 10 JRE Emulation Oct 18, 2018
@axls
Copy link
Contributor

axls commented Oct 18, 2018

java.util.Enumeration

  • asIterator()

java.util.Optional

  • ifPresentOrElse(Consumer, Runnable)
  • or(Supplier)
  • stream()
  • orElseThrow() (Java 10)

@ibaca
Copy link
Contributor

ibaca commented Oct 27, 2018

I'm going to try to help with this missing emulation. I have made a pretty trivial PR just as starting point, and also, hehe it is an interface that I'm interested in 😉a reactive interface in the JRE.
https://gwt-review.googlesource.com/c/gwt/+/21420

@niloc132
Copy link
Member

Awesome! I've got the ones in my comment all written (and tests for about half of them), will try to get that batch up for review soon. The hard part at the moment is getting the tests to actually compile, as that requires using a java10+ jdk, which our current set of build scripts can't run on yet.

I've got this fork which refactors everything into modules (for use in maven, but gradle would be just as easy), maybe its time to pick that back up and finish it off...

jnehlmeier pushed a commit to jnehlmeier/gwt-sandbox that referenced this issue Oct 31, 2018
Bug: gwtproject#9547
Bug-Link: gwtproject#9547
Change-Id: I0e01ee3737ebee118db2b2e023cbe02beb9f2347
niloc132 pushed a commit to niloc132/gwt-playground that referenced this issue Dec 16, 2018
Bug: #9547
Bug-Link: gwtproject/gwt#9547
Change-Id: I0e01ee3737ebee118db2b2e023cbe02beb9f2347
@abashev
Copy link

abashev commented Aug 21, 2020

Missed API from Java 11

java.util.Optional

  • isEmpty()

@jnehlmeier jnehlmeier changed the title Java 9, 10 JRE Emulation Java 9, 10, 11 JRE Emulation Aug 22, 2020
@abashev
Copy link

abashev commented Aug 23, 2020

There is my PR https://gwt-review.googlesource.com/c/gwt/+/22740 for Optional.isEmpty

@abashev
Copy link

abashev commented Sep 13, 2020

@axls do I need something more to merge it into master branch?

@axls
Copy link
Contributor

axls commented Sep 14, 2020

@abashev PR should contains tests at least. But, IIUC, currently there is no final decision how to execute tests for Java 9+ (https://groups.google.com/g/google-web-toolkit-contributors/c/eyBpbrtYgyY).
@niloc132 Maybe I missed something and you have new information regarding testing jre emulation for Java 9+?

niloc132 added a commit that referenced this issue Jun 19, 2023
See earlier review at https://gwt-review.googlesource.com/c/gwt/+/21501.

Build changes get us ready for missing Java 10 and 11 emulation as
well.

Partial #9547
@niloc132
Copy link
Member

Reopening, only the first chunk of this is merged.

@niloc132 niloc132 reopened this Jun 19, 2023
niloc132 added a commit to niloc132/gwt that referenced this issue Jun 19, 2023
niloc132 added a commit to niloc132/gwt that referenced this issue Jun 19, 2023
niloc132 added a commit that referenced this issue Jul 3, 2023
niloc132 added a commit to niloc132/gwt that referenced this issue Jul 3, 2023
niloc132 added a commit that referenced this issue Sep 13, 2023
niloc132 added a commit that referenced this issue Nov 7, 2023
Partial #9547
Co-authored-by: Alexey Abashev <[email protected]>
niloc132 added a commit that referenced this issue Nov 10, 2023
@niloc132
Copy link
Member

With the last PRs submitted for review, I think everything here is covered?

@natros
Copy link
Contributor

natros commented Nov 10, 2023

java.util.function.Predicate#not (java 11) ?

@niloc132
Copy link
Member

Thanks @natros, I don't think that made any of the lists I'd seen so far. Want to propose a patch?

@natros
Copy link
Contributor

natros commented Nov 10, 2023

Thanks @natros, I don't think that made any of the lists I'd seen so far. Want to propose a patch?

I can try it over the weekend.

@jnehlmeier
Copy link
Member

@niloc132 How far do you want to go? All reasonable to emulate method additions of classes we already emulate?

@niloc132
Copy link
Member

niloc132 commented Nov 10, 2023

@jnehlmeier when we started, it was from a list you had made as I recall, and were picking out existing classes that were missing methods/etc. My goal for 2.11 was to at least finish off bringing those existing types up to Java 11 compatibility, so that 2.12 can drop Java 8 support (at least for compiling to JS) and target Java 17 features, then backfill from there on emulation. From my perspective, with these closed, we should finalize any PRs that are going to get more testing, and then cut a release, and then bump JDT and Jetty to whatever we can reasonably manage.

But I'd be happy closing the door on this particular issue, and following up with specific other emulation later.

@natros
Copy link
Contributor

natros commented Nov 12, 2023

#9862

niloc132 added a commit that referenced this issue Nov 13, 2023
@jnehlmeier
Copy link
Member

@jnehlmeier when we started, it was from a list you had made as I recall, and were picking out existing classes that were missing methods/etc. My goal for 2.11 was to at least finish off bringing those existing types up to Java 11 compatibility, so that 2.12 can drop Java 8 support (at least for compiling to JS) and target Java 17 features, then backfill from there on emulation. From my perspective, with these closed, we should finalize any PRs that are going to get more testing, and then cut a release, and then bump JDT and Jetty to whatever we can reasonably manage.

But I'd be happy closing the door on this particular issue, and following up with specific other emulation later.

@niloc132 Ok, then we are still missing some stuff in existing classes. But curating a list manually is always pretty time consuming. Maybe we should develop a tool that automates it. I once did a diff using Jdiff but because that tool is so old it was pretty annoying to get it running. Also the output is far from being instantly usable. Based on that diff I started jnehlmeier#15 but it is far from complete and also outdated right now.

niloc132 pushed a commit that referenced this issue Dec 5, 2023
Add missing `not` method to Predicate to be java 11 compatible.

Partial #9547
@niloc132
Copy link
Member

With completion of #9860, which as far as I can tell covers the remaining items mentioned in this ticket, I'm going to close this. We can open other tickets to list additional missing APIs, but there are tons of PRs already tied to this, and all closed for the moment.

niloc132 added a commit that referenced this issue Jan 29, 2024
Java 10 added copyOf static factory methods to produce immutable
List/Set/Map instances that contain no nulls.

Follow-up #9547
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants