java.lang.IllegalAccessException with property named isFoo
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 148
- Avg merge
- 13h 44m
- Merged PRs (30d)
- 1
Description
If i pass an object with property name like **is**_Foo_ the render fail with the error:
Exception in thread "main" java.lang.IllegalAccessException: class com.soywiz.korte.dynamic.JvmObjectMapper2 cannot access a member of class Person with modifiers "private final"
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
Here's a simple code to replicate the error
```
import com.soywiz.korte.Template
import kotlinx.coroutines.runBlocking
fun main(args: Array) = runBlocking {
val templateString = """My name is {{ name }} and {% if isBusy %}I'm{% else %}I'm not{% endif %} busy"""
val data = Person("John Doe", true);
val renderer = Template(templateString)
println(renderer(data))
}
data class Person(val name: String, val isBusy: Boolean)
```
When I rename "isBusy" with a name that doesn't start with "is" (e.g. hasTime ) the error disappears.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with com.soywiz.korte.dynamic.JvmObjectMapper2, named in the exception, and run the Kotlin reproduction using a data class property named isBusy. Done means the template renders the isBusy condition without IllegalAccessException, while the equivalent non-is property continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100