8177567: cache VisibleMemberMap
authorksrini
Fri, 31 Mar 2017 07:38:34 -0700
changeset 44460 9adfc635dd7b
parent 44459 5224425af378
child 44461 8e5061e5b34b
8177567: cache VisibleMemberMap Reviewed-by: jjg
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -69,9 +69,9 @@
     public ConstructorWriterImpl(SubWriterHolderWriter writer, TypeElement typeElement) {
         super(writer, typeElement);
 
-        VisibleMemberMap visibleMemberMap = new VisibleMemberMap(
+        VisibleMemberMap visibleMemberMap = configuration.getVisibleMemberMap(
                 typeElement,
-                VisibleMemberMap.Kind.CONSTRUCTORS, configuration);
+                VisibleMemberMap.Kind.CONSTRUCTORS);
         List<Element> constructors = visibleMemberMap.getMembers(typeElement);
         for (Element constructor : constructors) {
             if (utils.isProtected(constructor) || utils.isPrivate(constructor)) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Fri Mar 31 07:38:34 2017 -0700
@@ -26,6 +26,7 @@
 package jdk.javadoc.internal.doclets.toolkit;
 
 import java.io.*;
+import java.lang.ref.*;
 import java.util.*;
 
 import javax.lang.model.element.Element;
@@ -54,7 +55,9 @@
 import jdk.javadoc.internal.doclets.toolkit.util.SimpleDocletException;
 import jdk.javadoc.internal.doclets.toolkit.util.TypeElementCatalog;
 import jdk.javadoc.internal.doclets.toolkit.util.Utils;
+import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.GetterSetter;
+import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind;
 
 import static javax.tools.Diagnostic.Kind.*;
 
@@ -296,6 +299,8 @@
 
     private List<GroupContainer> groups;
 
+    private final Map<TypeElement, EnumMap<Kind, Reference<VisibleMemberMap>>> typeElementMemberCache;
+
     public abstract Messages getMessages();
     public abstract Resources getResources();
 
@@ -355,6 +360,7 @@
         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
         metakeywords = new MetaKeywords(this);
         groups = new ArrayList<>(0);
+        typeElementMemberCache = new HashMap<>();
     }
 
     private boolean initialized = false;
@@ -1259,4 +1265,18 @@
     public boolean isAllowScriptInComments() {
         return allowScriptInComments;
     }
+
+    public VisibleMemberMap getVisibleMemberMap(TypeElement te, VisibleMemberMap.Kind kind) {
+        EnumMap<Kind, Reference<VisibleMemberMap>> cacheMap = typeElementMemberCache
+                .computeIfAbsent(te, k -> new EnumMap<>(VisibleMemberMap.Kind.class));
+
+        Reference<VisibleMemberMap> vmapRef = cacheMap.get(kind);
+        // recompute, if referent has been garbage collected
+        VisibleMemberMap vMap = vmapRef == null ? null : vmapRef.get();
+        if (vMap == null) {
+            vMap = new VisibleMemberMap(te, kind, this);
+            cacheMap.put(kind, new SoftReference<>(vMap));
+        }
+        return vMap;
+    }
 }
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, 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
@@ -90,7 +90,7 @@
         super(context);
         this.typeElement = typeElement;
         this.writer = writer;
-        this.visibleMemberMap = new VisibleMemberMap(typeElement, memberType, configuration);
+        this.visibleMemberMap = configuration.getVisibleMemberMap(typeElement, memberType);
         this.members = this.visibleMemberMap.getMembers(typeElement);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -91,7 +91,7 @@
         super(context);
         this.typeElement = typeElement;
         this.writer = writer;
-        this.visibleMemberMap = new VisibleMemberMap(typeElement, memberType, configuration);
+        this.visibleMemberMap = configuration.getVisibleMemberMap(typeElement, memberType);
         this.members = this.visibleMemberMap.getMembers(typeElement);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -273,8 +273,8 @@
      * @return true if the given package has constant fields to document.
      */
     private boolean hasConstantField (TypeElement typeElement) {
-        VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(typeElement,
-            VisibleMemberMap.Kind.FIELDS, configuration);
+        VisibleMemberMap visibleMemberMapFields = configuration.getVisibleMemberMap(typeElement,
+            VisibleMemberMap.Kind.FIELDS);
         List<Element> fields = visibleMemberMapFields.getLeafMembers();
         for (Element f : fields) {
             VariableElement field = (VariableElement)f;
@@ -329,10 +329,10 @@
          */
         public ConstantFieldBuilder(TypeElement typeElement) {
             this.typeElement = typeElement;
-            visibleMemberMapFields = new VisibleMemberMap(typeElement,
-                VisibleMemberMap.Kind.FIELDS, configuration);
-            visibleMemberMapEnumConst = new VisibleMemberMap(typeElement,
-                VisibleMemberMap.Kind.ENUM_CONSTANTS, configuration);
+            visibleMemberMapFields = configuration.getVisibleMemberMap(typeElement,
+                VisibleMemberMap.Kind.FIELDS);
+            visibleMemberMapEnumConst = configuration.getVisibleMemberMap(typeElement,
+                VisibleMemberMap.Kind.ENUM_CONSTANTS);
         }
 
         /**
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -94,11 +94,8 @@
         super(context);
         this.typeElement = typeElement;
         this.writer = writer;
-        visibleMemberMap =
-                new VisibleMemberMap(
-                typeElement,
-                VisibleMemberMap.Kind.CONSTRUCTORS,
-                configuration);
+        visibleMemberMap = configuration.getVisibleMemberMap(typeElement,
+                VisibleMemberMap.Kind.CONSTRUCTORS);
         constructors = visibleMemberMap.getMembers(typeElement);
         for (Element ctor : constructors) {
             if (utils.isProtected(ctor) || utils.isPrivate(ctor)) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -89,11 +89,8 @@
         super(context);
         this.typeElement = typeElement;
         this.writer = writer;
-        visibleMemberMap =
-                new VisibleMemberMap(
-                typeElement,
-                VisibleMemberMap.Kind.ENUM_CONSTANTS,
-                configuration);
+        visibleMemberMap = configuration.getVisibleMemberMap(typeElement,
+                VisibleMemberMap.Kind.ENUM_CONSTANTS);
         enumConstants = visibleMemberMap.getMembers(typeElement);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -90,11 +90,8 @@
         super(context);
         this.typeElement = typeElement;
         this.writer = writer;
-        visibleMemberMap =
-                new VisibleMemberMap(
-                typeElement,
-                VisibleMemberMap.Kind.FIELDS,
-                configuration);
+        visibleMemberMap = configuration.getVisibleMemberMap(typeElement,
+                VisibleMemberMap.Kind.FIELDS);
         fields = visibleMemberMap.getLeafMembers();
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -70,10 +70,6 @@
     public static final String NAME = "MemberSummary";
 
     /**
-     * The visible members for the given class.
-     */
-    private final EnumMap<VisibleMemberMap.Kind, VisibleMemberMap> visibleMemberMaps;
-    /**
      * The member summary writers for the given class.
      */
     private final EnumMap<VisibleMemberMap.Kind, MemberSummaryWriter> memberSummaryWriters;
@@ -94,14 +90,6 @@
         super(context);
         this.typeElement = typeElement;
         memberSummaryWriters = new EnumMap<>(VisibleMemberMap.Kind.class);
-        visibleMemberMaps = new EnumMap<>(VisibleMemberMap.Kind.class);
-        for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
-            visibleMemberMaps.put(kind,
-                    new VisibleMemberMap(
-                    typeElement,
-                    kind,
-                    configuration));
-        }
     }
 
     /**
@@ -117,7 +105,7 @@
                 classWriter.getTypeElement());
         WriterFactory wf = context.configuration.getWriterFactory();
         for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
-            MemberSummaryWriter msw = builder.visibleMemberMaps.get(kind).noVisibleMembers()
+            MemberSummaryWriter msw =  builder.getVisibleMemberMap(kind).noVisibleMembers()
                     ? null
                     : wf.getMemberSummaryWriter(classWriter, kind);
             builder.memberSummaryWriters.put(kind, msw);
@@ -138,7 +126,7 @@
                 annotationTypeWriter.getAnnotationTypeElement());
         WriterFactory wf = context.configuration.getWriterFactory();
         for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
-            MemberSummaryWriter msw = builder.visibleMemberMaps.get(kind).noVisibleMembers()
+            MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers()
                     ? null
                     : wf.getMemberSummaryWriter(annotationTypeWriter, kind);
             builder.memberSummaryWriters.put(kind, msw);
@@ -157,25 +145,25 @@
     /**
      * Return the specified visible member map.
      *
-     * @param type the type of visible member map to return.
+     * @param kind the kind of visible member map to return.
      * @return the specified visible member map.
      * @throws ArrayIndexOutOfBoundsException when the type is invalid.
      * @see VisibleMemberMap
      */
-    public VisibleMemberMap getVisibleMemberMap(VisibleMemberMap.Kind type) {
-        return visibleMemberMaps.get(type);
+    public VisibleMemberMap getVisibleMemberMap(VisibleMemberMap.Kind kind) {
+        return configuration.getVisibleMemberMap(typeElement, kind);
     }
 
     /**.
      * Return the specified member summary writer.
      *
-     * @param type the type of member summary writer to return.
+     * @param kind the kind of member summary writer to return.
      * @return the specified member summary writer.
      * @throws ArrayIndexOutOfBoundsException when the type is invalid.
      * @see VisibleMemberMap
      */
-    public MemberSummaryWriter getMemberSummaryWriter(VisibleMemberMap.Kind type) {
-        return memberSummaryWriters.get(type);
+    public MemberSummaryWriter getMemberSummaryWriter(VisibleMemberMap.Kind kind) {
+        return memberSummaryWriters.get(kind);
     }
 
     /**
@@ -183,13 +171,13 @@
      * This information can be used for doclet specific documentation
      * generation.
      *
-     * @param type the type of members to return.
+     * @param kind the kind of elements to return.
      * @return a list of methods that will be documented.
      * @see VisibleMemberMap
      */
-    public SortedSet<Element> members(VisibleMemberMap.Kind type) {
+    public SortedSet<Element> members(VisibleMemberMap.Kind kind) {
         TreeSet<Element> out = new TreeSet<>(comparator);
-        out.addAll(visibleMemberMaps.get(type).getLeafMembers());
+        out.addAll(getVisibleMemberMap(kind).getLeafMembers());
         return out;
     }
 
@@ -204,7 +192,7 @@
             return !utils.getAnnotationMethods(typeElement).isEmpty();
         }
         for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
-            VisibleMemberMap members = visibleMemberMaps.get(kind);
+            VisibleMemberMap members = getVisibleMemberMap(kind);
             if (!members.noVisibleMembers()) {
                 return true;
             }
@@ -222,7 +210,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.ENUM_CONSTANTS);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.ENUM_CONSTANTS);
+                getVisibleMemberMap(VisibleMemberMap.Kind.ENUM_CONSTANTS);
         addSummary(writer, visibleMemberMap, false, memberSummaryTree);
     }
 
@@ -236,7 +224,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
+                getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
         addSummary(writer, visibleMemberMap, false, memberSummaryTree);
     }
 
@@ -250,7 +238,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL);
+                getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL);
         addSummary(writer, visibleMemberMap, false, memberSummaryTree);
     }
 
@@ -264,7 +252,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED);
+                getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED);
         addSummary(writer, visibleMemberMap, false, memberSummaryTree);
     }
 
@@ -278,7 +266,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.FIELDS);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.FIELDS);
+                getVisibleMemberMap(VisibleMemberMap.Kind.FIELDS);
         addSummary(writer, visibleMemberMap, true, memberSummaryTree);
     }
 
@@ -289,7 +277,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.PROPERTIES);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.PROPERTIES);
+                getVisibleMemberMap(VisibleMemberMap.Kind.PROPERTIES);
         addSummary(writer, visibleMemberMap, true, memberSummaryTree);
     }
 
@@ -303,7 +291,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.INNER_CLASSES);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.INNER_CLASSES);
+                getVisibleMemberMap(VisibleMemberMap.Kind.INNER_CLASSES);
         addSummary(writer, visibleMemberMap, true, memberSummaryTree);
     }
 
@@ -317,7 +305,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.METHODS);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.METHODS);
+               getVisibleMemberMap(VisibleMemberMap.Kind.METHODS);
         addSummary(writer, visibleMemberMap, true, memberSummaryTree);
     }
 
@@ -331,7 +319,7 @@
         MemberSummaryWriter writer =
                 memberSummaryWriters.get(VisibleMemberMap.Kind.CONSTRUCTORS);
         VisibleMemberMap visibleMemberMap =
-                visibleMemberMaps.get(VisibleMemberMap.Kind.CONSTRUCTORS);
+                getVisibleMemberMap(VisibleMemberMap.Kind.CONSTRUCTORS);
         addSummary(writer, visibleMemberMap, false, memberSummaryTree);
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -94,10 +94,8 @@
         super(context);
         this.typeElement = typeElement;
         this.writer = writer;
-        visibleMemberMap = new VisibleMemberMap(
-                typeElement,
-                VisibleMemberMap.Kind.METHODS,
-                configuration);
+        visibleMemberMap = configuration.getVisibleMemberMap(typeElement,
+                VisibleMemberMap.Kind.METHODS);
         methods = visibleMemberMap.getLeafMembers();
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java	Fri Mar 31 10:46:37 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java	Fri Mar 31 07:38:34 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -90,11 +90,8 @@
         super(context);
         this.typeElement = typeElement;
         this.writer = writer;
-        visibleMemberMap =
-                new VisibleMemberMap(
-                typeElement,
-                VisibleMemberMap.Kind.PROPERTIES,
-                configuration);
+        visibleMemberMap = configuration.getVisibleMemberMap(typeElement,
+                VisibleMemberMap.Kind.PROPERTIES);
         properties = visibleMemberMap.getMembers(typeElement);
     }