< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java

Print this page

        

@@ -85,10 +85,11 @@
 import com.sun.source.util.DocTrees;
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.model.JavacTypes;
 import jdk.javadoc.internal.doclets.formats.html.SearchIndexItem;
 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
+import jdk.javadoc.internal.doclets.toolkit.BaseOptions;
 import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo;
 import jdk.javadoc.internal.doclets.toolkit.Messages;
 import jdk.javadoc.internal.doclets.toolkit.Resources;
 import jdk.javadoc.internal.doclets.toolkit.WorkArounds;
 import jdk.javadoc.internal.doclets.toolkit.taglets.BaseTaglet;

@@ -110,19 +111,21 @@
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
 public class Utils {
     public final BaseConfiguration configuration;
-    public final Messages messages;
-    public final Resources resources;
+    private final BaseOptions options;
+    private final Messages messages;
+    private final Resources resources;
     public final DocTrees docTrees;
     public final Elements elementUtils;
     public final Types typeUtils;
-    public final JavaScriptScanner javaScriptScanner;
+    private final JavaScriptScanner javaScriptScanner;
 
     public Utils(BaseConfiguration c) {
         configuration = c;
+        options = configuration.getOptions();
         messages = configuration.getMessages();
         resources = configuration.getResources();
         elementUtils = c.docEnv.getElementUtils();
         typeUtils = c.docEnv.getTypeUtils();
         docTrees = c.docEnv.getDocTrees();

@@ -388,11 +391,11 @@
     public boolean isPublic(Element e) {
         return e.getModifiers().contains(Modifier.PUBLIC);
     }
 
     public boolean isProperty(String name) {
-        return configuration.javafx && name.endsWith("Property");
+        return options.javafx && name.endsWith("Property");
     }
 
     public String getPropertyName(String name) {
         return isProperty(name)
                 ? name.substring(0, name.length() - "Property".length())

@@ -1346,12 +1349,12 @@
      */
     public String replaceTabs(String text) {
         if (!text.contains("\t"))
             return text;
 
-        final int tabLength = configuration.sourcetab;
-        final String whitespace = configuration.tabSpaces;
+        final int tabLength = options.sourceTabSize;
+        final String whitespace = " ".repeat(tabLength);
         final int textLength = text.length();
         StringBuilder result = new StringBuilder(textLength);
         int pos = 0;
         int lineLength = 0;
         for (int i = 0; i < textLength; i++) {

@@ -1479,11 +1482,11 @@
     public boolean hasHiddenTag(Element e) {
         // prevent needless tests on elements which are not included
         if (!isIncluded(e)) {
             return false;
         }
-        if (configuration.javafx &&
+        if (options.javafx &&
                 hasBlockTag(e, DocTree.Kind.UNKNOWN_BLOCK_TAG, "treatAsPrivate")) {
             return true;
         }
         return hasBlockTag(e, DocTree.Kind.HIDDEN);
     }

@@ -1492,11 +1495,11 @@
      * Returns true if the method has no comments, or a lone &commat;inheritDoc.
      * @param m a method
      * @return true if there are no comments, false otherwise
      */
     public boolean isSimpleOverride(ExecutableElement m) {
-        if (!configuration.summarizeOverriddenMethods ||
+        if (!options.summarizeOverriddenMethods ||
                 !isIncluded(m)) {
             return false;
         }
 
         if (!getBlockTags(m).isEmpty() || isDeprecated(m))
< prev index next >