Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-5905

uv2 work around Java 11 build issue with ByteBuffer return type change

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.10.3SDK
    • None
    • Core Java Framework
    • None

    Description

      This is the UIMA Version 2 version of UIMA-5904 as a separate issue so they can be resolved separately.

      See https://github.com/apache/felix/pull/114 .

      Java 9 introduces overridden methods with covariant return types for the following methods in java.nio.ByteBuffer:

      position​(int newPosition)
      limit​(int newLimit)
      flip​()
      clear​()
      mark​()
      reset​()
      rewind​()

      In Java 9 they all now return ByteBuffer, whereas the methods they override return Buffer,
      resulting in exceptions like this when executing on Java 8 and lower:
      java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer
      This is because the generated byte code includes the static return type of the method, which is not found on Java 8 and lower because the overloaded methods with covariant return types don't exist (the issue appears even with source and target 8 or lower in compilation parameters).
      The solution is to cast ByteBuffer instances to Buffer before calling the method.

      The only use of these in UIMA is in DataIO class, and only the position(xxx) and limit(xxx) are used.

      Attachments

        Issue Links

          Activity

            People

              schor Marshall Schor
              schor Marshall Schor
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: