changeset 22155:48004d27086d

Documenting the rules for subclasses
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Tue, 15 Sep 2015 09:30:22 +0200
parents cc195dd45121
children 50056a161d7f
files truffle/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/Message.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/Message.java	Tue Sep 15 09:22:09 2015 +0200
+++ b/truffle/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/Message.java	Tue Sep 15 09:30:22 2015 +0200
@@ -36,6 +36,16 @@
  */
 public abstract class Message {
     /**
+     * One can define their own extended message by subclassing. The expectation is that the
+     * subclass will have public constructor and its {@link #equals(java.lang.Object)} and
+     * {@link #hashCode()} methods will operate on the class equivalence. Only then the subclass
+     * will work properly with {@link #valueOf(java.lang.String)} and
+     * {@link #toString(com.oracle.truffle.api.interop.Message)} methods.
+     */
+    protected Message() {
+    }
+
+    /**
      * Message to read an object field. The
      * {@link Factory#access(com.oracle.truffle.api.interop.Message) target} created for this
      * message accepts (in addition to a