On Tue, 18 Aug 2026 20:24:33 GMT, Xueming Shen <[email protected]> wrote:
> The API note currently says: > > "If the mask is for a float-point species, then the resulting vector will > have the same shape and lane size, but an integral type." > > This does not match the method signature or its implementation: > > public abstract Vector<E> toVector(); > > For a floating-point mask, toVector() returns a vector of the same > floating-point element type and species as the mask. For example: > > VectorMask<Float> fm = VectorMask.fromValues( > FloatVector.SPECIES_128, > true, false, true, false); > > Vector<Float> fv = fm.toVector(); > > fv // [-1.0, 0.0, -1.0, 0.0] > fv.elementType() // float > fv.species() // Species[float, 4, S_128_BIT] > fv.getClass().getName() // jdk.incubator.vector.FloatVector128 > > Similarly, VectorMask<Double/Float16>.toVector() returns a FP Vector, not a > integral Vector. > > This behavior also agrees with the main method description, which states that > the resulting lanes contain the arithmetic values 0 or -1 for both integral > and floating-point element types. > > This is a doc-only fix to correct the API note. (Note: an alternative is to > simply remove this API note) > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). This pull request has now been integrated. Changeset: a30608cb Author: Xueming Shen <[email protected]> URL: https://git.openjdk.org/jdk/commit/a30608cb94583bb7394c7d41898fa731d84e9ee2 Stats: 7 lines in 1 file changed: 0 ins; 3 del; 4 mod 8389858: [VectorAPI] VectorMask.toVector API note incorrectly describes the result for fp masks Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/jdk/pull/32430
