Skip to content

Document.get_type_name() returns a java.lang.String on arcadedb-jvm, a str on arcadedb #286

Closed

Description

@tae898

Document.get_type_name() (and so Vertex and Edge) returns a Python str on the native arcadedb build but a raw java.lang.String on arcadedb-jvm. graph.py returns self._java_document.getTypeName() unconverted on the JVM build, while the native wrapper returns the str it got in its snapshot.

The Java string compares equal to a str, so record.get_type_name() == "Person" works on both. It is not a str subclass, so string operations fail: "created " + record.get_type_name() raises TypeError: can only concatenate str (not "java.lang.String") to str on arcadedb-jvm and works on arcadedb. record.get(...), to_dict() values and get_rid() are Python str on both builds.

I found it while writing the functions and events docs page (#284), where a page example failed on the JVM build in CI. The page now documents the difference and tells readers to use str(record.get_type_name()), with a test that pins it.

The fix is one line in graph.py (str(...) around getTypeName()), plus a test that asserts type(...) is str on both builds. I can send the PR once #284 has merged, so the page loses that bullet in the same change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in progressThe team is actively working on this issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions