47
47
import org .graalvm .nativeimage .Platform ;
48
48
import org .graalvm .nativeimage .Platforms ;
49
49
import org .graalvm .nativeimage .dynamicaccess .ForeignAccess ;
50
+ import org .graalvm .nativeimage .impl .APIDeprecationSupport ;
50
51
import org .graalvm .nativeimage .dynamicaccess .AccessCondition ;
51
52
import org .graalvm .nativeimage .impl .RuntimeForeignAccessSupport ;
52
53
53
54
@ Platforms (Platform .HOSTED_ONLY .class )
54
55
public final class RuntimeForeignAccess {
55
56
57
+ private static final APIDeprecationSupport deprecationFlag = ImageSingletons .lookup (APIDeprecationSupport .class );
58
+
56
59
/**
57
60
* Registers the provided function descriptor and options pair at image build time for downcalls
58
61
* into foreign code. Required to get a downcall method handle using
@@ -63,14 +66,15 @@ public final class RuntimeForeignAccess {
63
66
* performed to ensure that the arguments have the expected type. It will be deprecated in favor
64
67
* of strongly typed variant as soon as possible.
65
68
* <p>
66
- * This API is deprecated; use {@link ForeignAccess} instead.
69
+ * This API is deprecated; use the {@link ForeignAccess} instead.
67
70
*
68
71
* @param desc A {@link java.lang.foreign.FunctionDescriptor} to register for downcalls.
69
72
* @param options An array of {@link java.lang.foreign.Linker.Option} used for the downcalls.
70
73
*
71
74
* @since 23.1
72
75
*/
73
76
public static void registerForDowncall (Object desc , Object ... options ) {
77
+ deprecationFlag .printDeprecationWarning ();
74
78
ImageSingletons .lookup (RuntimeForeignAccessSupport .class ).registerForDowncall (AccessCondition .unconditional (), desc , options );
75
79
}
76
80
@@ -83,14 +87,15 @@ public static void registerForDowncall(Object desc, Object... options) {
83
87
* performed to ensure that the arguments have the expected type. It will be deprecated in favor
84
88
* of strongly typed variant as soon as possible.
85
89
* <p>
86
- * This API is deprecated; use {@link ForeignAccess} instead.
90
+ * This API is deprecated; use the {@link ForeignAccess} instead.
87
91
*
88
92
* @param desc A {@link java.lang.foreign.FunctionDescriptor} to register for upcalls.
89
93
* @param options An array of {@link java.lang.foreign.Linker.Option} used for the upcalls.
90
94
*
91
95
* @since 24.1
92
96
*/
93
97
public static void registerForUpcall (Object desc , Object ... options ) {
98
+ deprecationFlag .printDeprecationWarning ();
94
99
ImageSingletons .lookup (RuntimeForeignAccessSupport .class ).registerForUpcall (AccessCondition .unconditional (), desc , options );
95
100
}
96
101
@@ -112,7 +117,7 @@ public static void registerForUpcall(Object desc, Object... options) {
112
117
* of strongly typed variant as soon as possible.
113
118
* </p>
114
119
* <p>
115
- * This API is deprecated; use {@link ForeignAccess} instead.
120
+ * This API is deprecated; use the {@link ForeignAccess} instead.
116
121
*
117
122
* @param target A direct method handle denoting a static method.
118
123
* @param desc A {@link java.lang.foreign.FunctionDescriptor} to register for upcalls.
@@ -121,6 +126,7 @@ public static void registerForUpcall(Object desc, Object... options) {
121
126
* @since 24.2
122
127
*/
123
128
public static void registerForDirectUpcall (MethodHandle target , Object desc , Object ... options ) {
129
+ deprecationFlag .printDeprecationWarning ();
124
130
ImageSingletons .lookup (RuntimeForeignAccessSupport .class ).registerForDirectUpcall (AccessCondition .unconditional (), target , desc , options );
125
131
}
126
132
0 commit comments