Skip to content

Commit

Permalink
Yet more import detection improvements
Browse files Browse the repository at this point in the history
Issue: #5
  • Loading branch information
knutwannheden committed May 12, 2023
1 parent c32fca9 commit c16e27c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void scan(JCTree tree) {
if (tree.type == null || !(tree.type.tsym instanceof Symbol.ClassSymbol)) {
return;
}
if (((JCIdent) tree).sym.getKind() == ElementKind.CLASS) {
if (((JCIdent) tree).sym.getKind() == ElementKind.CLASS || ((JCIdent) tree).sym.getKind() == ElementKind.INTERFACE) {
imports.add(tree.type.tsym);
} else if (((JCIdent) tree).sym.getKind() == ElementKind.FIELD) {
imports.add(((JCIdent) tree).sym);
Expand All @@ -72,6 +72,10 @@ public void scan(JCTree tree) {
&& ((JCFieldAccess) tree).selected instanceof JCIdent
&& ((JCIdent) ((JCFieldAccess) tree).selected).sym instanceof Symbol.ClassSymbol) {
imports.add(((JCIdent) ((JCFieldAccess) tree).selected).sym);
} else if (tree instanceof JCFieldAccess && ((JCFieldAccess) tree).sym instanceof Symbol.MethodSymbol
&& ((JCFieldAccess) tree).selected instanceof JCIdent
&& ((JCIdent) ((JCFieldAccess) tree).selected).sym instanceof Symbol.ClassSymbol) {
imports.add(((JCIdent) ((JCFieldAccess) tree).selected).sym);
} else if (tree instanceof JCFieldAccess && ((JCFieldAccess) tree).sym instanceof Symbol.ClassSymbol
&& ((JCFieldAccess) tree).selected instanceof JCIdent
&& ((JCIdent) ((JCFieldAccess) tree).selected).sym instanceof Symbol.ClassSymbol
Expand Down

0 comments on commit c16e27c

Please sign in to comment.