Skip to content

Commit

Permalink
8277847: Support toolGuide tag in class-level documentation
Browse files Browse the repository at this point in the history
Reviewed-by: alanb, jjg
  • Loading branch information
Julia Boes committed Nov 29, 2021
1 parent 9a3a9b1 commit e3e5908
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions make/jdk/src/classes/build/tools/taglet/ToolGuide.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -31,8 +31,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.lang.model.element.Element;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;

import com.sun.source.doctree.DocTree;
import com.sun.source.doctree.UnknownBlockTagTree;
Expand Down Expand Up @@ -75,7 +75,7 @@ public class ToolGuide implements Taglet {
*/
@Override
public Set<Location> getAllowedLocations() {
return EnumSet.of(MODULE, PACKAGE);
return EnumSet.of(MODULE, PACKAGE, TYPE);
}

@Override
Expand Down Expand Up @@ -151,6 +151,12 @@ private String docRoot(Element elem) {
return pe.getEnclosingElement() != null
? "../" + pkgPart
: pkgPart;
case CLASS:
TypeElement te = (TypeElement)elem;
return te.getQualifiedName()
.toString()
.replace('.', '/')
.replaceAll("[^/]+", "..");

default:
throw new IllegalArgumentException(elem.getKind().toString());
Expand Down

1 comment on commit e3e5908

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.