Skip to content

Commit

Permalink
Fix remainder of test0022 in ASTConverter15JLS8Test
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
Rob Stryker committed May 22, 2024
1 parent 6f322e6 commit 9a98668
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.sun.tools.javac.code.Symbol.TypeSymbol;
import com.sun.tools.javac.code.Symbol.VarSymbol;
import com.sun.tools.javac.code.Type.ModuleType;
import com.sun.tools.javac.code.Type.WildcardType;
import com.sun.tools.javac.code.Types;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree;
Expand All @@ -52,7 +53,9 @@
import com.sun.tools.javac.tree.JCTree.JCPackageDecl;
import com.sun.tools.javac.tree.JCTree.JCPrimitiveTypeTree;
import com.sun.tools.javac.tree.JCTree.JCTypeParameter;
import com.sun.tools.javac.tree.JCTree.JCTypeApply;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.tree.JCTree.JCWildcard;
import com.sun.tools.javac.util.Context;

/**
Expand Down Expand Up @@ -159,6 +162,13 @@ ITypeBinding resolveType(Type type) {
if (jcTree instanceof JCArrayTypeTree arrayType && arrayType.type != null) {
return canonicalize(new JavacTypeBinding(arrayType.type, this));
}
if (jcTree instanceof JCWildcard wcType && wcType.type != null) {
return canonicalize(new JavacTypeBinding(wcType.type, this));
}
if (jcTree instanceof JCTypeApply jcta && jcta.type != null) {
return canonicalize(new JavacTypeBinding(jcta.type, this));
}

// return this.flowResult.stream().map(env -> env.enclClass)
// .filter(Objects::nonNull)
// .map(decl -> decl.type)
Expand Down Expand Up @@ -342,8 +352,10 @@ IBinding resolveName(Name name) {
if (tree == null) {
tree = this.converter.domToJavac.get(name.getParent());
}
if( tree != null )
return resolveNameToJavac(name, tree);
if( tree != null ) {
IBinding ret = resolveNameToJavac(name, tree);
return ret;
}
return null;
}

Expand All @@ -366,6 +378,9 @@ IBinding resolveNameToJavac(Name name, JCTree tree) {
if (tree instanceof JCVariableDecl variableDecl && variableDecl.sym != null) {
return getBinding(variableDecl.sym, variableDecl.type);
}
if (tree instanceof JCTypeParameter variableDecl && variableDecl.type != null && variableDecl.type.tsym != null) {
return getBinding(variableDecl.type.tsym, variableDecl.type);
}
return null;
}

Expand Down

0 comments on commit 9a98668

Please sign in to comment.