Skip to content

Commit 6d58185

Browse files
committed
Rename getStaticReceiver to getStaticScope. GetStaticScope is supported only on meta object.
1 parent 1cc1826 commit 6d58185

File tree

22 files changed

+469
-197
lines changed

22 files changed

+469
-197
lines changed

sdk/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This changelog summarizes major changes between GraalVM SDK versions. The main f
1212
* GR-69590: Closing a garbage-collected engine or context now logs only the first failure by default. To log all failures, use `engine.CloseOnGCFailureAction.PrintAll`.
1313
* GR-35913: Updated the Javadoc of `Value#asHostObject()`, `Value#asNativePointer()`, and `Value#asProxyObject()` to clarify that these methods throw a `ClassCastException` rather than an `UnsupportedOperationException` when the value is not of the expected type.
1414
* GR-35913: `Value#asHostObject()` throws `UnsupportedOperationException` if object is allocated in a foreign heap.
15-
* GR-71402: Added `Value#hasStaticReceiver` and `Value#getStaticReceiver` returning the Value's static receiver.
15+
* GR-71402: Added `Value#hasStaticScope` and `Value#getStaticScope` returning the static scope representing static or class-level members associated with the meta object.
1616

1717
## Version 25.0.0
1818
* GR-60636 Truffle now stops compiling when the code cache fills up on HotSpot. A warning is printed when that happens.

sdk/src/org.graalvm.polyglot/snapshot.sigtest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ meth public boolean hasIteratorNextElement()
598598
meth public boolean hasMember(java.lang.String)
599599
meth public boolean hasMembers()
600600
meth public boolean hasMetaParents()
601-
meth public boolean hasStaticReceiver()
601+
meth public boolean hasStaticScope()
602602
meth public boolean isBoolean()
603603
meth public boolean isBufferWritable()
604604
meth public boolean isDate()
@@ -660,7 +660,7 @@ meth public org.graalvm.polyglot.Value getIteratorNextElement()
660660
meth public org.graalvm.polyglot.Value getMember(java.lang.String)
661661
meth public org.graalvm.polyglot.Value getMetaObject()
662662
meth public org.graalvm.polyglot.Value getMetaParents()
663-
meth public org.graalvm.polyglot.Value getStaticReceiver()
663+
meth public org.graalvm.polyglot.Value getStaticScope()
664664
meth public short asShort()
665665
meth public short readBufferShort(java.nio.ByteOrder,long)
666666
meth public static org.graalvm.polyglot.Value asValue(java.lang.Object)

sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot/Value.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,52 +1009,52 @@ public boolean removeMember(String identifier) {
10091009
}
10101010

10111011
/**
1012-
* Returns {@code true} if this value provides a {@linkplain #getStaticReceiver() static
1013-
* receiver}. A static receiver represents the static or class-level members associated with
1014-
* this value's type, such as static fields or methods.
1012+
* Returns {@code true} if this value is a {@linkplain #isMetaObject() meta object} that
1013+
* provides a {@linkplain #getStaticScope() static scope}. A static scope represents the static
1014+
* or class level members associated with the type described by this meta object, such as static
1015+
* fields or methods.
10151016
*
10161017
* @throws IllegalStateException if the context is already {@linkplain Context#close() closed}
10171018
* @throws PolyglotException if a guest language error occurs during execution
1018-
* @see #getStaticReceiver()
1019+
* @see #isMetaObject()
1020+
* @see #getStaticScope()
10191021
* @since 25.1
10201022
*/
1021-
public boolean hasStaticReceiver() {
1022-
return dispatch.hasStaticReceiver(this.context, receiver);
1023+
public boolean hasStaticScope() {
1024+
return dispatch.hasStaticScope(this.context, receiver);
10231025
}
10241026

10251027
/**
1026-
* Returns the static receiver associated with this value. A static receiver is an object that
1027-
* exposes static members, members whose values or behaviors are independent of any particular
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.
1028+
* Returns the static scope associated with this value. This value must be a
1029+
* {@linkplain #isMetaObject() meta-object}. A static scope is an object that exposes static
1030+
* members, members whose values or behavior are independent of any particular instance.
10321031
* <p>
1033-
* The returned static receiver can be used to access static members using
1032+
* The returned static scope can be used to access static members using
10341033
* {@link #getMember(String)}, {@link #getMemberKeys()}, or
10351034
* {@link #invokeMember(String, Object...)}.
10361035
* <p>
1037-
* The returned static receiver is always expected to provide {@link #hasMembers() members},
1038-
* representing the receiver's static context.
1036+
* The returned static scope is always expected to provide {@link #hasMembers() members},
1037+
* representing the static context.
10391038
* <p>
10401039
* <b>Examples:</b>
1040+
* </p>
10411041
* <ul>
1042-
* <li>For a Java class instance, the static receiver exposes the class's static fields and
1043-
* methods.</li>
1044-
* <li>For a Python object, the static receiver exposes class-level attributes and methods,
1045-
* effectively corresponding to the members provided by the Python metaobject.</li>
1042+
* <li>In Java, the static scope exposes static fields and methods of a class.</li>
1043+
* <li>In Python, the static scope exposes class-level attributes and methods, effectively
1044+
* corresponding to the members provided by the Python metaobject.</li>
10461045
* </ul>
10471046
*
10481047
* @throws UnsupportedOperationException if and only if this value does not
1049-
* {@linkplain #hasStaticReceiver() have a static receiver}
1048+
* {@linkplain #hasStaticScope() have a static scope}
10501049
* @throws IllegalStateException if the context is already {@linkplain Context#close() closed}
10511050
* @throws PolyglotException if a guest language error occurs during execution
1052-
* @see #hasStaticReceiver()
1053-
* @see #getMemberKeys()
1051+
* @see #hasStaticScope()
1052+
* @see #isMetaObject()
1053+
* @see #hasMembers()
10541054
* @since 25.1
10551055
*/
1056-
public Value getStaticReceiver() {
1057-
return (Value) dispatch.getStaticReceiver(this.context, receiver);
1056+
public Value getStaticScope() {
1057+
return (Value) dispatch.getStaticScope(this.context, receiver);
10581058
}
10591059

10601060
// executable

sdk/src/org.graalvm.polyglot/src/org/graalvm/polyglot/impl/AbstractPolyglotImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,11 +1137,11 @@ public Set<String> getMemberKeys(Object context, Object receiver) {
11371137

11381138
public abstract boolean removeMember(Object context, Object receiver, String key);
11391139

1140-
public boolean hasStaticReceiver(Object context, Object receiver) {
1140+
public boolean hasStaticScope(Object context, Object receiver) {
11411141
return false;
11421142
}
11431143

1144-
public abstract Object getStaticReceiver(Object context, Object receiver);
1144+
public abstract Object getStaticScope(Object context, Object receiver);
11451145

11461146
public boolean canExecute(Object context, Object receiver) {
11471147
return false;

truffle/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ This changelog summarizes major changes between Truffle versions relevant to lan
6161
* GR-71088 Added `CompilerDirectives.EarlyEscapeAnalysis` annotation that runs partial escape analysis early before partial evaluation enabling partial-evaluation-constant scalar replacements.
6262
* GR-71402: Added `InteropLibrary#hasHostObject` and `InteropLibrary#getHostObject` for accessing the Java host-object representation of a Truffle guest object. Deprecated `Env#isHostObject`, `Env#isHostException`, `Env#isHostFunction`, `Env#isHostSymbol`, `Env#asHostObject`, and `Env#asHostException` in favor of the new InteropLibrary messages.
6363
* GR-71402: Added `InteropLibrary#isHostObject` and `InteropLibrary#asHostObject` for accessing the Java host-object representation of a Truffle guest object. Deprecated `Env#isHostObject`, `Env#isHostException`, `Env#isHostFunction`, `Env#isHostSymbol`, `Env#asHostObject`, and `Env#asHostException` in favor of the new InteropLibrary messages.
64-
* GR-71402: Added `InteropLibrary#hasStaticReceiver` and `InteropLibrary#getStaticReceiver` returning the static receiver for given object.
64+
* GR-71402: Added `InteropLibrary#hasStaticScope` and `InteropLibrary#getStaticScope` returning the static scope representing static or class-level members associated with the given meta object.
6565

6666

6767
## Version 25.0

truffle/src/com.oracle.truffle.api.debug/snapshot.sigtest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ meth public final boolean isNull()
212212
meth public final com.oracle.truffle.api.debug.DebugValue asInLanguage(com.oracle.truffle.api.nodes.LanguageInfo)
213213
meth public final com.oracle.truffle.api.debug.DebugValue getMetaObject()
214214
meth public final com.oracle.truffle.api.debug.DebugValue getProperty(java.lang.String)
215-
meth public final com.oracle.truffle.api.debug.DebugValue getStaticReceiver()
215+
meth public final com.oracle.truffle.api.debug.DebugValue getStaticScope()
216216
meth public final com.oracle.truffle.api.nodes.LanguageInfo getOriginalLanguage()
217217
meth public final com.oracle.truffle.api.source.SourceSection getSourceLocation()
218218
meth public final java.lang.String asString()

truffle/src/com.oracle.truffle.api.debug/src/com/oracle/truffle/api/debug/DebugValue.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,19 +1033,19 @@ public void accept(Breakpoint b) {
10331033

10341034
/**
10351035
* Returns a value that provides static members whose value is independent on a specific
1036-
* instance. Returns {@code null} when no static receiver is available.
1036+
* instance. Returns {@code null} when no static scope is available.
10371037
*
10381038
* @throws DebugException when guest language code throws an exception
10391039
* @since 25.1
10401040
*/
1041-
public final DebugValue getStaticReceiver() {
1041+
public final DebugValue getStaticScope() {
10421042
if (!isReadable()) {
10431043
return null;
10441044
}
10451045
Object view = getLanguageView();
10461046
try {
1047-
if (INTEROP.hasStaticReceiver(view)) {
1048-
return new HeapValue(getSession(), resolveLanguage(), null, INTEROP.getStaticReceiver(view));
1047+
if (INTEROP.hasStaticScope(view)) {
1048+
return new HeapValue(getSession(), resolveLanguage(), null, INTEROP.getStaticScope(view));
10491049
}
10501050
} catch (ThreadDeath td) {
10511051
throw td;

truffle/src/com.oracle.truffle.api.interop/snapshot.sigtest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ meth public boolean hasMetaObject(java.lang.Object)
7171
meth public boolean hasMetaParents(java.lang.Object)
7272
meth public boolean hasScopeParent(java.lang.Object)
7373
meth public boolean hasSourceLocation(java.lang.Object)
74-
meth public boolean hasStaticReceiver(java.lang.Object)
74+
meth public boolean hasStaticScope(java.lang.Object)
7575
meth public boolean isArrayElementInsertable(java.lang.Object,long)
7676
meth public boolean isArrayElementModifiable(java.lang.Object,long)
7777
meth public boolean isArrayElementReadable(java.lang.Object,long)
@@ -148,7 +148,7 @@ meth public java.lang.Object getMetaParents(java.lang.Object) throws com.oracle.
148148
meth public java.lang.Object getMetaQualifiedName(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
149149
meth public java.lang.Object getMetaSimpleName(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
150150
meth public java.lang.Object getScopeParent(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
151-
meth public java.lang.Object getStaticReceiver(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
151+
meth public java.lang.Object getStaticScope(java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException
152152
meth public java.lang.Object readArrayElement(java.lang.Object,long) throws com.oracle.truffle.api.interop.InvalidArrayIndexException,com.oracle.truffle.api.interop.UnsupportedMessageException
153153
meth public java.lang.Object readHashValue(java.lang.Object,java.lang.Object) throws com.oracle.truffle.api.interop.UnknownKeyException,com.oracle.truffle.api.interop.UnsupportedMessageException
154154
meth public java.lang.Object readHashValueOrDefault(java.lang.Object,java.lang.Object,java.lang.Object) throws com.oracle.truffle.api.interop.UnsupportedMessageException

0 commit comments

Comments
 (0)