Skip to content

Commit

Permalink
fix the conversion of public properties within private classes
Browse files Browse the repository at this point in the history
  • Loading branch information
koperagen committed Dec 18, 2023
1 parent 9b853ed commit 7ac540a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ internal fun convertToDataFrame(
}
}
property.javaField?.isAccessible = true
// property.isAccessible = true
property.isAccessible = true

var nullable = false
var hasExceptions = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,11 @@ class CreateDataFrameTests {
// In the test above you can see decompiled code that "fixes" this strange wrapping
result.toString() shouldBe "Speed1(kmh=null)"
}

private class PrivateClass(val a: Int)

@Test
fun `convert private class with public members`() {
listOf(PrivateClass(1)).toDataFrame() shouldBe dataFrameOf("a")(1)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ internal fun convertToDataFrame(
}
}
property.javaField?.isAccessible = true
property.isAccessible = true

var nullable = false
var hasExceptions = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,11 @@ class CreateDataFrameTests {
// In the test above you can see decompiled code that "fixes" this strange wrapping
result.toString() shouldBe "Speed1(kmh=null)"
}

private class PrivateClass(val a: Int)

@Test
fun `convert private class with public members`() {
listOf(PrivateClass(1)).toDataFrame() shouldBe dataFrameOf("a")(1)
}
}

0 comments on commit 7ac540a

Please sign in to comment.