cannot access map during function


For the function `convertToMarkDown`

I tried to add a map save the `ad.titlle` which was a String like this.

fun convertToMarkDown(ads: List<Advisory>, packageName: String): String {
var result = StringBuilder().append("# $packageName\n")
var map = mutableMapOf<String, Boolean>()
for (ad in ads) {
map.put(ad.title, true)
val aliases = ad.aliases.joinToString(",")
val refs = { it -> "* $it " }.joinToString("\n")
var adString = """

The `println(map)` would print nothing. And if I debug the fuction, the map would not be accessed.

I tried to write a demo function




I have no idea why map operation does not work during the function inside the plugin.



Sorry, but the problem is unclear. At the first glance, it seems that the source and executed code are out of sync.

Please try to recompile your project and debug it again. If the issue still happens, prepare a branch with this code and a test project we can use to investigate it. Make sure, that projects do not require any additional setup steps, so we can check it out and run without any additional actions.


I have created a `map` branch for test

The weired is no matter what parameter I pass to the `packageName` parameter of `chcker.Check` method. Inside the method, the parameter seem to always be the parameter I passed fitst time. I am not sure if some cache or something broken. I try to invalidate cache, but doesn't work.


I'm sorry, but the tests cannot be run due to the following error:

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(
    at java.base/java.lang.reflect.Constructor.newInstance(
    at junit.framework.TestSuite.createTest(
    at junit.framework.TestSuite.addTestMethod(
    at junit.framework.TestSuite.addTestsFromTestCase(
    at junit.framework.TestSuite.<init>(
    at org.junit.internal.runners.JUnit38ClassRunner.<init>(
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(
    at org.junit.internal.requests.ClassRequest.getRunner(
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(
    at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.base/java.lang.reflect.Method.invoke(
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(
    at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(
    at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker$
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(
    at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private static java.util.LinkedHashSet accessible: module java.base does not "opens" to unnamed module @4e0ae11f
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(
    at java.base/java.lang.reflect.Field.setAccessible(
    at com.intellij.util.ReflectionUtil.findFieldInHierarchy(
    at com.intellij.util.ReflectionUtil.findAssignableField(
    at com.intellij.util.ReflectionUtil.getStaticFieldValue(
    at com.intellij.testFramework.UsefulTestCase.<clinit>(
    ... 38 more

em. There is nothing special configure. The project is created by the 

I am not sure if there is need to `Run Plugin` and `Run Verification` task.

Gradle JVM


I've changed Gradle JVM and it works, sorry.

Also, the plugin works as expected:


I don't know what can be the issue cause. Try to check out the project again from scratch.


It's so weired. I clone the project from the scratch and delete the `.idea` folder. But I find the problem still exists. Could you try to modify the `packageName` parameter to see if it changed inside the function `Check`.


There is an issue in Gradle IntelliJ Plugin 1.5.3. It will be fixed in the next release.

Please use the "clean" task to force recompilation.


Please sign in to leave a comment.