RFR: 8211163: UNIX version of Java_java_io_Console_echo does not return a clean boolean

Volker Simonis volker.simonis at gmail.com
Fri Sep 28 13:55:11 UTC 2018


Hi Andrew,

I agree that the native code should be fixed and I think your patch is correct.

Nevertheless I'd vote for changing it to something like:

old = (tio.c_lflag & ECHO) == 0 ? JNI_FALSE : JNI_TRUE;

It's slightly more verbose, but it makes it more obvious that a JNI
function returning a jboolean should only ever return JNI_FALSE or
JNI_TRUE. This isn't obvious from your fix - especially not for C
programmers who produce such code.

Also, it would be good to change the bug summary to something more
generic like "Fix native library code which does not return a clean
boolean" and fix the additional occurrences of this antipattern
reported by Matthias in this mail thread:
http://mail.openjdk.java.net/pipermail/jdk-dev/2018-September/thread.html#1986
I think it would makelittle sense to open a new issue for each of
them.

Regards,
Volker

On Wed, Sep 26, 2018 at 8:54 PM Andrew Haley <aph at redhat.com> wrote:
>
> On 09/26/2018 06:07 PM, Ichiroh Takiguchi wrote:
> > Sorry for bad operation.
> > In case of s390x platform, this issue was fixed by JDK-8209637.
> > https://bugs.openjdk.java.net/browse/JDK-8209637
> >
> > If you could recreate this issue, please check JVM side also.
>
> That does not fix the bug, except by accident. The native code should
> be fixed too.
>
> See the explanation in
> https://bugs.openjdk.java.net/browse/JDK-8211163
>
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the core-libs-dev mailing list