You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -61,7 +61,7 @@ Computing metadata in code can be achieved in two ways:
61
61
return aClass;
62
62
}
63
63
}
64
-
```
64
+
```
65
65
66
66
When metadata is computed in code, the dynamically accessed elements will be included into the native executable's heap only if that part of the heap is reachable through an enclosing method (for example, `ReflectiveAccess#fetchFoo`) or a static field (for example, `InitializedAtBuildTime.aClass`).
67
67
@@ -89,6 +89,8 @@ A condition is specified in the following way:
89
89
An entry with a `typeReachable` condition is considered only when the fully-qualified class is reachable.
90
90
Currently, we support only `typeReachable` as a condition.
91
91
92
+
**Examples of the config files can be found in [GraalVM Reachability Metadata repository](https://github.com/oracle/graalvm-reachability-metadata)**
93
+
92
94
## Metadata Types
93
95
94
96
Native Image accepts the following types of reachability metadata:
The fields in a reflection entry have the following meaning:
181
-
-`condition`: See [Conditional Metadata Entries](#specifying-metadata-with-json)
182
-
-`name`: Name of the class that will be reflectively looked up. This property is mandatory.
183
-
-`methods`: List class methods that can be looked up and executed reflectively.
184
-
Each method is described by its name and a list of parameter types.
185
-
The parameter types are fully qualified Java class names.
186
-
-`queriedMethods`: List of class methods that can only be looked up.
187
-
The description of each method is identical to the `methods` list.
188
-
-`fields`: List of class fields that can be looked up, read, or modified.
189
-
-`all<access>(Methods/Fields/Constructors)`: Registers all methods/fields/constructors for lookup. Methods and constructors can also be invoked.
190
-
`<access>` refers to different ways of querying these members in Java and can be either `Declared` or `Public`.
191
-
For more information, see `java.lang.Class.getDeclaredMethods()` and `java.lang.Class.getPublicMethods()`.
192
-
-`queryAll<access>(Methods/Constructors)`: Registers all methods/constructors for lookup only.
193
-
-`unsafeAllocated`: Allows objects of this class to be allocated using `Unsafe.allocateInstance`.
149
+
Reflection metadata can be specified in the `reflect-config.json` file.
150
+
Detailed explanation of the config file can be found in the corresponding [json schema](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/reflect-config-schema-v1.0.0.json).
194
151
195
152
## Java Native Interface
196
153
@@ -214,7 +171,7 @@ It is not possible to specify JNI metadata in code.
214
171
215
172
### JNI Metadata in JSON
216
173
Metadata for JNI is provided in `jni-config.json` files.
217
-
The JSON schema of JNI metadata is identical to the [Reflection metadata schema](#specifying-reflection-metadata-in-json).
174
+
Detailed explanation of the config file can be found in the corresponding [json schema](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/jni-config-schema-v1.0.0.json).
218
175
219
176
## Resources and Resource Bundles
220
177
Java is capable of accessing any resource on the application class path, or the module path for which the requesting code has permission to access.
@@ -242,41 +199,7 @@ class Example {
242
199
243
200
### Resource Metadata in JSON
244
201
Metadata for resources is provided in `resource-config.json` files.
245
-
```json
246
-
{
247
-
"resources": {
248
-
"includes": [
249
-
{
250
-
"condition": {
251
-
"typeReachable": "<condition-class>"
252
-
},
253
-
"pattern": ".*\\.txt"
254
-
}
255
-
],
256
-
"excludes": [
257
-
{
258
-
"condition": {
259
-
"typeReachable": "<condition-class>"
260
-
},
261
-
"pattern": ".*\\.txt"
262
-
}
263
-
]
264
-
},
265
-
"bundles": [
266
-
{
267
-
"condition": {
268
-
"typeReachable": "<condition-class>"
269
-
},
270
-
"name": "fully.qualified.bundle.name",
271
-
"locales": ["en", "de", "sk"]
272
-
}
273
-
]
274
-
}
275
-
```
276
-
277
-
Native Image will iterate over all resources and match their relative paths against the Java regex specified in `includes`.
278
-
If the path matches the regex, the resource is included.
279
-
The `excludes` statement instructs `native-image` to omit certain included resources that match the given `pattern`.
202
+
Detailed explanation of the config file can be found in the corresponding [json schema](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/resource-config-schema-v1.0.0.json).
280
203
281
204
## Dynamic Proxy
282
205
@@ -316,20 +239,8 @@ The following methods are evaluated at build time when called with constant argu
316
239
- `java.lang.reflect.Proxy.newProxyInstance`
317
240
318
241
### Dynamic Proxy Metadata in JSON
319
-
Metadata for dynamic proxies is provided in `proxy-config.json` files.
320
-
```json
321
-
[
322
-
{
323
-
"condition": {
324
-
"typeReachable": "<condition-class>"
325
-
},
326
-
"interfaces": [
327
-
"IA",
328
-
"IB"
329
-
]
330
-
}
331
-
]
332
-
```
242
+
Metadata for resources is provided in `proxy-config.json` files.
243
+
Detailed explanation of the config file can be found in the corresponding [json schema](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/proxy-config-schema-v1.0.0.json).
333
244
334
245
## Serialization
335
246
Java can serialize any class that implements the `Serializable` interface.
@@ -367,41 +278,7 @@ Proxy classes can only be registered for serialization via the JSON files.
367
278
368
279
### Serialization Metadata in JSON
369
280
Metadata for serialization is provided in `serialization-config.json` files.
Each entry in `types` enables serializing and deserializing objects of the class given by `name`.
401
-
402
-
Each entry in `lambdaCapturingTypes` enables lambda serialization: all lambdas declared in the methods of the class given by `name` can be serialized and deserialized.
403
-
404
-
Each entry in `proxies` enables the [Proxy](https://docs.oracle.com/javase/8/docs/technotes/guides/reflection/proxy.html) serialization by providing an interface list that a proxy implements.
281
+
Detailed explanation of the config file can be found in the corresponding [json schema](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/serialization-config-schema-v1.0.0.json).
405
282
406
283
## Predefined Classes
407
284
@@ -419,21 +296,7 @@ It is not possible to specify predefined classes in code.
419
296
420
297
### Predefined Classes Metadata in JSON
421
298
Metadata for predefined classes is provided in `predefined-classes-config.json` files.
422
-
```json
423
-
[
424
-
{
425
-
"type": "agent-extracted",
426
-
"classes": [
427
-
{
428
-
"hash": "<class-bytecodes-hash>",
429
-
"nameInfo": "<class-name"
430
-
}
431
-
]
432
-
}
433
-
]
434
-
```
435
-
436
-
The JSON schema is accompanied by the `agent-extracted-predefined-classes` directory that contains the bytecode of the listed classes.
299
+
Detailed explanation of the config file can be found in the corresponding [json schema](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/predefined-classes-config-schema-v1.0.0.json).
"title": "JSON schema for the resource-config that GraalVM Native Image uses"
107
+
"title": "JSON schema for the resource-config that GraalVM Native Image uses",
108
+
"description": "Native Image will iterate over all resources and match their relative paths against the Java regex specified in <includes>.If the path matches the regex, the resource is included. The <excludes> statement instructs <native-image> to omit certain included resources that match the given <pattern>"
"title": "List of classes that should be serialized",
37
+
"title": "Each entry in <types> enables serializing and deserializing objects of the class given by <name>",
37
38
"type": "array"
38
39
},
39
40
"lambdaCapturingTypes": {
@@ -59,7 +60,7 @@
59
60
},
60
61
"type": "object"
61
62
},
62
-
"title": "List of classes that capture lambdas that should be serialized",
63
+
"title": "Each entry in <lambdaCapturingTypes> enables lambda serialization. All lambdas declared in the methods of the class given by <name> can be serialized and deserialized.",
63
64
"type": "array"
64
65
},
65
66
"proxies": {
@@ -93,7 +94,7 @@
93
94
"type": "object",
94
95
"title": "Proxy that should be registered for serialization"
95
96
},
96
-
"title": "List of proxiesthat should be serialized",
97
+
"title": "Each entry in <proxies> enables the proxy serialization by providing an interface list that a proxy implements.",
0 commit comments