Skip to content

Commit

Permalink
hope this solves the graal js issues with java interop #1558
Browse files Browse the repository at this point in the history
more details at the issue comments
  • Loading branch information
ptrthomas committed May 23, 2021
1 parent 66aeaa3 commit e4f527a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ private Object recurseAndAttach(Object o, Set<Object> seen) {
return attach(value);
}
} catch (Exception e) {
logger.trace("failed to re-attach graal value (will re-try): {}", e.getMessage());
logger.trace("[attach] failed to re-attach graal value (will re-try): {}", e.getMessage());
try {
return Value.asValue(value.asHostObject());
} catch (Exception inner) {
Expand Down Expand Up @@ -1142,12 +1142,12 @@ private Object recurseAndAttachAndDeepClone(Object o, Set<Object> seen) {
// should never happen if the detach was done properly
Value value = (Value) o;
try {
if (value.canExecute()) {
if (value.canExecute() || value.isMetaObject()) {
return attach(value);
}
o = JsValue.toJava(value);
} catch (Exception e) {
logger.trace("failed to re-attach graal value (will re-try): {}", e.getMessage());
logger.trace("[attach deep] failed to re-attach graal value (will re-try): {}", e.getMessage());
try {
return Value.asValue(value.asHostObject());
} catch (Exception inner) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class ParallelJavaTest {

// @Test
@Test
public void testParallel() {
Results results = Runner.path("classpath:com/intuit/karate/core/parajava/parallel-java.feature")
.configDir("classpath:com/intuit/karate/core/parajava")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ void testValueAndHostObject() {
Value v = Value.asValue(sp);
assertTrue(v.isHostObject());
}

@Test
void testJavaType() {
Value v = je.evalForValue("Java.type('com.intuit.karate.graal.SimplePojo')");
assertTrue(v.isMetaObject());
assertTrue(v.isHostObject());
}

@Test
void testEvalWithinFunction() {
Expand Down

0 comments on commit e4f527a

Please sign in to comment.