Skip to content

Conversation

@uschindler
Copy link
Contributor

The rewrite was not so easy but I got it working.... (in fact, the Javascript compiler was easier).

The code also adds some more sanity checks about correct Java versions. So it will complain in future when the APIJAR extractor extracts for a older java version than the compile target.

@uschindler
Copy link
Contributor Author

uschindler commented May 5, 2025

P.S.: The preview flag removal code is not used by vector API, but I ported it over, too. I tested it with temporarily extracting the Java 24 ScopedValue preview code.

@uschindler
Copy link
Contributor Author

Output of regnerate is same as before:

> Task :lucene:core:generateJdkApiJar24
Loading and analyzing 200 class files...
Writing 28 visible classes...
Writing stub for class: jdk/incubator/vector/AbstractVector
Writing stub for class: jdk/incubator/vector/ByteVector
Writing stub for class: jdk/incubator/vector/DoubleVector
Writing stub for class: jdk/incubator/vector/Float16
Writing stub for class: jdk/incubator/vector/FloatVector
Writing stub for class: jdk/incubator/vector/IntVector
Writing stub for class: jdk/incubator/vector/LongVector
Writing stub for class: jdk/incubator/vector/ShortVector
Writing stub for class: jdk/incubator/vector/Vector
Writing stub for class: jdk/incubator/vector/VectorMask
Writing stub for class: jdk/incubator/vector/VectorMath
Writing stub for class: jdk/incubator/vector/VectorOperators
Writing stub for class: jdk/incubator/vector/VectorOperators$Associative
Writing stub for class: jdk/incubator/vector/VectorOperators$Binary
Writing stub for class: jdk/incubator/vector/VectorOperators$Comparison
Writing stub for class: jdk/incubator/vector/VectorOperators$Conversion
Writing stub for class: jdk/incubator/vector/VectorOperators$Operator
Writing stub for class: jdk/incubator/vector/VectorOperators$Ternary
Writing stub for class: jdk/incubator/vector/VectorOperators$Test
Writing stub for class: jdk/incubator/vector/VectorOperators$Unary
Writing stub for class: jdk/incubator/vector/VectorShape
Writing stub for class: jdk/incubator/vector/VectorShuffle
Writing stub for class: jdk/incubator/vector/VectorSpecies
Writing stub for class: jdk/internal/vm/vector/VectorSupport
Writing stub for class: jdk/internal/vm/vector/VectorSupport$Vector
Writing stub for class: jdk/internal/vm/vector/VectorSupport$VectorMask
Writing stub for class: jdk/internal/vm/vector/VectorSupport$VectorPayload
Writing stub for class: jdk/internal/vm/vector/VectorSupport$VectorShuffle
Referenced classes not included: [java/lang/Comparable, java/lang/Number, java/lang/Enum, java/lang/Object]

The resulting apijar file has similar size, but it is a bit larger. I did not find out what exactly the problem is. But also from my work on the expressions module I figured out that classfile API is a bit more verbose when building the constant pool (numbers are much larger,...). Maybe this is where it comes from.

I compared the Eclipse CLASS file dumps in old and new JAR, they contains same symbols and constants, just with different indexes.

@uschindler
Copy link
Contributor Author

I added an additional check missing previously as replacement for the last line in above output: All referenced classes left over after processing need to be publicly available in java.base module.

Copy link
Contributor

@dweiss dweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@uschindler uschindler force-pushed the dev/killAsmDependency branch from dc1d6ed to fd704fb Compare May 6, 2025 00:29
Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! LGTM

@uschindler
Copy link
Contributor Author

Thanks for review, I will merge now!

@uschindler uschindler merged commit 10c3121 into apache:main May 6, 2025
7 checks passed
@uschindler uschindler deleted the dev/killAsmDependency branch May 6, 2025 15:07
@rmuir
Copy link
Member

rmuir commented May 6, 2025

this is awesome, thank you @uschindler

weizijun added a commit to weizijun/lucene that referenced this pull request May 7, 2025
* main: (27 commits)
  deps(java): bump com.github.luben:zstd-jni from 1.5.7-2 to 1.5.7-3 (apache#14621)
  Improve user-facing docs for geo package (apache#14534)
  Enabling histogram collection for PointRangeQuery (apache#14560)
  Move sloppySin into SloppyMath from GeoUtils (apache#14516)
  Rewrite APIJAR extractor to use Java 24 classfile API and kill ASM dependency also for build system (apache#14613)
  CHANGES entry for apache#14226 (optimistic KNN Query)
  OptimisticKnnVectorQuery (apache#14226)
  Fix for Windows (spaces in paths) apache#14608
  Update jdk requirements in README to OpenJDK 24 (apache#14610)
  Always check gradle wrapper sha checksum and download if necessary (apache#14608)
  Fix changelog verifier (apache#14606)
  MultiRange query for SortedNumeric DocValues (apache#14404)
  Remove RANDOM_PRELOAD read advice, which is not actually used (apache#14593)
  Remove duplicate test (apache#14602)
  Refactor the expressions compiler to use official ClassData BSM with indexed lookup (apache#14602)
  Disallow EA versions to run Gradle (apache#14601)
  Add back-compat indices for 10.2.1
  Add Lucene 10.2.1 version constant
  DOAP changes for release 10.2.1
  Revert "An attempt to make jenkins pass with the currently installed jdk24-ea. To be reverted later. apache#14600"
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants