From 6ac671cbff65b6d7ca411f65d0ceb08e589dbc4f Mon Sep 17 00:00:00 2001
From: Tomas Stupka <tomas.stupka@oracle.com>
Date: Wed, 28 Jun 2017 16:52:26 +0200
Subject: [PATCH] adjusted to changes in .fastr.interop builtin names

---
 com.oracle.truffle.r.pkgs/rJava/R/rj.R        | 22 +++++++++---------
 .../rJava/tests/testthat/testArrays.R         | 23 +++++++++----------
 2 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/com.oracle.truffle.r.pkgs/rJava/R/rj.R b/com.oracle.truffle.r.pkgs/rJava/R/rj.R
index 50508cf54c..eda1f99daa 100644
--- a/com.oracle.truffle.r.pkgs/rJava/R/rj.R
+++ b/com.oracle.truffle.r.pkgs/rJava/R/rj.R
@@ -13,8 +13,8 @@
 .jnew <- function (class, ..., check = TRUE, silent = !check) 
 {
     class <- gsub("/", ".", as.character(class))
-    co <- .fastr.java.class(class)
-    o <- .fastr.interop.new(co, ...)
+    co <- new.java.class(class)
+    o <- new.external(co, ...)
     invisible(o)
 }
 
@@ -25,7 +25,7 @@
 {
     if(is.character(obj)) {
         obj <- gsub("/", ".", as.character(obj))
-        co <- .fastr.java.class(obj)
+        co <- new.java.class(obj)
         r <- co[method](...)
     } else {
         r <- obj[method](...)
@@ -37,7 +37,7 @@
 .jfield <- function (obj, sig = NULL, name, true.class = is.null(sig), convert = TRUE) 
 {
     if(is.character(obj)) {
-        co <- .fastr.java.class(obj)
+        co <- new.java.class(obj)
         r <- co[name]
     } else {
         r <- obj[name]
@@ -48,7 +48,7 @@
 #' @export
 .jarray <- function (x, contents.class = NULL, dispatch = FALSE) 
 {
-    .fastr.java.toArray(x, ,TRUE)
+    as.java.array(x, ,TRUE)
 }
 
 #' @export
@@ -60,35 +60,35 @@
 #' @export
 .jbyte <- function (x) 
 {
-    x <- .fastr.interop.toByte(x)
+    x <- as.external.byte(x)
     invisible(x)
 }
 
 #' @export
 .jchar <- function (x) 
 {
-    x <- .fastr.interop.toChar(x)
+    x <- as.external.char(x)
     invisible(x)
 }
 
 #' @export
 .jshort <- function (x) 
 {
-    x <- .fastr.interop.toShort(x)
+    x <- as.external.short(x)
     invisible(x)
 }
 
 #' @export
 .jlong <- function (x) 
 {
-    x <- .fastr.interop.toLong(x)
+    x <- as.external.long(x)
     invisible(x)
 }
 
 #' @export
 .jfloat <- function (x) 
 {    
-    x <- .fastr.interop.toFloat(x)
+    x <- as.external.float(x)
     invisible(x)
 }
 
@@ -96,7 +96,7 @@
 J <- function (class, method, ...) 
 {    
     class <- gsub("/", ".", as.character(class))
-    javaClass <- .fastr.java.class(class)
+    javaClass <- new.java.class(class)
     if (nargs() == 1L && missing(method)) {
         javaClass
     } else {
diff --git a/com.oracle.truffle.r.pkgs/rJava/tests/testthat/testArrays.R b/com.oracle.truffle.r.pkgs/rJava/tests/testthat/testArrays.R
index a80f2bc813..07b9f0e184 100644
--- a/com.oracle.truffle.r.pkgs/rJava/tests/testthat/testArrays.R
+++ b/com.oracle.truffle.r.pkgs/rJava/tests/testthat/testArrays.R
@@ -11,27 +11,27 @@ test_that(testName, {
     cat(paste0(testName, "\n"))
 	
     a <- .jarray(c(1.1, 2.1, 3.1))
-    expect_true(.fastr.interop.isArray(a))
+    expect_true(is.external.array(a))
     expect_equal(length(a), 3)
     expect_equal(a[1], c(1.1))
     expect_equal(a[2], c(2.1))
     expect_equal(a[3], c(3.1))
 
     a <- .jarray(c(1L, 2L, 3L))
-    expect_true(.fastr.interop.isArray(a))
+    expect_true(is.external.array(a))
     expect_equal(length(a), 3)
     expect_equal(a[1], c(1))
     expect_equal(a[2], c(2))
     expect_equal(a[3], c(3))
 
     a <- .jarray(c(TRUE, FALSE))
-    expect_true(.fastr.interop.isArray(a))
+    expect_true(is.external.array(a))
     expect_equal(length(a), 2)
     expect_equal(a[1], TRUE)
     expect_equal(a[2], FALSE)
 
     a <- .jarray(c(.jbyte(1), .jchar("a"), .jfloat(1.1), .jlong(2), .jshort(123)))
-    expect_true(.fastr.interop.isArray(a))
+    expect_true(is.external.array(a))
     expect_equal(length(a), 5)
     expect_equal(a[1], 1)
     expect_equal(a[2], "a")
@@ -41,21 +41,20 @@ test_that(testName, {
 
     to <- .jnew('java.util.ArrayList')
     a <- .jarray(to)
-    expect_true(.fastr.interop.isArray(a))
+    expect_true(is.external.array(a))
     expect_equal(length(a), 1)
-    # fails at the moment
-    # expect_equal(a[1], to)
+    expect_equal(a[1], to)
 
     to <- .jnew('java.util.ArrayList')
     a <- .jarray(c(to, to))
-    expect_true(.fastr.interop.isArray(a))
-    expect_equal(length(a), 2)
+    expect_true(is.external.array(a))
     # fails at the moment    
+    # expect_equal(length(a), 2)
     # expect_equal(a[1], to)
     # expect_equal(a[2], to)
 
     a <- .jarray(list(1, 2, 3))
-    expect_true(.fastr.interop.isArray(a))
+    expect_true(is.external.array(a))
     expect_equal(length(a), 3)
     expect_equal(a[1], 1)
     expect_equal(a[2], 2)
@@ -72,7 +71,7 @@ test_that(testName, {
         Char=list("character", "a", "b", "c"), 
         Double=list("double",1.1, 2.1, 3.1), 
         Float=list("double", 1.1, 2.1, 3.1), 
-        Int=list("integer",1,2,3), 
+        Integer=list("integer",1,2,3), 
         Long=list("double", 1,2,3), 
         Short=list("integer",1,2,3), 
         String=list("character", "a", "b", "c"))
@@ -85,7 +84,7 @@ test_that(testName, {
         arrayType <- ev[[1]]
         arrayLength <- length(ev) - 1
         a<-t[fieldName]
-        expect_true(.fastr.interop.isArray(a), info=paste0("the array was returned for ", fieldName), label=".fastr.interop.isArray")
+        expect_true(is.external.array(a), info=paste0("the array was returned for ", fieldName), label="is.external.array")
         ae<-.jevalArray(a)
         expect_true(is.vector(ae), info=paste0("the array was returned for ", fieldName), label="is.vector")
         expect_equal(typeof(ae), arrayType, info=paste0("the array was returned for ", fieldName), label="typeof")
-- 
GitLab