-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7329 from gunnarmorling/7066
Add support for registering classes for JNI runtime access
- Loading branch information
Showing
3 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
.../src/main/java/io/quarkus/deployment/builditem/nativeimage/JniRuntimeAccessBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package io.quarkus.deployment.builditem.nativeimage; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
/** | ||
* Used to register a class for JNI runtime access. | ||
*/ | ||
public final class JniRuntimeAccessBuildItem extends MultiBuildItem { | ||
|
||
private final List<String> className; | ||
private final boolean constructors; | ||
private final boolean methods; | ||
private final boolean fields; | ||
private final boolean finalFieldsWriteable; | ||
|
||
public JniRuntimeAccessBuildItem(boolean constructors, boolean methods, boolean fields, Class<?>... classes) { | ||
this(constructors, methods, fields, false, classes); | ||
} | ||
|
||
public JniRuntimeAccessBuildItem(boolean constructors, boolean methods, boolean fields, boolean finalFieldsWriteable, | ||
Class<?>... classes) { | ||
List<String> names = new ArrayList<>(); | ||
for (Class<?> i : classes) { | ||
if (i == null) { | ||
throw new NullPointerException(); | ||
} | ||
names.add(i.getName()); | ||
} | ||
this.className = names; | ||
this.constructors = constructors; | ||
this.methods = methods; | ||
this.fields = fields; | ||
this.finalFieldsWriteable = finalFieldsWriteable; | ||
} | ||
|
||
public List<String> getClassNames() { | ||
return className; | ||
} | ||
|
||
public boolean isConstructors() { | ||
return constructors; | ||
} | ||
|
||
public boolean isMethods() { | ||
return methods; | ||
} | ||
|
||
public boolean isFields() { | ||
return fields; | ||
} | ||
|
||
public boolean isFinalFieldsWriteable() { | ||
return finalFieldsWriteable; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters