src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java
changeset 58727 fa1f838b5486
parent 54135 67f72165dca5
equal deleted inserted replaced
58726:449555c346d9 58727:fa1f838b5486
   330                 ? msym.sourceLocation
   330                 ? msym.sourceLocation
   331                 : msym.classLocation;
   331                 : msym.classLocation;
   332     }
   332     }
   333 
   333 
   334     //------------------Start of Serializable Implementation---------------------//
   334     //------------------Start of Serializable Implementation---------------------//
   335     private final static Map<TypeElement, NewSerializedForm> serializedForms = new HashMap<>();
   335     private final Map<TypeElement, NewSerializedForm> serializedForms = new HashMap<>();
   336 
   336 
   337     public SortedSet<VariableElement> getSerializableFields(Utils utils, TypeElement klass) {
   337     private NewSerializedForm getSerializedForm(TypeElement typeElem) {
   338         NewSerializedForm sf = serializedForms.get(klass);
   338         return serializedForms.computeIfAbsent(typeElem,
   339         if (sf == null) {
   339                 te -> new NewSerializedForm(utils, configuration.docEnv.getElementUtils(), te));
   340             sf = new NewSerializedForm(utils, configuration.docEnv.getElementUtils(), klass);
   340     }
   341             serializedForms.put(klass, sf);
   341 
   342         }
   342     public SortedSet<VariableElement> getSerializableFields(TypeElement typeElem) {
   343         return sf.fields;
   343         return getSerializedForm(typeElem).fields;
   344     }
   344     }
   345 
   345 
   346     public SortedSet<ExecutableElement>  getSerializationMethods(Utils utils, TypeElement klass) {
   346     public SortedSet<ExecutableElement>  getSerializationMethods(TypeElement typeElem) {
   347         NewSerializedForm sf = serializedForms.get(klass);
   347         return getSerializedForm(typeElem).methods;
   348         if (sf == null) {
   348     }
   349             sf = new NewSerializedForm(utils, configuration.docEnv.getElementUtils(), klass);
   349 
   350             serializedForms.put(klass, sf);
   350     public boolean definesSerializableFields(TypeElement typeElem) {
   351         }
   351         if (!utils.isSerializable(typeElem) || utils.isExternalizable(typeElem)) {
   352         return sf.methods;
       
   353     }
       
   354 
       
   355     public boolean definesSerializableFields(Utils utils, TypeElement klass) {
       
   356         if (!utils.isSerializable(klass) || utils.isExternalizable(klass)) {
       
   357             return false;
   352             return false;
   358         } else {
   353         } else {
   359             NewSerializedForm sf = serializedForms.get(klass);
   354             return getSerializedForm(typeElem).definesSerializableFields;
   360             if (sf == null) {
       
   361                 sf = new NewSerializedForm(utils, configuration.docEnv.getElementUtils(), klass);
       
   362                 serializedForms.put(klass, sf);
       
   363             }
       
   364             return sf.definesSerializableFields;
       
   365         }
   355         }
   366     }
   356     }
   367 
   357 
   368     /* TODO we need a clean port to jx.l.m
   358     /* TODO we need a clean port to jx.l.m
   369      * The serialized form is the specification of a class' serialization state.
   359      * The serialized form is the specification of a class' serialization state.