indexing JDK 10 from code running on Java 8

Remi Forax forax at univ-mlv.fr
Tue Oct 10 09:16:10 UTC 2017


Hi Roman,
that's a bug.

Some signature of java.nio.Buffer subclasses were changed in a source backward compatible way but not in a binary backward compatible way,
the way to fix the issue is to cast java.nio.ByteBuffer to java.nio.Buffer before calling limit().

I wonder why javac has not said that java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer do not exist when the code is compiled with --release 8.

And obviously, this can be fixed by rewriting the bytecode but i do not think it's the right solution here.

cheers,
Rémi

----- Mail original -----
> De: "Roman Shevchenko" <roman.shevchenko at jetbrains.com>
> À: jdk10-dev at openjdk.java.net
> Envoyé: Mardi 10 Octobre 2017 11:05:58
> Objet: Fwd: indexing JDK 10 from code running on Java 8

> Hi,
> 
> at the moment, IDEA is unable to index JDK 10 classes because
> lib/jrtf-s.jar is incompatible with Java 8. Migrating IDEA to Java 9 is one
> possible solution, but I'm afraid it will take more time than there is left
> before 18.3 nightly builds will start to appear. What other options do we
> have?
> 
> The problem:
> 
>  java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)
> Ljava/nio/ByteBuffer;
>      at jdk.internal.jimage.BasicImageReader.slice(
> BasicImageReader.java:211)
>      at jdk.internal.jimage.BasicImageReader.intBuffer(
> BasicImageReader.java:218)
>      at jdk.internal.jimage.BasicImageReader.<init>(
> BasicImageReader.java:152)
>      at jdk.internal.jimage.ImageReader$SharedImageReader.
> <init>(ImageReader.java:224)
>      at jdk.internal.jimage.ImageReader$SharedImageReader.
> open(ImageReader.java:238)
>      at jdk.internal.jimage.ImageReader.open(ImageReader.java:67)
>      at jdk.internal.jimage.ImageReader.open(ImageReader.java:71)
>      at jdk.internal.jrtfs.SystemImage.open(SystemImage.java:59)
>      at jdk.internal.jrtfs.JrtFileSystem.<init>(JrtFileSystem.java:90)
>      at jdk.internal.jrtfs.JrtFileSystemProvider.newFileSystem(
> JrtFileSystemProvider.java:108)
>      at java.nio.file.FileSystems.newFileSystem(FileSystems.java:336)
>      at com.intellij.openapi.vfs.impl.jrt.JrtHandler.getFileSystem(
> JrtHandler.java:80)
>      ... 73 more
> 
> --
> Roman Shevchenko
> JetBrains
> http://www.jetbrains.com
> The Drive to Develop


More information about the jdk10-dev mailing list