File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/jdk Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 68
68
import com .oracle .svm .core .heap .PodReferenceMapDecoder ;
69
69
import com .oracle .svm .core .hub .DynamicHub ;
70
70
import com .oracle .svm .core .hub .DynamicHubSupport ;
71
+ import com .oracle .svm .core .hub .HubType ;
71
72
import com .oracle .svm .core .hub .LayoutEncoding ;
72
73
import com .oracle .svm .core .meta .SharedType ;
73
74
import com .oracle .svm .core .snippets .KnownIntrinsics ;
@@ -90,14 +91,19 @@ public static void registerForeignCalls(SubstrateForeignCallsProvider foreignCal
90
91
}
91
92
92
93
@ SubstrateForeignCallTarget (stubCallingConvention = false )
94
+ // @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-21+35/src/hotspot/share/prims/jvm.cpp#L643-L692")
93
95
private static Object doClone (Object original ) throws CloneNotSupportedException , InstantiationException {
94
96
if (original == null ) {
95
97
throw new NullPointerException ();
96
98
} else if (!(original instanceof Cloneable )) {
97
- throw new CloneNotSupportedException ("Object is no instance of Cloneable." );
99
+ throw new CloneNotSupportedException ("Object is no instance of Cloneable: " + original . getClass (). getName () );
98
100
}
99
101
100
102
DynamicHub hub = KnownIntrinsics .readHub (original );
103
+ if (hub .getHubType () == HubType .REFERENCE_INSTANCE ) {
104
+ throw new CloneNotSupportedException ("Subclasses of java.lang.ref.Reference are not cloneable: " + hub .getName ());
105
+ }
106
+
101
107
int layoutEncoding = hub .getLayoutEncoding ();
102
108
boolean isArrayLike = LayoutEncoding .isArrayLike (layoutEncoding );
103
109
You can’t perform that action at this time.
0 commit comments