-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #965 from Kotlin/buggy-extension-property-exception
Clarify the situation when generated extension property causes ClassCast or NPE exceptions
- Loading branch information
Showing
4 changed files
with
45 additions
and
1 deletion.
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
16 changes: 16 additions & 0 deletions
16
...n/org/jetbrains/kotlinx/dataframe/exceptions/ColumnTypeMismatchesColumnValuesException.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.jetbrains.kotlinx.dataframe.exceptions | ||
|
||
import org.jetbrains.kotlinx.dataframe.AnyCol | ||
import org.jetbrains.kotlinx.dataframe.DataColumn | ||
import org.jetbrains.kotlinx.dataframe.columns.values | ||
import org.jetbrains.kotlinx.dataframe.type | ||
|
||
/** | ||
* Extension properties are generated according to [DataColumn.type] property | ||
* [DataColumn.type] must match types of [DataColumn.values], but it can fail to do so. | ||
* This causes [ClassCastException] or [NullPointerException] when you use extension property and actual value is of different type or is null. | ||
* If generated extension property causes this exception, this is a bug in the library | ||
* You can work around this problem by referring to [column] using String API | ||
*/ | ||
public class ColumnTypeMismatchesColumnValuesException(public val column: AnyCol, cause: Throwable) : | ||
RuntimeException("Failed to convert column '${column.name()}'", cause) |
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