in remoting/server/web/web.ui/src/org/netbeans/modules/jackpot30/backend/ui/highlighting/SemanticHighlighter.java [97:156]
public static Map<Token, Coloring> computeHighlights(CompilationInfo info, TokenList tl) {
DetectorVisitor v = new DetectorVisitor(info, tl);
long start = System.currentTimeMillis();
Map<Token, Coloring> newColoring = new IdentityHashMap<Token, Coloring>();
CompilationUnitTree cu = info.getCompilationUnit();
v.scan(cu, null);
Map<Token, Coloring> oldColors = new HashMap<Token, Coloring>();
Map<Token, Coloring> removedTokens = new IdentityHashMap<Token, Coloring>(oldColors);
Set<Token> addedTokens = new HashSet<Token>();
for (Element decl : v.type2Uses.keySet()) {
List<Use> uses = v.type2Uses.get(decl);
for (Use u : uses) {
if (u.spec == null)
continue;
if (u.type.contains(UseTypes.DECLARATION) && isPrivateElement(decl)) {
if ((decl.getKind().isField() && !isSerialVersionUID(info, decl)) || isLocalVariableClosure(decl)) {
if (!hasAllTypes(uses, EnumSet.of(UseTypes.READ, UseTypes.WRITE))) {
u.spec.add(ColoringAttributes.UNUSED);
}
}
if ((decl.getKind() == ElementKind.CONSTRUCTOR && !decl.getModifiers().contains(Modifier.PRIVATE)) || decl.getKind() == ElementKind.METHOD) {
if (!hasAllTypes(uses, EnumSet.of(UseTypes.EXECUTE))) {
u.spec.add(ColoringAttributes.UNUSED);
}
}
if (decl.getKind().isClass() || decl.getKind().isInterface()) {
if (!hasAllTypes(uses, EnumSet.of(UseTypes.CLASS_USE))) {
u.spec.add(ColoringAttributes.UNUSED);
}
}
}
Coloring c = collection2Coloring(u.spec);
Token t = v.tree2Token.get(u.tree.getLeaf());
if (t != null) {
newColoring.put(t, c);
Coloring oldColoring = removedTokens.remove(t);
if (oldColoring == null || !oldColoring.equals(c)) {
addedTokens.add(t);
}
}
}
}
return newColoring;
}