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

8284447: Remove the unused NestedClassWriter interface #8129

Closed
wants to merge 2 commits into from

Conversation

pavelrappo
Copy link
Member

@pavelrappo pavelrappo commented Apr 6, 2022

The NestedClassWriter interface seems to have never been used. I delete it and reuse the freed name for the NestedClassWriterImpl class. If I don't rename NestedClassWriterImpl to NestedClassWriter, it might confuse future maintainers. Indeed, the "Impl" suffix on a class' name typically implies that there is an interface which that class implements.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8284447: Remove the unused NestedClassWriter interface

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/8129/head:pull/8129
$ git checkout pull/8129

Update a local copy of the PR:
$ git checkout pull/8129
$ git pull https://git.openjdk.java.net/jdk pull/8129/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8129

View PR using the GUI difftool:
$ git pr show -t 8129

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/8129.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 6, 2022

👋 Welcome back prappo! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Apr 6, 2022
@openjdk
Copy link

@openjdk openjdk bot commented Apr 6, 2022

@pavelrappo The following label will be automatically applied to this pull request:

  • javadoc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the javadoc label Apr 6, 2022
@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 6, 2022

Webrevs

Copy link
Contributor

@jonathan-gibbons jonathan-gibbons left a comment

Sigh, I "reviewed" this earlier, but apparently did not complete the review. So I'll try and reconstruct my earlier comments.

Approving this change is not as simple as it may seem. Yes, NestedClassWriter is unused, and while removing it may seem to be the right thing to do, renaming the Impl class just swaps one weirdness for another ... In particular, what was the Impl class is now stylistically inconsistent with other related/similar subtypes of AbstractMemberWriter, and that shows up in the first few lines of the review (in ClassUseWriter). As curious/weird as the world was before this PR, it is still somewhat weird after this PR, but just in a new and different way.

The underlying problem is that we have no single good naming methodology for interfaces and implementations across the toolkit world and the formats.html world. In particular, in formats.html we inconsistently have interfaces and implementations, Xyz interfaces and classes, and XyzImpl classes and HtmlXyz classes.

For what it's worth, I think a better solution from a consistency point of view would be to not delete NestedClassWriter, and have NestedClassWriterImpl implement NestedClassWriter, even though it is (currently) an empty interface, and even though it may be likely to remain so.

That being said, I'll (reluctantly?) approve this as-is, since I think there is a bigger problem to be addressed, which is the overall general "Writer" architecture in terms of the inheritance hierarchy and packages used to model writers (and that is even before we look at the similar but different "Builder" architecture.) Overall, I don't think this change makes the world any worse, just annoyingly different, and it is arguably a tiny bit better for removing an unused empty interface.

@openjdk
Copy link

@openjdk openjdk bot commented Apr 7, 2022

@pavelrappo This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8284447: Remove the unused NestedClassWriter interface

Reviewed-by: jjg

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Apr 7, 2022
@pavelrappo
Copy link
Member Author

@pavelrappo pavelrappo commented Apr 7, 2022

Sigh, I "reviewed" this earlier, but apparently did not complete the review. So I'll try and reconstruct my earlier comments.

Approving this change is not as simple as it may seem. Yes, NestedClassWriter is unused, and while removing it may seem to be the right thing to do, renaming the Impl class just swaps one weirdness for another ... In particular, what was the Impl class is now stylistically inconsistent with other related/similar subtypes of AbstractMemberWriter, and that shows up in the first few lines of the review (in ClassUseWriter). As curious/weird as the world was before this PR, it is still somewhat weird after this PR, but just in a new and different way.

The underlying problem is that we have no single good naming methodology for interfaces and implementations across the toolkit world and the formats.html world. In particular, in formats.html we inconsistently have interfaces and implementations, Xyz interfaces and classes, and XyzImpl classes and HtmlXyz classes.

For what it's worth, I think a better solution from a consistency point of view would be to not delete NestedClassWriter, and have NestedClassWriterImpl implement NestedClassWriter, even though it is (currently) an empty interface, and even though it may be likely to remain so.

That being said, I'll (reluctantly?) approve this as-is, since I think there is a bigger problem to be addressed, which is the overall general "Writer" architecture in terms of the inheritance hierarchy and packages used to model writers (and that is even before we look at the similar but different "Builder" architecture.) Overall, I don't think this change makes the world any worse, just annoyingly different, and it is arguably a tiny bit better for removing an unused empty interface.

Initially, I thought about fixing this issue by making NestedClassWriterImpl implement NestedClassWriter. However, since NestedClassWriter has no methods, in order for it to be useful it would need to declare those methods of the NestedClassWriterImpl that are currently used. If it doesn't, this whole situation would look even weirder. After all, NestedClassWriter is not a marker interface, is it?

On the other hand, a quick IDE analysis shows that along with many unused interface methods, we have some interface methods that are only called on their implementations and not on interfaces. This does not look right, as it means that we use classes where we should use interfaces. Here's an (incomplete) list of such interface methods:

  • jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter#getMember
  • jdk.javadoc.internal.doclets.toolkit.WriterFactory#getAnnotationTypeOptionalMemberWriter
  • jdk.javadoc.internal.doclets.toolkit.WriterFactory#getAnnotationTypeRequiredMemberWriter
  • jdk.javadoc.internal.doclets.toolkit.builders.AbstractMemberBuilder#hasMembersToDocument

I think that this PR should be withdrawn, and the issue it tries to address should be considered in JDK-8283576, which I filed earlier.

@pavelrappo pavelrappo closed this Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javadoc ready rfr
2 participants