Skip to content

Explicitly specify enum type scopes to improve Java wrapper generation#27228

Merged
asmorkalov merged 2 commits intoopencv:4.xfrom
utibenkei:fix_java_enum_wrapper
Apr 21, 2025
Merged

Explicitly specify enum type scopes to improve Java wrapper generation#27228
asmorkalov merged 2 commits intoopencv:4.xfrom
utibenkei:fix_java_enum_wrapper

Conversation

@utibenkei
Copy link
Copy Markdown
Contributor

@utibenkei utibenkei commented Apr 14, 2025

Changed DataLayout and ImagePaddingMode to dnn::DataLayout and dnn::ImagePaddingMode to explicitly specify their scopes. This allows gen_java.py to correctly register disc_type, preventing constructors and methods using these enum types from being skipped during Java wrapper generation.

Similarly updated QRCodeEncoder::CorrectionLevel and QRCodeEncoder::EncodeMode with explicit scope declarations.

Also added a new Java test class DnnBlobFromImageWithParamsTest based on: https://github.com/opencv/opencv/blob/4.x/modules/dnn/test/test_misc.cpp#L133-L243

Related issues
#23753

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

Changed DataLayout and ImagePaddingMode to dnn::DataLayout and dnn::ImagePaddingMode
to explicitly specify their scopes. This allows gen_java.py to correctly register
disc_type, preventing constructors and methods using these enum types from being
skipped during Java wrapper generation.

Similarly updated QRCodeEncoder::CorrectionLevel and QRCodeEncoder::EncodeMode
with explicit scope declarations.

Also added a new Java test class `DnnBlobFromImageWithParamsTest` based on:
https://github.com/opencv/opencv/blob/4.x/modules/dnn/test/test_misc.cpp#L133-L243
@utibenkei utibenkei force-pushed the fix_java_enum_wrapper branch from a077d26 to b485366 Compare April 18, 2025 15:07
@asmorkalov asmorkalov added this to the 4.12.0 milestone Apr 21, 2025
@asmorkalov asmorkalov merged commit 97f73ba into opencv:4.x Apr 21, 2025
73 of 82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants