changeset 1041:8b6f8a4bc8b8

7060642: (javadoc) improve performance on accessing inlinedTags Reviewed-by: jjg, bpatel
author ksrini
date Fri, 01 Jul 2011 14:28:19 -0700
parents 130154dbafc8
children fda5571c663a
files src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java src/share/classes/com/sun/tools/javadoc/ThrowsTagImpl.java
diffstat 2 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java	Wed Jul 27 11:53:17 2011 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/ParamTagImpl.java	Fri Jul 01 14:28:19 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -44,6 +44,11 @@
     private final String parameterComment;
     private final boolean isTypeParameter;
 
+    /**
+     * Cached inline tags.
+     */
+    private Tag[] inlineTags;
+
     ParamTagImpl(DocImpl holder, String name, String text) {
         super(holder, name, text);
         String[] sa = divideAtWhite();
@@ -71,6 +76,7 @@
     /**
      * Return the kind of this tag.
      */
+    @Override
     public String kind() {
         return "@param";
     }
@@ -85,6 +91,7 @@
     /**
      * convert this object to a string.
      */
+    @Override
     public String toString() {
         return name + ":" + text;
     }
@@ -97,7 +104,11 @@
      * @see TagImpl#inlineTagImpls()
      * @see ThrowsTagImpl#inlineTagImpls()
      */
+    @Override
     public Tag[] inlineTags() {
-        return Comment.getInlineTags(holder, parameterComment);
+        if (inlineTags == null) {
+            inlineTags = Comment.getInlineTags(holder, parameterComment);
+        }
+        return inlineTags;
     }
 }
--- a/src/share/classes/com/sun/tools/javadoc/ThrowsTagImpl.java	Wed Jul 27 11:53:17 2011 -0700
+++ b/src/share/classes/com/sun/tools/javadoc/ThrowsTagImpl.java	Fri Jul 01 14:28:19 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -43,6 +43,11 @@
     private final String exceptionName;
     private final String exceptionComment;
 
+    /**
+     * Cached inline tags.
+     */
+    private Tag[] inlineTags;
+
     ThrowsTagImpl(DocImpl holder, String name, String text) {
         super(holder, name, text);
         String[] sa = divideAtWhite();
@@ -93,6 +98,7 @@
      * Return the kind of this tag.  Always "@throws" for instances
      * of ThrowsTagImpl.
      */
+    @Override
     public String kind() {
         return "@throws";
     }
@@ -105,7 +111,11 @@
      * @see TagImpl#inlineTagImpls()
      * @see ParamTagImpl#inlineTagImpls()
      */
+    @Override
     public Tag[] inlineTags() {
-        return Comment.getInlineTags(holder, exceptionComment());
+        if (inlineTags == null) {
+            inlineTags = Comment.getInlineTags(holder, exceptionComment());
+        }
+        return inlineTags;
     }
 }