Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
6ac671cb
Commit
6ac671cb
authored
7 years ago
by
Tomas Stupka
Browse files
Options
Downloads
Patches
Plain Diff
adjusted to changes in .fastr.interop builtin names
parent
ee32e015
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
com.oracle.truffle.r.pkgs/rJava/R/rj.R
+11
-11
11 additions, 11 deletions
com.oracle.truffle.r.pkgs/rJava/R/rj.R
com.oracle.truffle.r.pkgs/rJava/tests/testthat/testArrays.R
+11
-12
11 additions, 12 deletions
com.oracle.truffle.r.pkgs/rJava/tests/testthat/testArrays.R
with
22 additions
and
23 deletions
com.oracle.truffle.r.pkgs/rJava/R/rj.R
+
11
−
11
View file @
6ac671cb
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
.jnew
<-
function
(
class
,
...
,
check
=
TRUE
,
silent
=
!
check
)
.jnew
<-
function
(
class
,
...
,
check
=
TRUE
,
silent
=
!
check
)
{
{
class
<-
gsub
(
"/"
,
"."
,
as.character
(
class
))
class
<-
gsub
(
"/"
,
"."
,
as.character
(
class
))
co
<-
.fastr
.java.class
(
class
)
co
<-
new
.java.class
(
class
)
o
<-
.fastr.interop.new
(
co
,
...
)
o
<-
new.external
(
co
,
...
)
invisible
(
o
)
invisible
(
o
)
}
}
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
{
{
if
(
is.character
(
obj
))
{
if
(
is.character
(
obj
))
{
obj
<-
gsub
(
"/"
,
"."
,
as.character
(
obj
))
obj
<-
gsub
(
"/"
,
"."
,
as.character
(
obj
))
co
<-
.fastr
.java.class
(
obj
)
co
<-
new
.java.class
(
obj
)
r
<-
co
[
method
](
...
)
r
<-
co
[
method
](
...
)
}
else
{
}
else
{
r
<-
obj
[
method
](
...
)
r
<-
obj
[
method
](
...
)
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
.jfield
<-
function
(
obj
,
sig
=
NULL
,
name
,
true.class
=
is.null
(
sig
),
convert
=
TRUE
)
.jfield
<-
function
(
obj
,
sig
=
NULL
,
name
,
true.class
=
is.null
(
sig
),
convert
=
TRUE
)
{
{
if
(
is.character
(
obj
))
{
if
(
is.character
(
obj
))
{
co
<-
.fastr
.java.class
(
obj
)
co
<-
new
.java.class
(
obj
)
r
<-
co
[
name
]
r
<-
co
[
name
]
}
else
{
}
else
{
r
<-
obj
[
name
]
r
<-
obj
[
name
]
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
#' @export
#' @export
.jarray
<-
function
(
x
,
contents.class
=
NULL
,
dispatch
=
FALSE
)
.jarray
<-
function
(
x
,
contents.class
=
NULL
,
dispatch
=
FALSE
)
{
{
.fastr
.java.
toA
rray
(
x
,
,
TRUE
)
as
.java.
a
rray
(
x
,
,
TRUE
)
}
}
#' @export
#' @export
...
@@ -60,35 +60,35 @@
...
@@ -60,35 +60,35 @@
#' @export
#' @export
.jbyte
<-
function
(
x
)
.jbyte
<-
function
(
x
)
{
{
x
<-
.fastr.interop.toB
yte
(
x
)
x
<-
as.external.b
yte
(
x
)
invisible
(
x
)
invisible
(
x
)
}
}
#' @export
#' @export
.jchar
<-
function
(
x
)
.jchar
<-
function
(
x
)
{
{
x
<-
.fastr.interop.toC
har
(
x
)
x
<-
as.external.c
har
(
x
)
invisible
(
x
)
invisible
(
x
)
}
}
#' @export
#' @export
.jshort
<-
function
(
x
)
.jshort
<-
function
(
x
)
{
{
x
<-
.fastr.interop.toS
hort
(
x
)
x
<-
as.external.s
hort
(
x
)
invisible
(
x
)
invisible
(
x
)
}
}
#' @export
#' @export
.jlong
<-
function
(
x
)
.jlong
<-
function
(
x
)
{
{
x
<-
.fastr.interop.toL
ong
(
x
)
x
<-
as.external.l
ong
(
x
)
invisible
(
x
)
invisible
(
x
)
}
}
#' @export
#' @export
.jfloat
<-
function
(
x
)
.jfloat
<-
function
(
x
)
{
{
x
<-
.fastr.interop.toF
loat
(
x
)
x
<-
as.external.f
loat
(
x
)
invisible
(
x
)
invisible
(
x
)
}
}
...
@@ -96,7 +96,7 @@
...
@@ -96,7 +96,7 @@
J
<-
function
(
class
,
method
,
...
)
J
<-
function
(
class
,
method
,
...
)
{
{
class
<-
gsub
(
"/"
,
"."
,
as.character
(
class
))
class
<-
gsub
(
"/"
,
"."
,
as.character
(
class
))
javaClass
<-
.fastr
.java.class
(
class
)
javaClass
<-
new
.java.class
(
class
)
if
(
nargs
()
==
1L
&&
missing
(
method
))
{
if
(
nargs
()
==
1L
&&
missing
(
method
))
{
javaClass
javaClass
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
com.oracle.truffle.r.pkgs/rJava/tests/testthat/testArrays.R
+
11
−
12
View file @
6ac671cb
...
@@ -11,27 +11,27 @@ test_that(testName, {
...
@@ -11,27 +11,27 @@ test_that(testName, {
cat
(
paste0
(
testName
,
"\n"
))
cat
(
paste0
(
testName
,
"\n"
))
a
<-
.jarray
(
c
(
1.1
,
2.1
,
3.1
))
a
<-
.jarray
(
c
(
1.1
,
2.1
,
3.1
))
expect_true
(
.fastr.interop.isA
rray
(
a
))
expect_true
(
is.external.a
rray
(
a
))
expect_equal
(
length
(
a
),
3
)
expect_equal
(
length
(
a
),
3
)
expect_equal
(
a
[
1
],
c
(
1.1
))
expect_equal
(
a
[
1
],
c
(
1.1
))
expect_equal
(
a
[
2
],
c
(
2.1
))
expect_equal
(
a
[
2
],
c
(
2.1
))
expect_equal
(
a
[
3
],
c
(
3.1
))
expect_equal
(
a
[
3
],
c
(
3.1
))
a
<-
.jarray
(
c
(
1L
,
2L
,
3L
))
a
<-
.jarray
(
c
(
1L
,
2L
,
3L
))
expect_true
(
.fastr.interop.isA
rray
(
a
))
expect_true
(
is.external.a
rray
(
a
))
expect_equal
(
length
(
a
),
3
)
expect_equal
(
length
(
a
),
3
)
expect_equal
(
a
[
1
],
c
(
1
))
expect_equal
(
a
[
1
],
c
(
1
))
expect_equal
(
a
[
2
],
c
(
2
))
expect_equal
(
a
[
2
],
c
(
2
))
expect_equal
(
a
[
3
],
c
(
3
))
expect_equal
(
a
[
3
],
c
(
3
))
a
<-
.jarray
(
c
(
TRUE
,
FALSE
))
a
<-
.jarray
(
c
(
TRUE
,
FALSE
))
expect_true
(
.fastr.interop.isA
rray
(
a
))
expect_true
(
is.external.a
rray
(
a
))
expect_equal
(
length
(
a
),
2
)
expect_equal
(
length
(
a
),
2
)
expect_equal
(
a
[
1
],
TRUE
)
expect_equal
(
a
[
1
],
TRUE
)
expect_equal
(
a
[
2
],
FALSE
)
expect_equal
(
a
[
2
],
FALSE
)
a
<-
.jarray
(
c
(
.jbyte
(
1
),
.jchar
(
"a"
),
.jfloat
(
1.1
),
.jlong
(
2
),
.jshort
(
123
)))
a
<-
.jarray
(
c
(
.jbyte
(
1
),
.jchar
(
"a"
),
.jfloat
(
1.1
),
.jlong
(
2
),
.jshort
(
123
)))
expect_true
(
.fastr.interop.isA
rray
(
a
))
expect_true
(
is.external.a
rray
(
a
))
expect_equal
(
length
(
a
),
5
)
expect_equal
(
length
(
a
),
5
)
expect_equal
(
a
[
1
],
1
)
expect_equal
(
a
[
1
],
1
)
expect_equal
(
a
[
2
],
"a"
)
expect_equal
(
a
[
2
],
"a"
)
...
@@ -41,21 +41,20 @@ test_that(testName, {
...
@@ -41,21 +41,20 @@ test_that(testName, {
to
<-
.jnew
(
'java.util.ArrayList'
)
to
<-
.jnew
(
'java.util.ArrayList'
)
a
<-
.jarray
(
to
)
a
<-
.jarray
(
to
)
expect_true
(
.fastr.interop.isA
rray
(
a
))
expect_true
(
is.external.a
rray
(
a
))
expect_equal
(
length
(
a
),
1
)
expect_equal
(
length
(
a
),
1
)
# fails at the moment
expect_equal
(
a
[
1
],
to
)
# expect_equal(a[1], to)
to
<-
.jnew
(
'java.util.ArrayList'
)
to
<-
.jnew
(
'java.util.ArrayList'
)
a
<-
.jarray
(
c
(
to
,
to
))
a
<-
.jarray
(
c
(
to
,
to
))
expect_true
(
.fastr.interop.isArray
(
a
))
expect_true
(
is.external.array
(
a
))
expect_equal
(
length
(
a
),
2
)
# fails at the moment
# fails at the moment
# expect_equal(length(a), 2)
# expect_equal(a[1], to)
# expect_equal(a[1], to)
# expect_equal(a[2], to)
# expect_equal(a[2], to)
a
<-
.jarray
(
list
(
1
,
2
,
3
))
a
<-
.jarray
(
list
(
1
,
2
,
3
))
expect_true
(
.fastr.interop.isA
rray
(
a
))
expect_true
(
is.external.a
rray
(
a
))
expect_equal
(
length
(
a
),
3
)
expect_equal
(
length
(
a
),
3
)
expect_equal
(
a
[
1
],
1
)
expect_equal
(
a
[
1
],
1
)
expect_equal
(
a
[
2
],
2
)
expect_equal
(
a
[
2
],
2
)
...
@@ -72,7 +71,7 @@ test_that(testName, {
...
@@ -72,7 +71,7 @@ test_that(testName, {
Char
=
list
(
"character"
,
"a"
,
"b"
,
"c"
),
Char
=
list
(
"character"
,
"a"
,
"b"
,
"c"
),
Double
=
list
(
"double"
,
1.1
,
2.1
,
3.1
),
Double
=
list
(
"double"
,
1.1
,
2.1
,
3.1
),
Float
=
list
(
"double"
,
1.1
,
2.1
,
3.1
),
Float
=
list
(
"double"
,
1.1
,
2.1
,
3.1
),
Int
=
list
(
"integer"
,
1
,
2
,
3
),
Int
eger
=
list
(
"integer"
,
1
,
2
,
3
),
Long
=
list
(
"double"
,
1
,
2
,
3
),
Long
=
list
(
"double"
,
1
,
2
,
3
),
Short
=
list
(
"integer"
,
1
,
2
,
3
),
Short
=
list
(
"integer"
,
1
,
2
,
3
),
String
=
list
(
"character"
,
"a"
,
"b"
,
"c"
))
String
=
list
(
"character"
,
"a"
,
"b"
,
"c"
))
...
@@ -85,7 +84,7 @@ test_that(testName, {
...
@@ -85,7 +84,7 @@ test_that(testName, {
arrayType
<-
ev
[[
1
]]
arrayType
<-
ev
[[
1
]]
arrayLength
<-
length
(
ev
)
-
1
arrayLength
<-
length
(
ev
)
-
1
a
<-
t
[
fieldName
]
a
<-
t
[
fieldName
]
expect_true
(
.fastr.interop.isA
rray
(
a
),
info
=
paste0
(
"the array was returned for "
,
fieldName
),
label
=
"
.fastr.interop.isA
rray"
)
expect_true
(
is.external.a
rray
(
a
),
info
=
paste0
(
"the array was returned for "
,
fieldName
),
label
=
"
is.external.a
rray"
)
ae
<-
.jevalArray
(
a
)
ae
<-
.jevalArray
(
a
)
expect_true
(
is.vector
(
ae
),
info
=
paste0
(
"the array was returned for "
,
fieldName
),
label
=
"is.vector"
)
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"
)
expect_equal
(
typeof
(
ae
),
arrayType
,
info
=
paste0
(
"the array was returned for "
,
fieldName
),
label
=
"typeof"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment