JSema implements Sema { @Nullable ITypeBinding resolveType(String name) { int dimensions = 0; int end = name.length() - 1; while (name.charAt(end) == ']') { end -= 2; dimensions++; } name = name.substring(0, end + 1); ITypeBinding typeBinding = ast.resolveWellKnownType(name); if (typeBinding == null) { typeBinding = ASTUtils.resolveType(ast, name); if (typeBinding == null) { return null; } } return dimensions == 0 ? typeBinding : typeBinding.createArrayType(dimensions); } JSema(AST ast); JType type(ITypeBinding typeBinding); JPackageSymbol packageSymbol(IPackageBinding packageBinding); JTypeSymbol typeSymbol(ITypeBinding typeBinding); JMethodSymbol methodSymbol(IMethodBinding methodBinding); JVariableSymbol variableSymbol(IVariableBinding variableBinding); @Override Type getClassType(String fullyQualifiedName);  }
@Test void resolveType() { assertAll( () -> assertThat(sema.resolveType("Nonexistent")) .isNull(), () -> assertThat(sema.resolveType("void")) .isNotNull(), () -> assertThat(sema.resolveType("java.util.Map")) .isNotNull(), () -> assertThat(sema.resolveType("java.util.Map$Entry")) .isNotNull(), () -> assertThat(sema.resolveType("java.util.Map$Entry[][]")) .isNotNull() ); }