apache / apache/lucene

"gradle precommit" no longer catches accidental package-private APIs? [LUCENE-9711]

Open
#10,750 6 comments 0 reactions 0 assignees View on GitHub
affects-version:9.0 legacy-jira-priority:Major type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

While backporting the new exciting deterministic multi-segment indexing tool, #10733, `ant precommit` failed, because the new `DocumentSelector` API was accidentally package private, missing its `public` modifier.

[Aside: I sometimes feel we should not put unit tests in the same package as the APIs they are testing.  We of course do this to make testing internal, package-private state, possible/easier.  But it then leads to API bugs like this, where we fail to make an API public when it should be.]

Anyways, luckily, the old crazy hacky Python javadoc linter in 8.x caught this issue, and I fixed it on backport, and will shortly fix it in mainline as well.  But `gradle precommit` on mainline failed to catch it, I think?

Is this a known regression in our `gradle` migration?  Do we have plans to somehow recover it?  It clearly sometimes catches important API bugs!  And this is not the first time it's caught such bugs...

![look_ma_no_link.png](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-9711/look_ma_no_link.png)

---
Migrated from [LUCENE-9711](https://issues.apache.org/jira/browse/LUCENE-9711) by Michael McCandless (@mikemccand), updated Jan 31 2021
Attachments: [look_ma_no_link.png](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-9711/look_ma_no_link.png)

Contributor guide

Open the contributing guide

Research direction

Start by comparing the current `gradle precommit` checks with the old Python Javadoc linter in Lucene 8.x, using the accidental package-private `DocumentSelector` API and backport from #10733 as the reproduction case. Trace where the API-visibility check was lost during the Gradle migration; done means `gradle precommit` catches an equivalent missing `public` modifier.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.