Make toString conversion explicit in CursorImpl
MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/ast/impl/CursorImpl.java
asciidoctorj-core/src/main/java/org/asciidoctor/ast/impl/CursorImpl.java
@@ -4,6 +4,8 @@ import org.asciidoctor.ast.Cursor;
import org.asciidoctor.internal.RubyObjectWrapper;
import org.jruby.runtime.builtin.IRubyObject;
+import java.util.Objects;
+
public class CursorImpl extends RubyObjectWrapper implements Cursor {
public CursorImpl(IRubyObject rubyNode) {
@@ -17,17 +19,20 @@ public class CursorImpl extends RubyObjectWrapper implements Cursor {
@Override
public String getPath() {
- return getString("path");
+ final Object result = getProperty("path");
+ return result == null ? null : result.toString();
}
@Override
public String getDir() {
- return getString("dir");
+ final Object result = getProperty("dir");
+ return result == null ? null : result.toString();
}
@Override
public String getFile() {
- return getString("file");
+ final Object result = getProperty("file");
+ return result == null ? null : result.toString();
}
@Override

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/internal/RubyObjectWrapper.java
asciidoctorj-core/src/main/java/org/asciidoctor/internal/RubyObjectWrapper.java
@@ -41,10 +41,8 @@ public class RubyObjectWrapper {
return null;
} else if (result instanceof RubySymbol) {
return ((RubySymbol) result).asJavaString();
- } else if (result instanceof RubyString){
- return ((RubyString) result).asJavaString();
} else {
- return Objects.toString(result);
+ return ((RubyString) result).asJavaString();
}
}

Make toString conversion explicit in CursorImpl