Skip to content

Commit d67bc15

Browse files
cushonError Prone Team
authored and
Error Prone Team
committed
Prepare for the removal of TypeTag.UNKNOWN
The constant was removed as part of https://bugs.openjdk.org/browse/JDK-8339296 This is a minimal fix to avoid breaking for upcoming javac versions. I suspect this logic isn't actually necessary, we aren't supposed to process ASTs with errors and there have been a variety of improvements in how that's handled since this was added. PiperOrigin-RevId: 690616927
1 parent 9ab5858 commit d67bc15

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1299,15 +1299,17 @@ public static boolean isVoidType(Type type, VisitorState state) {
12991299
}
13001300

13011301
private static final ImmutableSet<TypeTag> SUBTYPE_UNDEFINED =
1302-
Sets.immutableEnumSet(
1303-
TypeTag.METHOD, TypeTag.PACKAGE, TypeTag.UNKNOWN, TypeTag.ERROR, TypeTag.FORALL);
1302+
Sets.immutableEnumSet(TypeTag.METHOD, TypeTag.PACKAGE, TypeTag.ERROR, TypeTag.FORALL);
13041303

13051304
/** Returns true if {@code erasure(s) <: erasure(t)}. */
13061305
public static boolean isSubtype(Type s, Type t, VisitorState state) {
13071306
if (s == null || t == null) {
13081307
return false;
13091308
}
1310-
if (SUBTYPE_UNDEFINED.contains(s.getTag()) || SUBTYPE_UNDEFINED.contains(t.getTag())) {
1309+
if (SUBTYPE_UNDEFINED.contains(s.getTag())) {
1310+
return false;
1311+
}
1312+
if (t == state.getSymtab().unknownType) {
13111313
return false;
13121314
}
13131315
Types types = state.getTypes();

0 commit comments

Comments
 (0)