Commit 2ee4332
authored
JNI improvements (#886)
Large refactoring of the Java Wrapper, focussing on error handling,
documentation, completeness, and usability improvements. Fixes #880.
This includes several breaking changes. Not all breaking changes are listed
here explicitly. But in all cases, it should be easy for clients to update
their code to the new state. The most important changes for the Java
Wrapper are:
- Made `deflateZstd`, `deflateZLIB`, and `createFromMemory` available
in the `KtxTexture2` class
- Fixed a bug where the `KtxBasisParams#setInputSwizzle` function caused
data corruption
- Increased the consistency of the naming and handling of constants:
- All constant names are `UPPER_SNAKE_CASE`, omitting common prefixes
- Classes that define constants offer a `stringFor` function that returns the
string representation of a constant
- The `KtxCreateStorage` class was renamed to `KtxTextureCreateStorage`
- The `KtxPackUASTCFlagBits` class was renamed to `KtxPackUastcFlagBits`
- Improved error handling:
- When functions receive a parameter that is `null`, then this will no longer
crash the JVM, but throw a `NullPointerException` instead
- When `setInputSwizzle` receives invalid arguments, then an
`IllegalArgumentException` will be thrown
- When one of the `create...` family of functions causes an error, meaning
that the respective `KtxTexture2` object cannot be created, then a
`KtxException` will be thrown
- Added JavaDocs, and enabled the generation of JavaDocs as part of the Maven build process
- Internal improvements (like JNI field caching, and avoiding to call JNI functions with pending exceptions)1 parent 4c8a2e0 commit 2ee4332
File tree
35 files changed
+4565
-955
lines changed- interface/java_binding
- src
- main
- cpp
- java/org/khronos/ktx
- test/java/org/khronos/ktx/test
- lib
35 files changed
+4565
-955
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
147 | 160 | | |
148 | 161 | | |
149 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
0 commit comments