User: joe Date: 11 Nov 26 03:18 Revision: 9d90433eccd264b57a7114bedcb1ff530f1bff2e Summary: Remove excessive Javadocs TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10708&personal=false Index: src/main/kotlin/platform/fabric/annotater/AnnotaterCheckout.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/AnnotaterCheckout.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/AnnotaterCheckout.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -24,8 +24,6 @@ import java.nio.file.Path /** - * An annotater checkout on disk for one Minecraft version. - * * @property managed whether the plugin created this checkout and may run git operations in it */ class AnnotaterCheckout(val root: Path, val config: AnnotaterConfig, val managed: Boolean) { Index: src/main/kotlin/platform/fabric/annotater/AnnotaterCheckoutService.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/AnnotaterCheckoutService.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/AnnotaterCheckoutService.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -39,9 +39,6 @@ import kotlin.io.path.Path import kotlin.io.path.exists -/** - * Finds the annotater checkout to use for Minecraft classes. - */ @Service(Service.Level.APP) class AnnotaterCheckoutService { private val checkouts = ConcurrentHashMap() @@ -68,7 +65,7 @@ } /** - * Finds the checkout for [version] according to the user's settings, ignoring whether the feature is enabled. + * Ignores whether annotater is enabled. */ private fun statusForVersion(version: String): Status { val settings = AnnotaterSettings.instance @@ -111,10 +108,6 @@ return statusForVersion(version) } - /** - * The checkout to use for [element], or null if annotater is disabled, [element] isn't part of Minecraft, or no - * checkout exists for its Minecraft version. - */ fun checkoutFor(element: PsiElement): AnnotaterCheckout? { if (!AnnotaterSettings.instance.enabled) { return null @@ -123,10 +116,6 @@ return checkoutFor(element.project, file) } - /** - * The checkout to use for [file] in [project], or null if annotater is disabled, [file] isn't part of Minecraft, - * or no checkout exists for its Minecraft version. - */ fun checkoutFor(project: Project, file: VirtualFile): AnnotaterCheckout? { if (!AnnotaterSettings.instance.enabled || !isMinecraftFile(project, file)) { return null @@ -175,10 +164,6 @@ val instance: AnnotaterCheckoutService get() = ApplicationManager.getApplication().getService(AnnotaterCheckoutService::class.java) - /** - * Whether any module of [project] is a Fabric mod. Annotater is a Fabric project, so it's offered more - * prominently there. - */ fun isFabricProject(project: Project): Boolean { return ModuleManager.getInstance(project).modules.any { MinecraftFacet.getInstance(it, FabricModuleType) != null @@ -186,14 +171,10 @@ } /** - * The file containing [element]. Elements of a class file's decompiled text are in the class file. + * Elements of a class file's decompiled text are in the class file. */ fun virtualFileOf(element: PsiElement): VirtualFile? = element.containingFile?.originalFile?.virtualFile - /** - * Whether [file] is a class or source file from a Minecraft jar, as opposed to project sources or another - * library. - */ fun isMinecraftFile(project: Project, file: VirtualFile): Boolean { val fileIndex = ProjectFileIndex.getInstance(project) if (!fileIndex.isInLibrary(file)) { Index: src/main/kotlin/platform/fabric/annotater/AnnotaterConfig.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/AnnotaterConfig.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/AnnotaterConfig.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -28,9 +28,6 @@ import kotlin.io.path.exists import kotlin.io.path.readText -/** - * The contents of an annotater checkout's `config.json`. - */ data class AnnotaterConfig( val version: String, val mappings: String, Index: src/main/kotlin/platform/fabric/annotater/AnnotaterConfigurable.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/AnnotaterConfigurable.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/AnnotaterConfigurable.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -145,8 +145,7 @@ }.also { panel = it } /** - * Checks that [directory] is an annotater checkout for a Minecraft version used by an open project, returning - * the problem and whether it's an error rather than a warning. + * Returns the problem and whether it's an error rather than a warning. */ private fun validateCustomDirectory(directory: String): Pair? { if (directory.isBlank()) { @@ -170,8 +169,7 @@ } /** - * A reminder to follow annotater's contribution guidelines, which can differ between version branches, linking to - * those of the versions used by open projects, or of the default branch if there are none. + * The guidelines can differ between version branches, so link to those of each version in use. */ private fun contributionGuidelinesNote(): String { fun link(branch: String, text: String) = @@ -237,9 +235,6 @@ override fun reset() = panel.reset() - /** - * The Minecraft versions of all modules in open projects, as configured in their Minecraft module settings. - */ private fun knownMinecraftVersions(): List { return ProjectManager.getInstance().openProjects.flatMap { project -> ModuleManager.getInstance(project).modules.mapNotNull { Index: src/main/kotlin/platform/fabric/annotater/AnnotaterVcs.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/AnnotaterVcs.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/AnnotaterVcs.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -25,7 +25,7 @@ import com.intellij.openapi.project.Project /** - * Git operations on managed annotater checkouts. Only available when the Git plugin is installed. + * Only available when the Git plugin is installed. */ interface AnnotaterVcs { /** @@ -52,12 +52,12 @@ fun currentContribution(checkout: AnnotaterCheckout): AnnotaterContribution? /** - * The contribution branches in the managed [checkout], newest first. Must not be called on the EDT. + * Newest first. Must not be called on the EDT. */ fun contributions(project: Project?, checkout: AnnotaterCheckout): List /** - * The mapping files in [checkout] that have changed since the last commit. Must not be called on the EDT. + * Must not be called on the EDT. */ fun uncommittedMappingFiles(project: Project?, checkout: AnnotaterCheckout): List @@ -92,8 +92,6 @@ } /** - * A local branch in a managed checkout holding one contribution, which becomes one pull request. - * * @property title the title of the contribution's pull request, or its latest commit message if it doesn't have one * yet, or null if nothing has been committed to it */ @@ -102,9 +100,6 @@ get() = title ?: branch companion object { - /** - * A pull request title or commit message describing changes to the mapping [files]. - */ fun defaultTitle(files: List): String { val classes = files.map { it.substringAfterLast('/').removeSuffix(".mapping") }.distinct() return when { @@ -117,7 +112,7 @@ } /** - * Creating pull requests to annotater. Only available when the GitHub plugin is installed. + * Only available when the GitHub plugin is installed. */ interface AnnotaterPullRequests { enum class Action { CREATE, UPDATE } @@ -128,9 +123,6 @@ */ fun availableAction(checkout: AnnotaterCheckout): Action? - /** - * Creates a pull request with the changes in [checkout], or pushes them to its existing pull request. - */ fun submit(project: Project, checkout: AnnotaterCheckout) companion object { Index: src/main/kotlin/platform/fabric/annotater/git/AnnotaterGitVcs.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/git/AnnotaterGitVcs.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/git/AnnotaterGitVcs.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -70,7 +70,7 @@ private val titledBranches = ConcurrentHashMap.newKeySet() /** - * The [PushStatus] of each managed checkout by root, so that the editor banner can show it without running git. + * Cached so that the editor banner can show it without running git. */ private val pushStatuses = ConcurrentHashMap() @@ -79,9 +79,6 @@ */ private val pushStatusCheckouts = ConcurrentHashMap() - /** - * The checkouts whose [pushStatuses] are waiting to be refreshed. - */ private val pendingPushStatuses = ConcurrentHashMap.newKeySet() private val pushStatusExecutor = @@ -224,7 +221,7 @@ } /** - * Reads the checked out branch straight from the worktree's `HEAD` file, to avoid running git. + * Reads the worktree's `HEAD` file directly, to avoid running git. */ private fun readHeadBranch(root: Path): String? { return try { @@ -278,9 +275,6 @@ return title } - /** - * Updates the title of the checked out contribution shown in editor banners. - */ private fun refreshCurrentTitle(project: Project, checkout: AnnotaterCheckout) { val branch = currentBranch(project, checkout.root) ?: return loadTitles(project, checkout) @@ -290,9 +284,6 @@ } } - /** - * The title of the pull request already opened for the contribution [branch], if any. - */ fun pullRequestTitle(project: Project, checkout: AnnotaterCheckout, branch: String): String? { loadTitles(project, checkout) return titles[branch] @@ -315,7 +306,7 @@ } /** - * Remembers the title of the pull request for the contribution [branch], as its git branch description. + * Stored as the branch's git branch description. */ fun setContributionTitle(project: Project, checkout: AnnotaterCheckout, branch: String, title: String) { run(project, checkout.root, GitCommand.CONFIG, "branch.$branch.description", title) @@ -372,16 +363,9 @@ return PushStatus(pullRequestUrl, hasUnpushedChanges) } - /** - * The URL of the pull request opened for the contribution [branch], if any. - */ fun pullRequestUrl(project: Project, checkout: AnnotaterCheckout, branch: String): String? = getBranchConfig(project, checkout, branch, PULL_REQUEST_KEY) - /** - * Remembers that the contribution [branch] has been pushed to the pull request at [url], so that the editor banner - * offers to update it when there are new changes. - */ fun setPullRequest(project: Project, checkout: AnnotaterCheckout, branch: String, url: String) { run(project, checkout.root, GitCommand.CONFIG, "branch.$branch.$PULL_REQUEST_KEY", url) run( @@ -436,9 +420,6 @@ } } - /** - * The number of commits on the current branch that aren't in the upstream version branch. - */ fun commitsAheadOfUpstream(project: Project, checkout: AnnotaterCheckout): Int { val output = run( project, Index: src/main/kotlin/platform/fabric/annotater/github/AnnotaterBuildCheck.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/github/AnnotaterBuildCheck.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/github/AnnotaterBuildCheck.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -90,9 +90,6 @@ return commandLine } - /** - * Shows the output of the failed checks, offering to cancel submitting, which is the default, or submit anyway. - */ private class FailedDialog(project: Project, private val log: String) : DialogWrapper(project) { init { title = MCDevBundle("fabric.annotater.pr.check_build.failed") Index: src/main/kotlin/platform/fabric/annotater/github/AnnotaterGitHubPullRequests.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/github/AnnotaterGitHubPullRequests.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/github/AnnotaterGitHubPullRequests.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -47,10 +47,6 @@ import org.jetbrains.plugins.github.authentication.accounts.GithubAccount import org.jetbrains.plugins.github.util.GHCompatibilityUtil -/** - * Commits annotater changes, forks annotater on GitHub, pushes the contribution branch to the fork and opens a pull - * request, using accounts from the GitHub plugin. - */ class AnnotaterGitHubPullRequests : AnnotaterPullRequests { override fun availableAction(checkout: AnnotaterCheckout): AnnotaterPullRequests.Action? { val status = AnnotaterGitVcs.instance?.pushStatus(checkout)?.takeIf { it.hasUnpushedChanges } ?: return null Index: src/main/kotlin/platform/fabric/annotater/github/AnnotaterPullRequestDialog.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/github/AnnotaterPullRequestDialog.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/github/AnnotaterPullRequestDialog.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -41,10 +41,7 @@ private val changes: List, private val uncommittedChanges: List, existingTitle: String?, - /** - * Whether the changes are pushed to an existing pull request, so there's no title or description to enter. - */ - private val update: Boolean, + private val update: Boolean, // existing PR or update? ) : DialogWrapper(project) { private val accountModel = CollectionComboBoxModel(accounts, defaultAccount ?: accounts.first()) Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocContributions.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocContributions.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocContributions.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -41,21 +41,10 @@ import java.util.concurrent.CompletableFuture import javax.swing.JComponent -/** - * Switching a managed annotater checkout between contributions, so that a pull request can be updated after review, - * and deleting contributions. - */ object AnnotaterJavadocContributions { - /** - * The label for the contribution [checkout] is on, for the editor banner. - */ fun currentLabel(vcs: AnnotaterVcs, checkout: AnnotaterCheckout): String = vcs.currentContribution(checkout)?.displayName ?: MCDevBundle("fabric.annotater.contribution.new") - /** - * Shows a popup under [component] for switching between and deleting contributions if [checkout] is managed, and - * configuring annotater. - */ fun showPopup(project: Project, checkout: AnnotaterCheckout, component: JComponent) { val vcs = AnnotaterVcs.instance?.takeIf { checkout.managed } if (vcs == null) { @@ -167,9 +156,6 @@ } } - /** - * Asks for a message to commit the uncommitted changes with, if there are any, then switches to [branch]. - */ private fun askForCommitMessageThenSwitch( project: Project, checkout: AnnotaterCheckout, @@ -207,10 +193,6 @@ }.queue() } - /** - * Commits the uncommitted changes with [commitMessage] if it isn't null, then checks out [branch], restarting the - * editing of the Javadoc being edited. - */ private fun commitAndCheckOut( project: Project, checkout: AnnotaterCheckout, @@ -238,9 +220,6 @@ }.queue() } - /** - * Deletes [contribution] after asking for confirmation. Only the local branch is deleted. - */ private fun deleteContribution( project: Project, checkout: AnnotaterCheckout, Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocEditing.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocEditing.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocEditing.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -48,8 +48,7 @@ object AnnotaterJavadocEditing { /** - * Whether to offer editing annotater Javadocs in [project]. In Fabric projects it's offered even before annotater - * is set up, to make it discoverable. + * In Fabric projects it's offered even before annotater is set up, to make it discoverable. */ fun isOffered(project: Project): Boolean { return AnnotaterSettings.instance.enabled || AnnotaterCheckoutService.isFabricProject(project) @@ -71,10 +70,6 @@ return candidate.takeIf { isDocumentable(it) } } - /** - * Converts an element of a decompiled class's text to the compiled element it was generated from, if there is - * one, and filters out elements that can't have annotater Javadocs. - */ fun normalize(element: PsiElement): PsiMember? { val member = (element.getUserData(ClsElementImpl.COMPILED_ELEMENT) ?: element) as? PsiMember ?: return null return member.takeIf { AnnotaterJavadocTarget.fromPsi(it) != null } @@ -85,15 +80,12 @@ return AnnotaterCheckoutService.isMinecraftFile(member.project, file) } - /** - * Starts editing the annotater Javadoc of the member found by [findTarget]. - */ fun open(project: Project, editor: Editor, file: PsiFile) { open(project, findTarget(editor, file) ?: return) } /** - * Starts editing the annotater Javadoc of [member], in an editor embedded in the Minecraft class it's displayed in. + * Edits in an editor embedded in the Minecraft class [member] is displayed in. */ fun open(project: Project, member: PsiMember) { val checkout = when (val status = AnnotaterCheckoutService.instance.status(member)) { Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocEditorNotificationProvider.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocEditorNotificationProvider.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocEditorNotificationProvider.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -36,9 +36,6 @@ import java.util.function.Function import javax.swing.JComponent -/** - * Shows a banner in Minecraft classes that annotater Javadocs are displayed in, i.e. that have an annotater checkout. - */ class AnnotaterJavadocEditorNotificationProvider : EditorNotificationProvider { override fun collectNotificationData( project: Project, Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlayPassFactory.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlayPassFactory.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlayPassFactory.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -54,10 +54,6 @@ import javax.swing.Icon /** - * Displays annotater Javadocs in Minecraft classes, both decompiled and attached sources. Existing doc comments are - * folded away, and annotater Javadocs are shown as block inlays above their declarations. Declarations with an - * annotater Javadoc also get a gutter icon to edit it. - * * The IDE's rendered doc comments (reader mode) would show the existing Javadocs again, so they're turned off in these * editors. Javadocs can't be added to the decompiled text itself, as the IDE requires decompiled classes' doc comments * to match their compiled stubs. @@ -86,9 +82,6 @@ TextEditorHighlightingPass(file.project, editor.document, false) { private val documentStamp = editor.document.modificationStamp - /** - * Whether annotater Javadocs replace the existing ones, which is never the case without a checkout. - */ private var showJavadocs = false private var items = emptyList() private var gutterIcons = emptyList() Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlayRenderer.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlayRenderer.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlayRenderer.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -74,9 +74,6 @@ override fun getContextMenuGroup(inlay: Inlay<*>): ActionGroup = DefaultActionGroup(AnnotaterJavadocInlayPassFactory.EditAction(pointer)) - /** - * The x coordinate of the declaration, where the comment starts. - */ private fun startX(inlay: Inlay<*>): Int { // The size is first calculated while the inlay is being created, before it has a valid offset. The offset // differs from initialOffset after the document changes, until the highlighting pass replaces the inlay @@ -96,9 +93,6 @@ private var lines: List>? = null private var linesScheme: EditorColorsScheme? = null - /** - * The doc comment, split into lines of tokens highlighted as they would be in a Java file. - */ private fun lines(): List> { val scheme = editor.colorsScheme lines?.takeIf { linesScheme === scheme }?.let { return it } Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlineEditor.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlineEditor.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocInlineEditor.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -102,13 +102,12 @@ val file: AnnotaterJavadocVirtualFile, private val document: Document, /** - * The edited member in the Minecraft class it's displayed in, so that editing can be restarted when the checkout - * switches branch. + * Kept so that editing can be restarted when the checkout switches branch. */ val source: SmartPsiElementPointer?, ) : Disposable { /** - * The pending automatic save, which is delayed until the user stops typing. + * Delayed save until the user stops typing. */ private var saveJob: Job? = null @@ -117,16 +116,10 @@ @Volatile private var dirty = false - /** - * The editor of the Minecraft class that the Javadoc is edited in. - */ @Volatile var hostEditor: Editor? = null private set - /** - * The editor embedded in [hostEditor] that edits the Javadoc. - */ var editor: EditorEx? = null private set @@ -190,9 +183,6 @@ guards += guard } - /** - * Shows the embedded editor above [offset] in [host], and focuses it. - */ fun show(host: EditorEx, offset: Int) { val range = commentRange() ?: return val editor = EditorFactory.getInstance().createEditor(document, project, file, false, EditorKind.MAIN_EDITOR) @@ -486,9 +476,6 @@ private val saveExecutor = AppExecutorUtil.createBoundedApplicationPoolExecutor("Annotater Javadoc saving", 1) - /** - * The annotater Javadoc being edited in [project], if any. - */ fun current(project: Project): AnnotaterJavadocInlineEditor? = project.getUserData(CURRENT_KEY) /** @@ -503,7 +490,7 @@ } /** - * Whether [range] of [document] is entirely within one guarded block, so the user didn't write it. + * Whether [range] of [document] is entirely within one guarded block, i.e. the user didn't write it. */ fun isGuarded(document: Document, range: TextRange): Boolean { val guard = document.getRangeGuard(range.startOffset, range.endOffset) ?: return false @@ -511,9 +498,8 @@ } /** - * Starts editing the Javadoc of [file]'s target, finishing the previous editing in the project - * first. Returns null if the previous editing couldn't be finished, or the target's doc comment can't be found - * in [file]. + * Finishes the previous editing in the project first. Returns null if that couldn't be finished, or the + * target's doc comment can't be found in [file]. */ fun start( project: Project, Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocRefresher.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocRefresher.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocRefresher.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -30,9 +30,6 @@ import com.intellij.ui.EditorNotifications import java.nio.file.Path -/** - * Refreshes the places annotater Javadocs are displayed when they change, whether through the plugin or on disk. - */ class AnnotaterJavadocRefresher : AnnotaterListener, BulkFileListenerBackgroundable { override fun checkoutsChanged() { refresh(updateNotifications = true) Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocRendering.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocRendering.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocRendering.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -34,10 +34,6 @@ * its source file that has the annotater Javadoc as its doc comment. */ object AnnotaterJavadocRendering { - /** - * Finds the checkout whose Javadocs should be displayed instead of the existing Javadoc of [member], or null if - * the existing Javadoc should be shown. - */ fun checkoutForDisplay(member: PsiMember): AnnotaterCheckout? { if (!AnnotaterSettings.instance.showAnnotaterJavadocs) { return null @@ -55,9 +51,6 @@ ?: member.textRange.startOffset } - /** - * Finds the declaration of [member] in a copy of its source file with [javadoc] as its doc comment. - */ private fun copiedDeclaration(member: PsiMember, javadoc: String?): PsiJavaDocumentedElement? { val target = AnnotaterJavadocTarget.fromPsi(member) ?: return null val copy = AnnotaterJavadocSourceCopy.create(member) { if (it == target) javadoc else null } ?: return null @@ -65,9 +58,6 @@ return copy.memberOf(file, target) as? PsiJavaDocumentedElement } - /** - * Generates the Quick Documentation of [member] using [javadoc] as its description. - */ fun generateDoc(member: PsiMember, javadoc: String?): String? { val declaration = copiedDeclaration(member, javadoc) ?: return null return JavaDocumentationProvider.generateDocStatic(declaration, null) Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocSourceCopy.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocSourceCopy.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocSourceCopy.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -43,17 +43,13 @@ * existing Javadocs replaced by the annotater Javadocs as Markdown doc comments. This lets the IDE's own Java support * be used to edit and render annotater Javadocs in their real context. * - * The member at index `i` of [AnnotaterJavadocTarget.declarations] documents `targets[i]`, or nothing if that is null, e.g. for members of other - * top level classes in the same file. + * The member at index `i` of [AnnotaterJavadocTarget.declarations] documents `targets[i]`, or nothing if that is null, + * e.g. for members of other top level classes in the same file. */ class AnnotaterJavadocSourceCopy( val fileName: String, val text: String, val targets: List, - /** - * The language level to parse the copy at: that of the source file, but at least the first that supports Markdown - * doc comments. - */ val languageLevel: LanguageLevel, ) { /** @@ -127,8 +123,7 @@ companion object { /** - * Extracts the Markdown text of a `///` doc comment, removing the `///` prefixes and the common indentation. - * Returns null when the comment is blank. + * Removes the `///` prefixes and the common indentation. Returns null when the comment is blank. */ private fun extractMarkdown(comment: PsiDocComment): String? { val lines = comment.text.lines().map { line -> @@ -142,9 +137,6 @@ return text.ifEmpty { null } } - /** - * Formats Markdown as a `///` doc comment with the given indentation, ending with a newline. - */ private fun formatMarkdown(markdown: String, indent: String): String { return markdown.lines().joinToString("") { line -> if (line.isEmpty()) "$indent///\n" else "$indent/// $line\n" Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocStore.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocStore.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocStore.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -41,16 +41,15 @@ import net.fabricmc.mappingio.tree.MappingTree import net.fabricmc.mappingio.tree.MemoryMappingTree import net.fabricmc.mappingio.tree.VisitOrder +import org.jetbrains.annotations.VisibleForTesting /** - * Reads and writes the Javadoc comments stored in an annotater `mappings` directory. Comments are stored in Enigma - * format, with one file per top level class at `/.mapping`. The files are written - * in the same way as annotater formats them, so that saving doesn't reformat unrelated parts of a file. + * Reads and writes the Javadoc comments stored in an annotater `mappings` directory. * * Use [forDirectory] rather than the constructor outside of tests, so that every checkout of a directory sees the * comments the others write. */ -class AnnotaterJavadocStore(val mappingsDir: Path) { +class AnnotaterJavadocStore @VisibleForTesting constructor(val mappingsDir: Path) { private val cache = ConcurrentHashMap() fun fileFor(outerClass: String): Path = mappingsDir.resolve("$outerClass.mapping") @@ -87,7 +86,7 @@ } /** - * Like [set], but for several targets at once. All targets must share the same outer class. + * All targets must share the same outer class. */ @Throws(IOException::class) @Synchronized @@ -137,9 +136,6 @@ fun forDirectory(mappingsDir: Path): AnnotaterJavadocStore = stores.computeIfAbsent(mappingsDir.normalize(), ::AnnotaterJavadocStore) - /** - * Forgets the cached comments of every store, for when the checkouts change, such as by switching branch. - */ fun invalidateAll() { for (store in stores.values) { store.cache.clear() Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocTarget.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocTarget.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocTarget.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -36,13 +36,13 @@ /** * A class, field or method that can have a Javadoc comment in annotater. All names are internal (slash separated) - * official names, and members are identified by their name and JVM descriptor. + * names, and members are identified by their name and JVM descriptor. */ sealed class AnnotaterJavadocTarget { abstract val owner: String /** - * The internal name of the top level class whose `.mapping` file stores this target. + * The top level class whose `.mapping` file stores this target. */ val outerClass: String get() = outerClassName(owner) @@ -65,8 +65,7 @@ companion object { /** - * The target documented by [element], which may be an element of a class file's decompiled text. Anonymous - * classes can't be documented, but their members can. + * The target documented by [element], which may be an element of a class file's decompiled text. */ fun fromPsi(element: PsiElement): AnnotaterJavadocTarget? { // Decompiled text is generated from the compiled class, which is more reliable to get the target of Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocUnqualifiedReferenceInspection.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocUnqualifiedReferenceInspection.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocUnqualifiedReferenceInspection.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -80,9 +80,6 @@ } private object Util { - /** - * Returns the fully qualified name of the class [reference] refers to, if it isn't already written as such. - */ fun qualifiedNameIfUnqualified(reference: PsiJavaCodeReferenceElement): String? { val resolved = reference.resolve() as? PsiClass ?: return null val qualifiedName = resolved.qualifiedName ?: return null Index: src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocVirtualFile.kt =================================================================== --- src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocVirtualFile.kt (revision 31ff07e672a89f38cf405960582f13213d9af620) +++ src/main/kotlin/platform/fabric/annotater/javadoc/AnnotaterJavadocVirtualFile.kt (revision 9d90433eccd264b57a7114bedcb1ff530f1bff2e) @@ -35,9 +35,6 @@ val copy: AnnotaterJavadocSourceCopy, val target: AnnotaterJavadocTarget, ) : LightVirtualFile(copy.fileName, JavaFileType.INSTANCE, copy.text) { - /** - * The reason the last save failed, shown in the editor banner. - */ @Volatile var error: String? = null