mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-10 16:03:16 +00:00
Chain completers
This commit is contained in:
parent
2781df575c
commit
d78c3425a1
@ -2310,35 +2310,17 @@ public class ClassReader {
|
||||
currentClassFile = classFile;
|
||||
List<Attribute.TypeCompound> newList = deproxyTypeCompoundList(proxies);
|
||||
sym.setTypeAttributes(newList.prependList(sym.getRawTypeAttributes()));
|
||||
if (sym.completer != Completer.NULL_COMPLETER) {
|
||||
Assert.check(sym.completer instanceof TypeAnnotationsSymbolCompleter);
|
||||
TypeAnnotationsSymbolCompleter completer = (TypeAnnotationsSymbolCompleter) sym.completer;
|
||||
completer.attributes = newList.prependList(completer.attributes);
|
||||
} else {
|
||||
sym.completer = new TypeAnnotationsSymbolCompleter(newList);
|
||||
}
|
||||
Completer previousCompleter = sym.completer;
|
||||
sym.completer = sym -> {
|
||||
addTypeAnnotationsToSymbol(sym, newList);
|
||||
previousCompleter.complete(sym);
|
||||
};
|
||||
} finally {
|
||||
currentClassFile = previousClassFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TypeAnnotationsSymbolCompleter implements Completer {
|
||||
|
||||
List<Attribute.TypeCompound> attributes;
|
||||
|
||||
private TypeAnnotationsSymbolCompleter(List<Attribute.TypeCompound> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Symbol sym) throws CompletionFailure {
|
||||
Assert.checkNonNull(attributes);
|
||||
addTypeAnnotationsToSymbol(sym, attributes);
|
||||
attributes = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewrites types in the given symbol to include type annotations.
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user