apache / apache/lucene

Avoid Native Access on JDK24+

Open
#15,815 0 comments 0 reactions 0 assignees View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

Currently `org.apache.lucene.store.PosixNativeAccess` invokes methods that require native access inside it's class constructor, thus always requiring native access. JDK24+ issues a warning when this happens (the warning can be avoided by allowing this specifically) and future versions of the JVM will block the operation by default.

If possible, I would like to avoid having to enable native access for my application which uses Lucene. If I understand the initialization code correctly that should already be possible by denying native access in my JVM, this then only leads to a warning being logged in Lucene. Lucene would afterwards continue to function as if it was on a platform where native access is currently not implemented (e.g. Windows). This would work, but I think it's quite hacky, so I'm wondering if we can make this configurable (opt-in or opt-out) instead.

Contributor guide

Open the contributing guide

Research direction

Start with org.apache.lucene.store.PosixNativeAccess, especially its class constructor, and trace the initialization code that invokes methods requiring native access. Determine where the behavior can be made configurable, then verify that denying native access avoids the warning while Lucene continues with the non-native behavior described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.