You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Properly re-introduce annotations on types of IdentifierTrees #1379
This is a follow-up to #1377. In #1378 we address #1377 in a rather hacky way, by deciding unconditionally to use the type on the IdentifierTree for variables whose type is a type var, and to use the type on the corresponding Symbol otherwise. What we should probably do instead is take the type on the IdentifierTree and then restore explicit type-use annotations from the type of the Symbol. This way we will preserve any other substitutions that javac has done. For the specific example from #1377:
If you get the type of the Symbol for instance, you'll get the T type variable declared on Base, whose upper bound is Object & Marker. But, if you get the type of the instanceIdentifierTree, then given instance is being used within SubClass, you get back the T type variable of SubClass whose upper bound is Generic<Integer> & Marker, as desired. So this is why the "fix" in #1378 works for this case. But, as noted above, I think we should try to do something more general / principled.
Activity
msridhar commentedon Dec 18, 2025
See also https://bugs.openjdk.org/browse/JDK-8374020 which is somewhat related in that it shows some of the javac inconsistencies we're trying to work around