Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop pre-JDK 11 logic from Refaster's Inliner class #3441

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 1 addition & 16 deletions core/src/main/java/com/google/errorprone/refaster/Inliner.java
Expand Up @@ -227,26 +227,11 @@ public TypeVar inlineAsVar(UTypeVar var) throws CouldNotResolveImportException {
sym.type = typeVar;
typeVarCache.put(var.getName(), typeVar);
// Any recursive uses of var will point to the same TypeVar object generated above.
setUpperBound(typeVar, var.getUpperBound().inline(this));
typeVar.setUpperBound(var.getUpperBound().inline(this));
typeVar.lower = var.getLowerBound().inline(this);
return typeVar;
}

private static void setUpperBound(TypeVar typeVar, Type bound) {
// https://bugs.openjdk.java.net/browse/JDK-8193367
try {
TypeVar.class.getMethod("setUpperBound", Type.class).invoke(typeVar, bound);
return;
} catch (ReflectiveOperationException e) {
// continue below
}
try {
TypeVar.class.getField("bound").set(typeVar, bound);
} catch (ReflectiveOperationException e) {
throw new LinkageError(e.getMessage(), e);
}
}

Type inlineTypeVar(UTypeVar var) throws CouldNotResolveImportException {
Optional<TypeWithExpression> typeVarBinding = getOptionalBinding(var.key());
if (typeVarBinding.isPresent()) {
Expand Down