typetools / typetools/checker-framework
`ClassCastException` in `AnnotatedTypeFactory.getAnnotatedType()`
Open
Nobody has claimed this yet.
crash
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
I don't have a self-contained repro, but the issue should be easy to understand. We are seeing the following crash when running the Object Construction Checker:
Exception: java.lang.ClassCastException: org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedIntersectionType cannot be cast to org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedDeclaredType; java.lang.ClassCastException: org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedIntersectionType cannot be cast to org.checkerframework.framework.type.AnnotatedTypeMirror$AnnotatedDeclaredType
at org.checkerframework.framework.type.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:2915)
at org.checkerframework.checker.objectconstruction.ObjectConstructionAnnotatedTypeFactory.getMustCallValue(ObjectConstructionAnnotatedTypeFactory.java:155)
...
It happens at this line:
And the related code has an interface declaration like this:
public interface Writer extends Closeable, CellSink, ShipperListener {}
So it seems that when calling getAnnotatedType(TypeElement) the result may not always be an AnnotatedDeclaredType.
Sorry again for not having a small test input to reproduce; we can put one together if need be.
/cc @kelloggm @Nargeshdb
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.