From f01806434a2a6ae870048b02b383c78b0de2b902 Mon Sep 17 00:00:00 2001 From: Miloslav Metelka <miloslav.metelka@oracle.com> Date: Thu, 11 May 2017 21:02:24 +0200 Subject: [PATCH] Changes to run FastR on JDK9. --- .../r/runtime/conn/DelegateRConnection.java | 34 ++----------------- mx.fastr/suite.py | 8 ----- 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateRConnection.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateRConnection.java index 437743ed51..d43eeb8e78 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateRConnection.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateRConnection.java @@ -45,9 +45,6 @@ import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.BaseRConnection; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; -import com.sun.istack.internal.NotNull; - -import sun.nio.cs.StreamDecoder; /** * Actually performs the I/O operations for a connections.<br> @@ -260,7 +257,7 @@ abstract class DelegateRConnection implements RConnection, ByteChannel { * @throws IOException */ @TruffleBoundary - public static void writeCharHelper(@NotNull WritableByteChannel channel, @NotNull String s, int pad, String eos) throws IOException { + public static void writeCharHelper(WritableByteChannel channel, String s, int pad, String eos) throws IOException { final byte[] bytes = s.getBytes(); final byte[] eosBytes = eos != null ? eos.getBytes() : null; @@ -332,31 +329,6 @@ abstract class DelegateRConnection implements RConnection, ByteChannel { return new String(buf.array(), 0, j); } - /** - * Reads a specified number of characters (not bytes).<br> - * <p> - * This method is meant to be used if R's function {@code readChar} is called with parameter - * {@code useBytes=FALSE}. - * </p> - * - * @param nchars The number of characters to read. - * @param decoder The stream decoder to use (must not be {@code null}). - * @throws IOException - */ - public static String readCharHelper(int nchars, StreamDecoder decoder) throws IOException { - // we need a decoder - char[] chars = new char[nchars]; - decoder.read(chars); - int j = 0; - for (; j < chars.length; j++) { - // strings end at 0 - if (chars[j] == 0) { - break; - } - } - return new String(chars, 0, j); - } - /** * Implements standard seeking behavior.<br> * <p> @@ -429,9 +401,9 @@ abstract class DelegateRConnection implements RConnection, ByteChannel { /** * Creates the stream decoder on demand and returns it. */ - protected StreamDecoder getDecoder(int bufSize) { + protected Reader getDecoder(int bufSize) { CharsetDecoder charsetEncoder = base.getEncoding().newDecoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE); - return StreamDecoder.forDecoder(this, charsetEncoder, bufSize); + return Channels.newReader(this, charsetEncoder, bufSize); } @Override diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index 3b6c062c36..75a963bb2e 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -80,11 +80,6 @@ suite = { "sha1" : "0baa82bff19059401e90e1b90020beb9c96305d7", }, - "JDK_TOOLS" : { - "path" : "${JAVA_HOME}/lib/tools.jar", - "sha1" : "NOCHECK", - }, - "ANTLR-C-3.5" : { "path" : "libdownloads/antlr-complete-3.5.1.jar", "urls" : ["http://central.maven.org/maven2/org/antlr/antlr-complete/3.5.1/antlr-complete-3.5.1.jar"], @@ -103,7 +98,6 @@ suite = { "com.oracle.truffle.r.parser.processor" : { "sourceDirs" : ["src"], "dependencies" : [ - "JDK_TOOLS", "ANTLR-3.5", "ANTLR-C-3.5", ], @@ -295,7 +289,6 @@ suite = { "subDir" : "truffle", "dependencies" : ["com.oracle.truffle.r.parser.processor"], "exclude" : [ - "JDK_TOOLS", "ANTLR-3.5", "ANTLR-C-3.5", ], @@ -308,7 +301,6 @@ suite = { "dependencies" : ["com.oracle.truffle.r.engine", "com.oracle.truffle.r.runtime.ffi"], "mainClass" : "com.oracle.truffle.r.engine.shell.RCommand", "exclude" : [ - "JDK_TOOLS", "truffle:JLINE", "ANTLR-C-3.5", "ANTLR-3.5", -- GitLab