lucene
lucene copied to clipboard
LUCENE-10322: Enable -Xlint:path and -Xlint:-exports
https://issues.apache.org/jira/browse/LUCENE-10322
#11358
why do we have to make all these internal classes public to do this? I don't think this is a good tradeoff.
I would leave -Xlint:exports entirely out of the patch - this is not easily fixable; the module API is broken in that it exposes types that are not public but making them public is not really a solution.
why do we have to make all these internal classes public to do this? I don't think this is a good tradeoff.
Thanks for your review, Robert. Just like Dawid mentioned, simply making them public is really not a good solution. + 1 example for your reference:
-
public class ByteBufferIndexInputusesprivate class ByteBufferGuardas a parameter of method;
-
org.apache.lucene.search.suggest.document.NRTSuggesterusesByteBufferIndexInputlike below:
Hence it violates the existing rule of java module system, which seems a bit hard to comply in our case right now.
Yeah, those are actually API bugs? We have public methods that have non-public classes in their signature. Looks like this will be more complex to fix up.
In this example of ByteBufferIndexInput.newInstance and its ByteBufferGuard parameter, I think a better solution is to make ByteBufferIndexInput.newInstance package-private. The only callers are ByteBuffersDirectory and MMapDirectory which are in the same package. Then we don't need to make ByteBufferGuard public.
Yeah, those are actually API bugs?
They do look like API issues to me. Useful warning, by the way.
Yeah, those are actually API bugs?
They do look like API issues to me. Useful warning, by the way.
It's awesome that this change uncovered such API bugs! Thanks @spike-liu.
Are these added linting arguments still worth pursuing? Have we solved this in some other manner? I think generally we could use all the static (compile time) checking that we can safely enable to make our dev more efficient...
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution!