Skip to content

Commit

Permalink
Simplify code per review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
sadayapalam committed May 18, 2020
1 parent 94e232e commit ecb41ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Expand Up @@ -271,14 +271,8 @@ public VarSymbol getClassField(Type type, Types types) {
I1, I2, ... In, V.class is typed to be Class<? extends Object & I1 & I2 .. & In>
*/
if (type.isValue()) {
ClassType ct = (ClassType) type;
Type it;
if (ct.interfaces_field == null || ct.interfaces_field.isEmpty()) {
it = objectType;
} else {
it = types.makeIntersectionType(ct.interfaces_field, true);
}
arg = new WildcardType(it, BoundKind.EXTENDS, boundClass);
List<Type> bounds = List.of(objectType).appendList(((ClassSymbol) type.tsym).getInterfaces());
arg = new WildcardType(types.makeIntersectionType(bounds), BoundKind.EXTENDS, boundClass);
} else {
arg = types.erasure(type);
}
Expand Down
Expand Up @@ -2522,12 +2522,8 @@ Type adjustMethodReturnType(Symbol msym, Type qualifierType, Name methodName, Li
// I1, I2, ... In, v.getClass() is typed to be Class<? extends Object & I1 & I2 .. & In>
Type wcb;
if (qualifierType.isValue()) {
ClassType ct = (ClassType) qualifierType;
if (ct.interfaces_field == null || ct.interfaces_field.isEmpty()) {
wcb = syms.objectType;
} else {
wcb = types.makeIntersectionType(ct.interfaces_field, true);
}
List<Type> bounds = List.of(syms.objectType).appendList(((ClassSymbol) qualifierType.tsym).getInterfaces());
wcb = types.makeIntersectionType(bounds);
} else {
wcb = types.erasure(qualifierType);
}
Expand Down

0 comments on commit ecb41ea

Please sign in to comment.