Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-12435: Fix javadoc errors #10392

Merged
merged 4 commits into from Mar 24, 2021
Merged

Conversation

vvcephei
Copy link
Contributor

Fixes errors while generating javadoc.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Contributor Author

@vvcephei vvcephei left a comment

Choose a reason for hiding this comment

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

Hey @chia7712 , here's my fix for the issue you pointed out in #10386

Can you spare a quick review?

@@ -71,7 +71,7 @@
* <p>
* <pre>
* +---------------------+ +----------------------+
* |COPY_SEGMENT_STARTED |----------->|COPY_SEGMENT_FINISHED |
* |COPY_SEGMENT_STARTED |-----------&gt;|COPY_SEGMENT_FINISHED |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These were just warnings, but they were the only two warnings in the project, so I fixed them. We just need to XML-escape the > character.

@@ -237,7 +237,7 @@ private static boolean isRecoverable(final KafkaException uncaughtException) {
* @throws IllegalStateException if EOS is disabled
* @throws TaskMigratedException
*/
void commitTransaction(final Map<TopicPartition, OffsetAndMetadata> offsets,
protected void commitTransaction(final Map<TopicPartition, OffsetAndMetadata> offsets,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed this so I could move the subclass to a different package. I think it's still just as obviously inappropriate for users to subclass this class, since it's in the internals package.

import org.apache.kafka.streams.internals.KeyValueStoreFacade;
import org.apache.kafka.streams.internals.WindowStoreFacade;
import org.apache.kafka.streams.test.internal.KeyValueStoreFacade;
import org.apache.kafka.streams.test.internal.WindowStoreFacade;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Javadoc is unable to generate docs for this (TopologyTestDriver) file because it depends on these classes, which are also in test-utils, but are excluded in the build.gradle spec.

I was unable to override the exclusion with a more specific inclusion, so instead I just moved these classes to a different package that matches only the "include" patterns in :streams:test-utils:javadoc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Have you checked that the produced javadoc does not include these internal files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't before, but I did just check on my latest strategy, and they are not generated.

Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@vvcephei thanks for this quick fix. LGTM

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kafka.streams.internals;
package org.apache.kafka.streams.test.internal;
Copy link
Contributor

@ijuma ijuma Mar 24, 2021

Choose a reason for hiding this comment

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

It's not great that we use internal here and internals everywhere else. I think you did this to avoid the javadoc exclusion pattern, but...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's exactly right. I agree it's not great. Maybe a better alternative is to just not try to mark these classes as "internal". It should be pretty hard to get confused about their usage, and apparently we have to include them in the Javadoc anyway, so it's probably fine to just move them up a level and drop internal

@vvcephei
Copy link
Contributor Author

Ok, thanks for the reviews, @ijuma and @chia7712 !

I decided that instead of playing subtle games with the pattern matching and the package name, I'll just make these classes into static inner classes of TopologyTestDriver (their only usage).

I double-checked the generated javadoc, and I don't see anything suspicious either in the package tree or in the TopologyTestDriver.html doc.

Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1622,7 +1622,6 @@ project(':streams:test-utils') {

javadoc {
include "**/org/apache/kafka/streams/test/**"
exclude "**/org/apache/kafka/streams/internals/**", "**/org/apache/kafka/streams/**/internals/**"
Copy link
Contributor

Choose a reason for hiding this comment

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

As the related class have be moved from internals, does it need to remove this exclude rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The files I converted to static inner classes were the only contents of these packages, so they don't exist anymore. I figured I'd go ahead and remove the exclusion, too.

@vvcephei
Copy link
Contributor Author

Ok, I've tested this fix locally, and it looks like, although we have some flaky test failures, the builds are still functioning.

@vvcephei vvcephei merged commit 9bf5c57 into apache:trunk Mar 24, 2021
@vvcephei vvcephei deleted the kafka-12435-fix-javadoc branch March 24, 2021 18:55
vvcephei added a commit that referenced this pull request Mar 24, 2021
There were errors while generating javadoc for the streams:test-utils module
because the included TopologyTestDriver imported some excluded classes.

This fixes the errors by inlining the previously excluded packages.

Reviewers: Chia-Ping Tsai <chia7712@apache.org>, Ismael Juma <ijuma@apache.org>
Terrdi pushed a commit to Terrdi/kafka that referenced this pull request Apr 1, 2021
There were errors while generating javadoc for the streams:test-utils module
because the included TopologyTestDriver imported some excluded classes.

This fixes the errors by inlining the previously excluded packages.

Reviewers: Chia-Ping Tsai <chia7712@apache.org>, Ismael Juma <ijuma@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants