src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
44 import javax.lang.model.util.SimpleElementVisitor9; |
44 import javax.lang.model.util.SimpleElementVisitor9; |
45 import javax.lang.model.util.SimpleTypeVisitor9; |
45 import javax.lang.model.util.SimpleTypeVisitor9; |
46 import javax.lang.model.util.Types; |
46 import javax.lang.model.util.Types; |
47 |
47 |
48 import jdk.javadoc.doclet.DocletEnvironment; |
48 import jdk.javadoc.doclet.DocletEnvironment; |
49 import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration; |
49 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; |
50 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind; |
50 import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind; |
51 |
51 |
52 /** |
52 /** |
53 * Map all class uses for a given class. |
53 * Map all class uses for a given class. |
54 * |
54 * |
190 private final DocletEnvironment docEnv; |
190 private final DocletEnvironment docEnv; |
191 private final Elements elementUtils; |
191 private final Elements elementUtils; |
192 private final Types typeUtils; |
192 private final Types typeUtils; |
193 private final Utils utils; |
193 private final Utils utils; |
194 |
194 |
195 public ClassUseMapper(HtmlConfiguration configuration, ClassTree classtree) { |
195 public ClassUseMapper(BaseConfiguration configuration, ClassTree classtree) { |
196 docEnv = configuration.docEnv; |
196 docEnv = configuration.docEnv; |
197 elementUtils = docEnv.getElementUtils(); |
197 elementUtils = docEnv.getElementUtils(); |
198 typeUtils = docEnv.getTypeUtils(); |
198 typeUtils = docEnv.getTypeUtils(); |
199 utils = configuration.utils; |
199 utils = configuration.utils; |
200 this.classtree = classtree; |
200 this.classtree = classtree; |
412 |
412 |
413 stv.visit(typeUtils.erasure(anException), ee); |
413 stv.visit(typeUtils.erasure(anException), ee); |
414 } |
414 } |
415 } |
415 } |
416 |
416 |
417 private <T> List<T> refList(Map<TypeElement, List<T>> map, Element element) { |
417 private <T> List<T> refList(Map<TypeElement, List<T>> map, TypeElement element) { |
418 List<T> list = map.get(element); |
418 List<T> list = map.get(element); |
419 if (list == null) { |
419 if (list == null) { |
420 list = new ArrayList<>(); |
420 list = new ArrayList<>(); |
421 map.put((TypeElement) element, list); |
421 map.put(element, list); |
422 } |
422 } |
423 return list; |
423 return list; |
424 } |
424 } |
425 |
425 |
426 private Set<PackageElement> packageSet(TypeElement te) { |
426 private Set<PackageElement> packageSet(TypeElement te) { |
568 } |
568 } |
569 |
569 |
570 @Override |
570 @Override |
571 public Void visitPackage(PackageElement e, Void p) { |
571 public Void visitPackage(PackageElement e, Void p) { |
572 for (AnnotationMirror a : e.getAnnotationMirrors()) { |
572 for (AnnotationMirror a : e.getAnnotationMirrors()) { |
573 refList(map, a.getAnnotationType().asElement()).add(holder); |
573 refList(map, (TypeElement) a.getAnnotationType().asElement()).add(holder); |
574 } |
574 } |
575 return null; |
575 return null; |
576 } |
576 } |
577 |
577 |
578 @Override |
578 @Override |