File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot
com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop
com.oracle.truffle.host/src/com/oracle/truffle/host Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -1025,7 +1025,10 @@ public boolean hasStaticReceiver() {
10251025 /**
10261026 * Returns the static receiver associated with this value. A static receiver is an object that
10271027 * exposes static members, members whose values or behaviors are independent of any particular
1028- * instance of this value.
1028+ * instance of this value. If this value is a {@link #isMetaObject() metaobject}, its static
1029+ * receiver is the same object that would be returned for an instance of the type represented by
1030+ * that metaobject, it exposes the static members of the represented type rather than static
1031+ * members of the metaobject itself.
10291032 * <p>
10301033 * The returned static receiver can be used to access static members using
10311034 * {@link #getMember(String)}, {@link #getMemberKeys()}, or
Original file line number Diff line number Diff line change @@ -983,7 +983,10 @@ public boolean hasStaticReceiver(Object receiver) {
983983 /**
984984 * Returns the static receiver associated with the given receiver. A static receiver is an
985985 * object that exposes static members, members whose values or behaviors are independent of any
986- * particular instance of the receiver.
986+ * particular instance of the receiver. If the {@code receiver} is a
987+ * {@link #isMetaObject(Object) metaobject}, its static receiver is the same object that would
988+ * be returned for an instance of the type represented by that metaobject, it exposes the static
989+ * members of the represented type rather than static members of the metaobject itself.
987990 * <p>
988991 * The static receiver typically serves as an artificial or meta-level object that provides
989992 * access to instance-independent members declared by the receiver's type or meta object. The
Original file line number Diff line number Diff line change @@ -3427,7 +3427,12 @@ Object getStaticReceiver(
34273427 error .enter (node );
34283428 throw UnsupportedMessageException .create ();
34293429 }
3430- Class <?> clz = obj .getClass ();
3430+ Class <?> clz ;
3431+ if (isClass ()) {
3432+ clz = (Class <?>) obj ;
3433+ } else {
3434+ clz = obj .getClass ();
3435+ }
34313436 return HostObject .forStaticClass (clz , context );
34323437 }
34333438
You can’t perform that action at this time.
0 commit comments