Christopher Smith created TINKERPOP-2590:
--------------------------------------------
Summary: ClassCastException when specifying "single cardinality"
for edge property
Key: TINKERPOP-2590
URL: https://issues.apache.org/jira/browse/TINKERPOP-2590
Project: TinkerPop
Issue Type: Bug
Components: structure
Affects Versions: 3.4.8
Reporter: Christopher Smith
As I understand it, multi-properties are not supported on edges in Tinkerpop,
and this is an understandable limitation. However, my expectation as an API
client is that if I redundantly specify {{Cardinality.single}} when setting a
property on an edge, it would succeed silently. Instead
{{AddPropertyStep.java:151,153}} (as of 3.4.8) unconditionally casts the
traversal element to {{Vertex}} on seeing any {{Cardinality}} at all, producing
a confusing {{ClassCastException}}.
(1) In the case of {{single}}, which specifies the correct semantics, the call
should succeed. (This is relevant when trying to reuse a method to update a
single-valued timestamp on a generic {{Element}}.)
(2) It would be a major improvement to debugging to, instead of performing
inline casting, use a wrapper method producing an error message such as
"property cardinality may only be specified for a Vertex".
There are many cases throughout the code where (2) applies; would you be
interested in contributions to retrofit enhanced error messages?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)