Skip to content

Java 11 JRE emulationΒ #9831

Closed
Closed

Description

@rjeeb

Methods to support:

String:

  • lines()
  • isBlank()
  • format() (will not implement, this is missing deliberately from earlier versions of String)
  • repeat()
  • stripTrailing()
  • stripLeading()
  • strip()

Predicate (done):

  • not()

OptionalDouble (done):

  • isEmpty()

OptionalDouble (done):

  • isEmpty()

OptionalLong (done):

  • isEmpty()

CharSequence was split into #9991 so this could be closed as complete.

Activity

  1. changed the title [-]Java 11 String JRE emulation[/-] [+]Java 11 JRE emulation[/+] on May 19, 2023
  2. niloc132 commented on Jan 20, 2024

    @niloc132
    Member

    Predicate and Optional* are all merged.

    String.format() is likely not feasible - it requires parsing the format string at runtime, and handling the various possible patterns. That sort of code can't be optimized by the compiler without knowing ahead of time what all format strings will be.

    * <li>other methods which are not straightforward in JS
    * <ul>
    * <li>format(String format, Object... args)

    https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Formatter.html#syntax

    In theory we could require that the format param will be a string literal and pre-compile the formats so that unused formatting code can be pruned. In practice, that sort of change likely wouldn't be accepted to j2cl, so we should consider carefully if we want to introduce that incompatibility.

  3. zbynek commented on Jul 29, 2024

    @zbynek
    Collaborator

    Also CharSequence.chars is already implemented:

  4. niloc132 commented on Aug 9, 2024

    @niloc132
    Member

    Closing as fixed, all emulation mentioned here is fixed (CharSequence methods split into
    #9991 for later followup).

  5. added this to the 2.12 milestone on Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions