Native image contains over 2 thousand BouncyCastle classes by default
See original GitHub issueDescribe the bug
My native image contains BouncyCastle classes, but I don’t think I need all of them. Quarkus Security registers BouncyCastle classes for reflection here https://github.com/quarkusio/quarkus/blob/main/extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java#L164, here https://github.com/quarkusio/quarkus/blob/main/extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java#L142 and here https://github.com/quarkusio/quarkus/blob/main/extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java#L128, however all relevant integration test modules (bouncycastle
, bouncycastle-fips
, bouncycastle-fips-jsse
, bouncycastle-jsse
) are passing in native mode even when you completely remove these registrations as native image contains all of these classes anyway (and abundance of others).
Expected behavior
Native image only contains classes I really need.
Actual behavior
2586 classes, f.e. ecgost
package classes, elgamal
package classes that I don’t really need.
How to Reproduce?
Reproducer:
Steps to reproduce the behavior:
git clone https://github.com/quarkusio/quarkus.git
cd quarkus/integration-tests/bouncycastle
mvn clean verify -Dnative -Dquarkus.native.additional-build-args=-H:IncludeResources=.*\\.pem,-H:+PrintClassInitialization -Dquarkus.native.enable-reports
- checkout:
target/quarkus-integration-test-bouncycastle-999-SNAPSHOT-native-image-source-jar/reports/class_initialization_report_20221119_205609.csv
and look fororg.bouncycastle
and see 2586 resultstarget/quarkus-integration-test-bouncycastle-999-SNAPSHOT-native-image-source-jar/reports/used_classes_quarkus-integration-test-bouncycastle-999-SNAPSHOT-runner_20221119_205621.txt
says 2096org.bouncycastle
classes are used
Output of uname -a
or ver
Linux fedora 5.19.16-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Oct 16 22:50:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk 17.0.5 2022-10-18
GraalVM version (if different from Java)
OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
Quarkus version or git rev
999-SNAPSHOT
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.6
Additional information
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (6 by maintainers)
Thanks for feedback
Hi @michalvavrik I think what matters is how much the native image size is affected, I’d not be surprised if some other 3rd party libraries were having a similar impact. BC has a lot of nested classes, a single outer class can have 10 or so number of micro size nested classes, and perhaps the real impact is not that critical… Thanks