Skip to content

Conversation

phi-gamma
Copy link

Fixes #119

As of JVM 12 and later it is no longer possible to cast away the
``final`` modifier using reflection so the ``forece{32,64}Bit``
helpers error out with an exception:

    Tests run: 34, Failures: 0, Errors: 2, Skipped: 1, Time elapsed: 0.052 sec <<< FAILURE! - in org.bridj.DemanglingTest
    testIntVsPointer_32bits(org.bridj.DemanglingTest)  Time elapsed: 0.006 sec  <<< ERROR!
    java.lang.RuntimeException: java.lang.NoSuchFieldException: modifiers
        at java.base/java.lang.Class.getDeclaredField(Class.java:2610)
        at org.bridj.util.ReflectionUtils.makeFieldWritable(ReflectionUtils.java:42)
        at org.bridj.util.PlatformTestUtils.forcePointerSize(PlatformTestUtils.java:22)
        at org.bridj.util.PlatformTestUtils.force32Bits(PlatformTestUtils.java:30)
        at org.bridj.DemanglingTest.testIntVsPointer_32bits(DemanglingTest.java:553)

    testIntVsPointer_64bits(org.bridj.DemanglingTest)  Time elapsed: 0.001 sec  <<< ERROR!
    java.lang.RuntimeException: java.lang.NoSuchFieldException: modifiers
        at java.base/java.lang.Class.getDeclaredField(Class.java:2610)
        at org.bridj.util.ReflectionUtils.makeFieldWritable(ReflectionUtils.java:42)
        at org.bridj.util.PlatformTestUtils.forcePointerSize(PlatformTestUtils.java:22)
        at org.bridj.util.PlatformTestUtils.force64Bits(PlatformTestUtils.java:33)
        at org.bridj.DemanglingTest.testIntVsPointer_64bits(DemanglingTest.java:566)

Disable those tests until the functionality can be restored.

References:

    - https://bugs.openjdk.java.net/browse/JDK-8210522
    - https://stackoverflow.com/a/56043252/7321177

Signed-off-by: Philipp Gesang <[email protected]>
This was tested on an M1 MacBook; it reports the machine type as
``arm64``, not ``aarch64``. The full ``uname -a`` output is:

    Darwin <NAME-REDACTED>-MBP14.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64

This diverges from what ``System.getProperty("os.arch")`` reports
as the architecture.

Signed-off-by: Philipp Gesang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failures on Linux AMD64

1 participant