Skip to content

Commit

Permalink
Try update the cache and see whether it breaks the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ao-senXiong committed Nov 13, 2024
1 parent 8a36dd5 commit 6bfedba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ void checkRep(String aliasName) {
* Mapping from an Element to its annotated type; before defaults are applied, just what the
* programmer wrote.
*/
private final Map<Element, AnnotatedTypeMirror> elementCache;
public final Map<Element, AnnotatedTypeMirror> elementCache;

/** Mapping from an Element to the source Tree of the declaration. */
private final Map<Element, Tree> elementToTreeCache;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1011,8 +1011,18 @@ public Void scan(@FindDistinct AnnotatedTypeMirror t, AnnotationMirror qual) {
boolean isTopLevelType = t == outer.type;
switch (outer.location) {
case TYPE:
if (outer.scope != null && outer.scope.getKind().isClass()) {
outer.addAnnotation(t, qual);
if (outer.scope != null && outer.scope.getKind().isClass() && isTopLevelType) {
AnnotationMirror annotation =
outer.qualHierarchy.findAnnotationInHierarchy(
atypeFactory.elementCache.get(outer.scope).getAnnotations(),
qual);
if (annotation == null
|| outer.qualHierarchy.isSubtypeQualifiersOnly(qual, annotation)) {
outer.addAnnotation(t, qual);
atypeFactory.elementCache.put(outer.scope, t);
} else {
// should report error;
}
}
break;
case FIELD:
Expand Down

0 comments on commit 6bfedba

Please sign in to comment.