Update Lucene 3.x editor dependency
codebase:
- https://github.com/apache/netbeans/blob/3ebd6cb396842f212bd09011d689941884dd649d/ide/libs.lucene/external/binaries-list#L17
- https://github.com/search?q=repo%3Aapache%2Fnetbeans+org.netbeans.libs.lucene+language%3AXML&type=code&l=XML
runtime:
Lucene 3.x is making misc.Unsafe calls, this was resolved in 5.x. https://github.com/apache/lucene/issues/7301
sun/misc/Unsafe#addressSize org.apache.lucene.util.Constants.<clinit>(Line:79)
sun/misc/Unsafe#arrayBaseOffset org.apache.lucene.util.RamUsageEstimator.<clinit>(Line:210)
sun/misc/Unsafe#arrayIndexScale org.apache.lucene.util.RamUsageEstimator.<clinit>(Line:171)
sun/misc/Unsafe#objectFieldOffset org.apache.lucene.util.RamUsageEstimator.<clinit>(Line:191)
those warnings will become errors in JDK 26, see parent issue https://github.com/apache/netbeans/issues/8259
updating it won't be trivial since it is exposed via editor API https://lucene.apache.org/core/4_0_0/MIGRATE.html
Committer
- [x] I acknowledge that I am a maintainer/committer in the Apache NetBeans project.
should we go for lucene 10 or keep the lowest compatible with the unsafe aka 5.x branch?
lucene 10 is JDK 21 which means lucene 9.x would be max till NB 30.
Lucene 5 would be the minimal version we would have to reach to solve this issue (assuming no other issues show up - I haven't checked). Whether we do this incrementally in small steps or throw the code away and rewrite for lucene 9 is the other question. In any case this will break the API. Small steps while following the migration guide might be easier.
Just, fwiw, my understanding (which may be wrong, of course) is that the indexing depends on some Lucene 3.X feature(s), which no longer exists in the newer version. So, what we might be looking at is a rewrite. But, I didn't investigate (at least, not yet), so I don't know for sure. It might even be that we would use something different than Lucene, if there would be something that would work better.
extracted a cleanup PR https://github.com/apache/netbeans/pull/8590 from my lucene 4.0 wip branch (branch won't build atm, goal right now is to make parsing.lucene tests pass - I ignore nb API for now)
Its difficult to run tests once the lucene libs are bumped to 4.0 due to API changes so I moved some changes to 3.6.2 which can be integrated earlier. We might also want to add more tests to parsing.lucene firsts.