Skip to content

Commit 7b6ba7d

Browse files
committed
feat(core) add option that disables hash checks
1 parent 647f7b3 commit 7b6ba7d

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

doc/notes/3.3.5.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This build includes the following changes:
2626

2727
#### Improvements
2828

29+
- Core: Added `Configuration.DISABLE_HASH_CHECKS`, a dynamic option that disables shared library hash checks. (#1007)
2930
- msdfgen: Added support for glyph index based msdfgen-ext APIs. (#1002)
3031

3132
#### Fixes

modules/lwjgl/core/src/main/java/org/lwjgl/system/Configuration.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,20 @@ public class Configuration<T> {
238238
*/
239239
public static final Configuration<Boolean> DISABLE_FUNCTION_CHECKS = new Configuration<>("org.lwjgl.util.NoFunctionChecks", StateInit.BOOLEAN);
240240

241+
/**
242+
* Set to true to disable LWJGL's shared library hash checks.
243+
*
244+
* <p>LWJGL compares the shared library hash stored in the classpath, with the hash of the actual library loaded at runtime. These checks print a simple
245+
* warning when there's a hash mismatch, to help diagnose installation/classpath issues. It is not a security feature.</p>
246+
*
247+
* <p>If this option is not set, it defaults to the value of {@link #DISABLE_CHECKS}.</p>
248+
*
249+
* <p style="font-family: monospace">
250+
* Property: <b>org.lwjgl.util.NoLibraryChecks</b><br>
251+
* &nbsp; &nbsp;Usage: Dynamic</p>
252+
*/
253+
public static final Configuration<Boolean> DISABLE_HASH_CHECKS = new Configuration<>("org.lwjgl.util.NoHashChecks", StateInit.BOOLEAN);
254+
241255
/**
242256
* Set to true to enable LWJGL's debug mode.
243257
*

modules/lwjgl/core/src/main/java/org/lwjgl/system/Library.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ static void printError(String message) {
573573
* @param libFile the library file loaded
574574
*/
575575
private static void checkHash(Class<?> context, Path libFile, String module, String libName) {
576-
if (!CHECKS) {
576+
if (Configuration.DISABLE_HASH_CHECKS.get(!CHECKS)) {
577577
return;
578578
}
579579

0 commit comments

Comments
 (0)