Skip to content

Commit

Permalink
Generics with extends or super now handled correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <stryker@redhat.com>
  • Loading branch information
Rob Stryker committed Mar 11, 2024
1 parent da86d34 commit 8767b95
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;

import com.sun.source.tree.CaseTree.CaseKind;
import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.parser.Tokens.Comment;
import com.sun.tools.javac.tree.JCTree;
Expand Down Expand Up @@ -1186,8 +1187,15 @@ private Type convertToType(JCTree javac) {
jcTypeApply.getTypeArguments().stream().map(this::convertToType).forEach(res.typeArguments()::add);
return res;
}
if (javac instanceof JCWildcard) {
if (javac instanceof JCWildcard wc) {
WildcardType res = this.ast.newWildcardType();
if( wc.kind.kind == BoundKind.SUPER) {
final Type bound = convertToType(wc.inner);
res.setBound(bound, false);
} else if( wc.kind.kind == BoundKind.EXTENDS) {
final Type bound = convertToType(wc.inner);
res.setBound(bound, true);
}
commonSettings(res, javac);
return res;
}
Expand Down

0 comments on commit 8767b95

Please sign in to comment.