Skip to content

Commit

Permalink
Fix TypeElement.getSuperclass for records
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 400768241
  • Loading branch information
cushon authored and Javac Team committed Oct 4, 2021
1 parent 0b547dc commit f59a1f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions java/com/google/turbine/processing/TurbineElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public TypeMirror get() {
switch (info.kind()) {
case CLASS:
case ENUM:
case RECORD:
if (info.superclass() != null) {
return factory.asTypeMirror(info.superClassType());
}
Expand All @@ -283,8 +284,6 @@ public TypeMirror get() {
case INTERFACE:
case ANNOTATION:
return factory.noType();
case RECORD:
// TODO(b/200222393): add support for records
}
throw new AssertionError(info.kind());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,11 @@ public SourceVersion getSupportedSourceVersion() {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element e : roundEnv.getRootElements()) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, e.getKind() + " " + e);
processingEnv
.getMessager()
.printMessage(
Diagnostic.Kind.ERROR,
e.getKind() + " " + e + " " + ((TypeElement) e).getSuperclass());
for (Element m : e.getEnclosedElements()) {
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, m.getKind() + " " + m);
}
Expand Down Expand Up @@ -661,7 +665,7 @@ public void recordProcessing() throws IOException {
.filter(d -> d.severity().equals(Diagnostic.Kind.ERROR))
.map(d -> d.message()))
.containsExactly(
"RECORD R",
"RECORD R java.lang.Record",
"RECORD_COMPONENT x",
"RECORD_COMPONENT y",
"CONSTRUCTOR R(T,int[])",
Expand Down

0 comments on commit f59a1f3

Please sign in to comment.