Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

IllegalCallableAccessException on private fields #11

Open
@ubuntudroid

Description

Suppose you have a data class with a private parameter:

data class Test(
 val a: String,
 private val b: String,
)

Calling pprint(Test("a", "b")) will result in the following exception:

kotlin.reflect.full.IllegalCallableAccessException: java.lang.IllegalAccessException: Class java.lang.Class<kotlin.reflect.jvm.internal.calls.CallerImpl$FieldGetter> cannot access private final field java.lang.String com.test.Test.b of class java.lang.Class<com.test.Test>
 at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:280)
 at kotlin.reflect.jvm.internal.KProperty1Impl.get(KProperty1Impl.kt:35)
 at kotlin.reflect.jvm.internal.KProperty1Impl.invoke(KProperty1Impl.kt:41)
 <pprint callsite>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /