-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
ClassCastException
in XType.getTypeElement().className
.
This CL fixes a bug where calling `XType.getTypeElement().className` results in a `ClassCastException` when called on an array type in KSP. The underlying issue is that `XType.getTypeElement()` gets tricked into thinking there's an actual `TypeElement` for an array type since it has a declaration, `Array` which it thinks is the appropriate `TypeElement`, which it's not. This leads to two issues. 1. Since an array type isn't actually represented as a `ClassName`, we get a `ClassCastException` when trying to cast it. 2. It leads to inconsistencies when compiling in Javac versus KSP. For the same consistency reason as #2, I've also changed the implementation for primitive types to return null type element in KSP since this matches the Javac behavior where there is no valid ClassName for a primitive type. Test: XTypeTest Change-Id: I7e5d8856115d99e666e487c52cc5d9f538149cae
- Loading branch information
Showing
5 changed files
with
94 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters