ChrisHegarty commented on issue #12396:
URL: https://github.com/apache/lucene/issues/12396#issuecomment-1615848352
If I'm not mistaken, the specific interface required here to abstract out
`ForUtil` would look something like this?
```
interface ForUtilXXX {
/** Number of bytes required to encode 128 integers of {@code
bitsPerValue} bits per value. */
int numBytes(int bitsPerValue);
/** Encodes integers from {@code values} into {@code out}. */
void encode(int[] values, int bitsPerValue, DataOutput out) throws
IOException;
/** Decodes integers into {@code values}. */
void decode(int bitsPerValue, DataInput in, int[] values) throws
IOException;
}
```
This interface does not need to be shared outside of its package - both the
default and Panama implementations can reside in the same package. Maybe we
need this interface for different codec versions? If so, then it could be
copied, otherwise we need to find a "sharable" package.
We current have a `TestSecrets`, that supports cross-package access, but
even a more general non-test specific `o.a.l.internal.SharedSecrets` is not
sufficient here, since we need to share both the Vector lookup code, and
(maybe?) the interface, ForUtilXXX. The most straightforward, but less
defensive, way I see is to double down on `org.apache.lucene.internal` as
location to house such things that are Lucene internal **not to be used by
external developers**. While not a very novel approach, it is well understood,
commonly used, and adds the least amount of friction to the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]