sangkyoonnam opened a new issue, #1152: URL: https://github.com/apache/flink-agents/issues/1152
### Search before asking - [x] I searched in the [issues](https://github.com/apache/flink-agents/issues) and found nothing similar. ### Description `MemoryRef` carries a `MemoryObject.MemoryType` and a path, but `equals`, `hashCode` and `toString` use only the path. `MemoryRef.create(SENSORY, "a.b")` and `MemoryRef.create(SHORT_TERM, "a.b")` compare equal, share a hash bucket and print the same string, although they name slots in two different memories. `equals` was written when the class had only a path (#110). The sensory-memory change added the type field and `create(type, path)` but left `equals`, `hashCode` and `toString` as they were. The Python `MemoryRef` is a frozen pydantic model, so it already compares and hashes both fields. `create` also accepts a null type or path. A null type is reported later as a `NullPointerException` from `resolve` or from the Jackson serializer; Python rejects `None` at construction. Expected: two references are equal only when both the memory type and the path are equal, `hashCode` and `toString` follow, and `create` rejects a null type or path with an `IllegalArgumentException`, as the JSON deserializer already does for a missing field. ### How to reproduce ```java MemoryRef sensory = MemoryRef.create(MemoryObject.MemoryType.SENSORY, "a.b"); MemoryRef shortTerm = MemoryRef.create(MemoryObject.MemoryType.SHORT_TERM, "a.b"); sensory.equals(shortTerm); // true new HashSet<>(List.of(sensory, shortTerm)).size(); // 1 MemoryRef.create(null, "a.b"); // no error until resolve or serialization ``` ### Version and environment main (`e8f79d51`). JDK 21, OS independent. Java side only; the Python model already behaves as expected. ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
