/** * Gets the actual type. * * @param type the type * @return the actual type */ private String getActualType(ClassOrInterfaceType type) { String name = ""; ClassOrInterfaceType scope = type.getScope(); if (scope != null) { name += getActualType(scope) + "."; } name += type.getName(); return name; }
private void processSuperGenerics( SymbolTable table, Symbol<?> symbol, ClassOrInterfaceType type) { if (type != null) { Map<String, SymbolType> typeResolution = new HashMap<String, SymbolType>(); ASTSymbolTypeResolver res = new ASTSymbolTypeResolver(typeResolution, table); SymbolType superType = type.accept(res, null); List<SymbolType> params = superType.getParameterizedTypes(); Map<String, SymbolType> typeMapping = table.getTypeParams(); if (params != null) { Symbol<?> superSymbol = symbol.getInnerScope().findSymbol("super"); Scope innerScope = superSymbol.getInnerScope(); Scope aux = null; if (innerScope != null) { aux = new Scope(superSymbol); } else { aux = new Scope(); } superSymbol.setInnerScope(aux); table.pushScope(aux); Symbol<?> intermediateSuper = new Symbol("super", superSymbol.getType(), superSymbol.getLocation()); if (innerScope != null) { intermediateSuper.setInnerScope(innerScope); } table.pushSymbol(intermediateSuper); // extends a parameterizable type TypeVariable<?>[] tps = superType.getClazz().getTypeParameters(); for (int i = 0; i < tps.length; i++) { table.pushSymbol(tps[i].getName(), ReferenceType.TYPE_PARAM, params.get(i), null); } table.popScope(true); } Set<String> genericLetters = typeMapping.keySet(); if (genericLetters != null) { for (String letter : genericLetters) { if (typeResolution.containsKey(letter)) { table.pushSymbol(letter, ReferenceType.TYPE, typeMapping.get(letter), null); } } } } }