Skip to content

Commit 7ac540a

Browse files
committed
fix the conversion of public properties within private classes
1 parent 9b853ed commit 7ac540a

File tree

4 files changed

+16
-1
lines changed
  • core

4 files changed

+16
-1
lines changed

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/toDataFrame.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ internal fun convertToDataFrame(
163163
}
164164
}
165165
property.javaField?.isAccessible = true
166-
// property.isAccessible = true
166+
property.isAccessible = true
167167

168168
var nullable = false
169169
var hasExceptions = false

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,11 @@ class CreateDataFrameTests {
284284
// In the test above you can see decompiled code that "fixes" this strange wrapping
285285
result.toString() shouldBe "Speed1(kmh=null)"
286286
}
287+
288+
private class PrivateClass(val a: Int)
289+
290+
@Test
291+
fun `convert private class with public members`() {
292+
listOf(PrivateClass(1)).toDataFrame() shouldBe dataFrameOf("a")(1)
293+
}
287294
}

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/toDataFrame.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ internal fun convertToDataFrame(
163163
}
164164
}
165165
property.javaField?.isAccessible = true
166+
property.isAccessible = true
166167

167168
var nullable = false
168169
var hasExceptions = false

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,11 @@ class CreateDataFrameTests {
284284
// In the test above you can see decompiled code that "fixes" this strange wrapping
285285
result.toString() shouldBe "Speed1(kmh=null)"
286286
}
287+
288+
private class PrivateClass(val a: Int)
289+
290+
@Test
291+
fun `convert private class with public members`() {
292+
listOf(PrivateClass(1)).toDataFrame() shouldBe dataFrameOf("a")(1)
293+
}
287294
}

0 commit comments

Comments
 (0)