I'm modifying open JDK to add features and I've run into this twice with no good solution.
There's a class named JCStatement
which extends JCTree
.
Issue: I want to cast a List<JCStatement>
into a List<JCTree>
.
It's clear that a class can reference one of its extensions, but when I have it on a List, it just doesn't work.
I used: (List<JCTree>)((List<?>)params)
to cast, which works, but doesn't build on ant. IDE gives me the following warning:
Type safety: Unchecked cast from List<capture#1-of ?> to List<JCTree>
So this must be worked around somehow.
I appreciate any help.