You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <de...@uima.apache.org> on 2018/11/12 15:44:00 UTC
[jira] [Comment Edited] (UIMA-5904) work around Java 11 build issue
with ByteBuffer return type change
[ https://issues.apache.org/jira/browse/UIMA-5904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16683943#comment-16683943 ]
Marshall Schor edited comment on UIMA-5904 at 11/12/18 3:43 PM:
----------------------------------------------------------------
-Richard, I attached a rebuilt jar for uimaj-core to this issue. It's built with Java 11, but with the workarounds for position and limit. Can you please test it with your setup? Thanks!-
Oops, I missed one instance of position(...), redoing...
was (Author: schor):
Richard, I attached a rebuilt jar for uimaj-core to this issue. It's built with Java 11, but with the workarounds for position and limit. Can you please test it with your setup? Thanks!
> work around Java 11 build issue with ByteBuffer return type change
> ------------------------------------------------------------------
>
> Key: UIMA-5904
> URL: https://issues.apache.org/jira/browse/UIMA-5904
> Project: UIMA
> Issue Type: Bug
> Components: Core Java Framework
> Environment: only happens when building with Java > 8 and then running with Java 8
> Reporter: Marshall Schor
> Assignee: Marshall Schor
> Priority: Major
> Fix For: 3.0.1SDK
>
> Attachments: uima-core.jar
>
>
> 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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)