Skip to content

Commit

Permalink
Only erase in QualIdent
Browse files Browse the repository at this point in the history
  • Loading branch information
lahodaj committed Oct 14, 2024
1 parent 62b4193 commit bae9e7d
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -727,28 +727,29 @@ public JCIdent Ident(Symbol sym) {
? sym.name
: sym.flatName(), sym)
.setPos(pos)
.setType(types.erasure(sym.type));
.setType(sym.type);
}

/** Create a selection node from a qualifier tree and a symbol.
* @param base The qualifier tree.
*/
public JCFieldAccess Select(JCExpression base, Symbol sym) {
JCFieldAccess res =
(JCFieldAccess)new JCFieldAccess(base, sym.name, sym).setPos(pos);

res.setType(sym.kind == TYP ? types.erasure(sym.type) : sym.type);

return res;
return (JCFieldAccess)new JCFieldAccess(base, sym.name, sym).setPos(pos).setType(sym.type);
}

/** Create a qualified identifier from a symbol, adding enough qualifications
* to make the reference unique.
*/
public JCExpression QualIdent(Symbol sym) {
return isUnqualifiable(sym)
JCExpression result = isUnqualifiable(sym)
? Ident(sym)
: Select(QualIdent(sym.owner), sym);

if (sym.kind == TYP) {
result.setType(types.erasure(sym.type));
}

return result;
}

/** Create an identifier that refers to the variable declared in given variable
Expand Down

0 comments on commit bae9e7d

Please sign in to comment.