From 1aaa6e9f113849e2d9f0e5ab2b17194cb15b477a Mon Sep 17 00:00:00 2001 From: stepan <stepan.sindelar@oracle.com> Date: Tue, 6 Feb 2018 15:22:20 +0100 Subject: [PATCH] RConnection#readLines gives more granular control over reported warnings --- .../r/nodes/builtin/base/ConnectionFunctions.java | 5 +++-- .../oracle/truffle/r/nodes/builtin/base/Parse.java | 6 ++++-- .../truffle/r/nodes/builtin/base/ReadDCF.java | 6 ++++-- .../oracle/truffle/r/nodes/builtin/base/Scan.java | 6 ++++-- .../nodes/builtin/base/foreign/ReadTableHead.java | 6 ++++-- .../truffle/r/runtime/conn/ConnectionSupport.java | 11 ++++++----- .../r/runtime/conn/DelegateRConnection.java | 13 +++++++------ .../r/runtime/conn/DelegateWriteRConnection.java | 5 +++-- .../truffle/r/runtime/conn/FileConnections.java | 7 ++++--- .../oracle/truffle/r/runtime/conn/RConnection.java | 14 ++++++++++++-- .../truffle/r/runtime/conn/StdConnections.java | 5 +++-- .../truffle/r/runtime/conn/TextConnections.java | 5 +++-- 12 files changed, 57 insertions(+), 32 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java index 96b23862ed..eb61710d5e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,6 +86,7 @@ import com.oracle.truffle.r.runtime.conn.FileConnections.CompressedRConnection; import com.oracle.truffle.r.runtime.conn.FileConnections.FileRConnection; import com.oracle.truffle.r.runtime.conn.PipeConnections.PipeRConnection; import com.oracle.truffle.r.runtime.conn.RConnection; +import com.oracle.truffle.r.runtime.conn.RConnection.ReadLineWarning; import com.oracle.truffle.r.runtime.conn.RawConnections.RawRConnection; import com.oracle.truffle.r.runtime.conn.SocketConnections.RSocketConnection; import com.oracle.truffle.r.runtime.conn.TextConnections.TextRConnection; @@ -616,7 +617,7 @@ public abstract class ConnectionFunctions { protected Object readLines(int con, int n, boolean ok, boolean warn, @SuppressWarnings("unused") String encoding, boolean skipNul) { // TODO Implement argument 'encoding'. try (RConnection openConn = RConnection.fromIndex(con).forceOpen("rt")) { - String[] lines = openConn.readLines(n, warn, skipNul); + String[] lines = openConn.readLines(n, ReadLineWarning.allIf(warn), skipNul); if (n > 0 && lines.length < n && !ok) { throw error(RError.Message.TOO_FEW_LINES_READ_LINES); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java index 784cddf210..78a6313f14 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; +import java.util.EnumSet; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Specialization; @@ -49,6 +50,7 @@ import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.conn.ConnectionSupport; import com.oracle.truffle.r.runtime.conn.RConnection; +import com.oracle.truffle.r.runtime.conn.RConnection.ReadLineWarning; import com.oracle.truffle.r.runtime.conn.StdConnections; import com.oracle.truffle.r.runtime.context.Engine.ParseException; import com.oracle.truffle.r.runtime.context.RContext; @@ -119,7 +121,7 @@ public abstract class Parse extends RBuiltinNode.Arg6 { throw RError.nyi(this, "parse from stdin not implemented"); } try (RConnection openConn = connection.forceOpen("r")) { - lines = openConn.readLines(0, false, false); + lines = openConn.readLines(0, EnumSet.noneOf(ReadLineWarning.class), false); } catch (IOException ex) { throw error(RError.Message.PARSE_ERROR); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadDCF.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadDCF.java index 7b259a0324..faeb83d55f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadDCF.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadDCF.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import static com.oracle.truffle.r.runtime.builtins.RBehavior.IO; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; import java.io.IOException; +import java.util.EnumSet; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -43,6 +44,7 @@ import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.conn.RConnection; +import com.oracle.truffle.r.runtime.conn.RConnection.ReadLineWarning; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RNull; @@ -71,7 +73,7 @@ public abstract class ReadDCF extends RBuiltinNode.Arg3 { keepWhiteSet.add(keepWhite.getDataAt(i)); } } - dcf = DCF.read(openConn.readLines(0, true, false), keepWhiteSet); + dcf = DCF.read(openConn.readLines(0, EnumSet.noneOf(ReadLineWarning.class), false), keepWhiteSet); } catch (IOException ex) { throw error(RError.Message.ERROR_READING_CONNECTION, ex.getMessage()); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Scan.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Scan.java index 0cbba8600c..ac44cef5b2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Scan.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Scan.java @@ -29,6 +29,7 @@ import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; import java.io.IOException; import java.util.ArrayList; +import java.util.EnumSet; import java.util.HashMap; import com.oracle.truffle.api.CompilerDirectives; @@ -44,6 +45,7 @@ import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.conn.RConnection; +import com.oracle.truffle.r.runtime.conn.RConnection.ReadLineWarning; import com.oracle.truffle.r.runtime.conn.StdConnections; import com.oracle.truffle.r.runtime.data.RComplex; import com.oracle.truffle.r.runtime.data.RDataFactory; @@ -189,7 +191,7 @@ public abstract class Scan extends RBuiltinNode.Arg19 { try (RConnection openConn = data.con.forceOpen("r")) { if (nskip > 0) { - openConn.readLines(nskip, true, skipNull); + openConn.readLines(nskip, EnumSet.of(ReadLineWarning.EMBEDDED_NUL), skipNull); } if (what instanceof RList) { return scanFrame((RList) what, nmax, nlines, flush, fill, strip == RRuntime.LOGICAL_TRUE, blSkip, multiLine, data); @@ -276,7 +278,7 @@ public abstract class Scan extends RBuiltinNode.Arg19 { private static String[] getItems(LocalData data, boolean blSkip) throws IOException { while (true) { - String[] str = data.con.readLines(1, true, false); + String[] str = data.con.readLines(1, EnumSet.of(ReadLineWarning.EMBEDDED_NUL), false); if (str == null || str.length == 0) { return null; } else { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/ReadTableHead.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/ReadTableHead.java index 9c3477a46d..8d14c507c3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/ReadTableHead.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/ReadTableHead.java @@ -5,7 +5,7 @@ * * Copyright (c) 1995-2012, The R Core Team * Copyright (c) 2003, The R Foundation - * Copyright (c) 2015, 2017, Oracle and/or its affiliates + * Copyright (c) 2015, 2018, Oracle and/or its affiliates * * All rights reserved. */ @@ -13,6 +13,7 @@ package com.oracle.truffle.r.nodes.builtin.base.foreign; import java.io.IOException; import java.util.ArrayList; +import java.util.EnumSet; import java.util.List; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; @@ -22,6 +23,7 @@ import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.conn.RConnection; +import com.oracle.truffle.r.runtime.conn.RConnection.ReadLineWarning; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; @@ -47,7 +49,7 @@ public abstract class ReadTableHead extends RExternalBuiltinNode.Arg7 { List<String> lines = new ArrayList<>(nlines); int totalLines = 0; while (totalLines < nlines) { - String[] readLines = openConn.readLines(nlines - totalLines, true, skipNull); + String[] readLines = openConn.readLines(nlines - totalLines, EnumSet.of(ReadLineWarning.EMBEDDED_NUL, ReadLineWarning.INCOMPLETE_LAST_LINE), skipNull); if (readLines.length == 0) { break; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java index 50b92a236f..d60b9779df 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,7 @@ import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; import java.util.ArrayList; import java.util.Arrays; +import java.util.EnumSet; import java.util.LinkedList; import java.util.List; @@ -372,7 +373,7 @@ public class ConnectionSupport { private static final int INVALID_DESCRIPTOR = -1; @Override - public String[] readLines(int n, boolean warn, boolean skipNul) throws IOException { + public String[] readLines(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { throw RInternalError.shouldNotReachHere("INVALID CONNECTION"); } @@ -757,7 +758,7 @@ public class ConnectionSupport { opened = true; } - protected String[] readLinesInternal(int n, boolean warn, boolean skipNul) throws IOException { + protected String[] readLinesInternal(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { checkOpen(); return theConnection.readLines(n, warn, skipNul); } @@ -956,7 +957,7 @@ public class ConnectionSupport { * available. */ @TruffleBoundary - private String[] readLinesWithPushBack(int n, boolean warn, boolean skipNul) throws IOException { + private String[] readLinesWithPushBack(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { // NOTE: 'n' may be negative indicating to read as much lines as available final List<String> res; if (n >= 0) { @@ -996,7 +997,7 @@ public class ConnectionSupport { } @Override - public String[] readLines(int n, boolean warn, boolean skipNul) throws IOException { + public String[] readLines(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { if (pushBack == null) { return readLinesInternal(n, warn, skipNul); } else if (pushBack.size() == 0) { 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 ea6a5e4b63..b490128e61 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,7 @@ import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CodingErrorAction; import java.util.ArrayList; +import java.util.EnumSet; import java.util.Objects; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; @@ -129,13 +130,13 @@ abstract class DelegateRConnection extends RObject implements RConnection, ByteC /** * {@code readLines} from the connection. It would be convenient to use a {@link BufferedReader} * but mixing binary and text operations, which is a requirement, would then be difficult. - * - * @param warn Specifies if warnings should be output. + * + * @param warn Specifies which warnings should be output. * @param skipNul Specifies if the null character should be ignored. */ @Override @TruffleBoundary - public String[] readLines(int n, boolean warn, boolean skipNul) throws IOException { + public String[] readLines(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { base.setIncomplete(false); ArrayList<String> lines = new ArrayList<>(); int totalRead = 0; @@ -165,7 +166,7 @@ abstract class DelegateRConnection extends RObject implements RConnection, ByteC base.setIncomplete(true); } else { lines.add(incompleteFinalLine); - if (warn) { + if (warn.contains(ReadLineWarning.INCOMPLETE_LAST_LINE)) { RError.warning(RError.SHOW_CALLER, RError.Message.INCOMPLETE_FINAL_LINE, base.getSummaryDescription()); } } @@ -184,7 +185,7 @@ abstract class DelegateRConnection extends RObject implements RConnection, ByteC } } else if (ch == 0) { nullRead = true; - if (warn && !skipNul) { + if (warn.contains(ReadLineWarning.EMBEDDED_NUL) && !skipNul) { RError.warning(RError.SHOW_CALLER, RError.Message.LINE_CONTAINS_EMBEDDED_NULLS, lines.size() + 1); } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateWriteRConnection.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateWriteRConnection.java index f436a0a2f1..3f0553fdd7 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateWriteRConnection.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateWriteRConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ package com.oracle.truffle.r.runtime.conn; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; +import java.util.EnumSet; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RInternalError; @@ -41,7 +42,7 @@ abstract class DelegateWriteRConnection extends DelegateRConnection { } @Override - public String[] readLines(int n, boolean warn, boolean skipNul) throws IOException { + public String[] readLines(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { throw new IOException(RError.Message.CANNOT_READ_CONNECTION.message); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java index 7ff189d0fa..1f3bbdfbf7 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,7 @@ import java.nio.file.OpenOption; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.ArrayList; +import java.util.EnumSet; import java.util.List; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -443,7 +444,7 @@ public class FileConnections { } @Override - public String[] readLines(int n, boolean warn, boolean skipNul) throws IOException { + public String[] readLines(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { setReadPosition(); return super.readLines(n, warn, skipNul); } @@ -598,7 +599,7 @@ public class FileConnections { } @Override - public String[] readLines(int n, boolean warn, boolean skipNul) throws IOException { + public String[] readLines(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { setReadPosition(); return super.readLines(n, warn, skipNul); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/RConnection.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/RConnection.java index df7d420c8b..374e373677 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/RConnection.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/RConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; +import java.util.EnumSet; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.BaseRConnection; @@ -129,6 +130,15 @@ public interface RConnection extends AutoCloseable, RTruffleObject { WRITE } + enum ReadLineWarning { + EMBEDDED_NUL, + INCOMPLETE_LAST_LINE; + + public static EnumSet<ReadLineWarning> allIf(boolean warn) { + return warn ? EnumSet.of(ReadLineWarning.EMBEDDED_NUL, ReadLineWarning.INCOMPLETE_LAST_LINE) : EnumSet.noneOf(ReadLineWarning.class); + } + } + /** * Support for {@code isSeekable} Internal. */ @@ -209,7 +219,7 @@ public interface RConnection extends AutoCloseable, RTruffleObject { * Read (n > 0 up to n else unlimited) lines on the connection. */ @TruffleBoundary - String[] readLines(int n, boolean warn, boolean skipNul) throws IOException; + String[] readLines(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException; /** * Returns {@code true} iff this is a text mode connection. diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/StdConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/StdConnections.java index fdbf611d92..9925131aad 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/StdConnections.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/StdConnections.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.EnumSet; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.r.runtime.RError; @@ -202,7 +203,7 @@ public class StdConnections { @Override @TruffleBoundary - public String[] readLinesInternal(int n, boolean warn, boolean skipNul) throws IOException { + public String[] readLinesInternal(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { ArrayList<String> lines = new ArrayList<>(); String line; while ((line = console.readLine()) != null) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/TextConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/TextConnections.java index 6b3fdc3863..f40da5e069 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/TextConnections.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/TextConnections.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; import java.util.ArrayList; +import java.util.EnumSet; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RInternalError; @@ -104,7 +105,7 @@ public class TextConnections { } @Override - public String[] readLines(int n, boolean warn, boolean skipNul) throws IOException { + public String[] readLines(int n, EnumSet<ReadLineWarning> warn, boolean skipNul) throws IOException { int nleft = lines.length - index; int nlines = nleft; if (n > 0) { -- GitLab