diff --git a/java/com/google/turbine/processing/TurbineTypes.java b/java/com/google/turbine/processing/TurbineTypes.java index d8f0c85c..13458ec8 100644 --- a/java/com/google/turbine/processing/TurbineTypes.java +++ b/java/com/google/turbine/processing/TurbineTypes.java @@ -877,7 +877,10 @@ private ImmutableList directSupertypes(ClassTy t) { builder.add(ClassTy.OBJECT); } for (Type interfaceType : info.interfaceTypes()) { - builder.add(raw ? erasure(interfaceType) : subst(interfaceType, mapping)); + // ErrorTypes are not included in directSupertypes for compatibility with javac + if (interfaceType.tyKind() == TyKind.CLASS_TY) { + builder.add(raw ? erasure(interfaceType) : subst(interfaceType, mapping)); + } } return builder.build(); } diff --git a/javatests/com/google/turbine/processing/ProcessingIntegrationTest.java b/javatests/com/google/turbine/processing/ProcessingIntegrationTest.java index f67ba112..097e59a7 100644 --- a/javatests/com/google/turbine/processing/ProcessingIntegrationTest.java +++ b/javatests/com/google/turbine/processing/ProcessingIntegrationTest.java @@ -436,6 +436,23 @@ public void superType() throws IOException { assertThat(diags).containsExactly("could not resolve S", "S [S]").inOrder(); } + @Test + public void superTypeInterfaces() throws IOException { + ImmutableList units = + parseUnit( + "=== T.java ===", // + "abstract class T implements NoSuch, java.util.List {", + "}"); + TurbineError e = runProcessors(units, new SuperTypeProcessor()); + ImmutableList diags = + e.diagnostics().stream().map(d -> d.message()).collect(toImmutableList()); + assertThat(diags) + .containsExactly( + "could not resolve NoSuch", + "java.lang.Object [java.lang.Object, java.util.List]") + .inOrder(); + } + @SupportedAnnotationTypes("*") public static class GenerateAnnotationProcessor extends AbstractProcessor {