Hi Tim,

On Sun, 12 Jun 2022 at 20:32, Tim Perry <tim.v...@gmail.com> wrote:
> I've run into an issue where javac 11+ will emit valid java 8 code for
> functions that weren't added to Java until after java 8. When the code is
> run on Java 8 runtime errors appear complaining about functions missing
> from classes that are part of the JRE. Most recently I ran into this when I
> used java.lang.String@strip() in a library cross-compiled to java 8
> bytecode with Java 11 javac.

Are you sure that the library was compiled with `--release 8` and not
with `-source 8 -target 8`? `String#strip()` does not compile on my
JDK 11, as well as `ByteBuffer#position(int)` uses the correct return
type of `Buffer` (JRE 8) instead of `ByteBuffer` (JRE 11).

Piotr

Reply via email to