{"action":"reopened","issue":{"url":"https://api.github.com/repos/jmockit/jmockit1/issues/540","repository_url":"https://api.github.com/repos/jmockit/jmockit1","labels_url":"https://api.github.com/repos/jmockit/jmockit1/issues/540/labels{/name}","comments_url":"https://api.github.com/repos/jmockit/jmockit1/issues/540/comments","events_url":"https://api.github.com/repos/jmockit/jmockit1/issues/540/events","html_url":"https://github.com/jmockit/jmockit1/issues/540","id":347994318,"node_id":"MDU6SXNzdWUzNDc5OTQzMTg=","number":540,"title":"NullPointerException when attempting to debug with JUnit5 on Windows 10 with IntelliJ","user":{"login":"m-kuklinski","id":42046027,"node_id":"MDQ6VXNlcjQyMDQ2MDI3","avatar_url":"https://avatars2.githubusercontent.com/u/42046027?v=4","gravatar_id":"","url":"https://api.github.com/users/m-kuklinski","html_url":"https://github.com/m-kuklinski","followers_url":"https://api.github.com/users/m-kuklinski/followers","following_url":"https://api.github.com/users/m-kuklinski/following{/other_user}","gists_url":"https://api.github.com/users/m-kuklinski/gists{/gist_id}","starred_url":"https://api.github.com/users/m-kuklinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-kuklinski/subscriptions","organizations_url":"https://api.github.com/users/m-kuklinski/orgs","repos_url":"https://api.github.com/users/m-kuklinski/repos","events_url":"https://api.github.com/users/m-kuklinski/events{/privacy}","received_events_url":"https://api.github.com/users/m-kuklinski/received_events","type":"User","site_admin":false},"labels":[{"id":116994260,"node_id":"MDU6TGFiZWwxMTY5OTQyNjA=","url":"https://api.github.com/repos/jmockit/jmockit1/labels/could%20not%20reproduce","name":"could not reproduce","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-06T16:29:32Z","updated_at":"2018-08-30T15:59:15Z","closed_at":null,"author_association":"NONE","body":"Version: JMockit 1.28, JUnit5 5.20, IntelliJ 2018.2, tested JDK 1.8.0.181, 10.0.2, and 11.\r\n\r\nWhen attempting to debug a unit test of a Maven project in IntelliJ on Windows, I get a NullPointerException in _createSyntheticFieldsInJREClassToHoldClassLoadingBridges_. The call stack is as follows:\r\n\r\n`java.lang.NullPointerException\r\nat mockit.internal.startup.ClassLoadingBridgeFields.createSyntheticFieldsInJREClassToHoldClassLoadingBridges(ClassLoadingBridgeFields.java:27)\r\nat mockit.internal.startup.Startup.initializeIfPossible(Startup.java:126)\r\nat mockit.integration.junit5.JMockitTestEngine.<init>(JMockitTestEngine.java:26)\r\nat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\nat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\r\nat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\nat java.lang.reflect.Constructor.newInstance(Constructor.java:423)\r\nat java.lang.Class.newInstance(Class.java:442)\r\nat java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)\r\nat java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)\r\nat java.util.ServiceLoader$1.next(ServiceLoader.java:480)\r\nat org.junit.platform.launcher.core.DefaultLauncher.validateUniqueIds(DefaultLauncher.java:65)\r\nat org.junit.platform.launcher.core.DefaultLauncher.<init>(DefaultLauncher.java:60)\r\nat org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:57)\r\nat com.intellij.junit5.JUnit5IdeaTestRunner.createListeners(JUnit5IdeaTestRunner.java:42)\r\nat com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:45)\r\nat com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)\r\nat com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\nat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\nat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\nat java.lang.reflect.Method.invoke(Method.java:498)\r\nat com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)`\r\n\r\nUpon further investigation, this is happening as IntelliJ does not pass any runtime information, which causes JMockit to execute the agent, which updates the variable _instrumentation_, and then continues execution with it upon the return of the agent. On my system, the splitting of the VM during this process appears to create a detached ClassLoader, and thus creates a _separate class altogether_, complete with its own copy of the static _instrumentation_ variable. I confirmed this via debugging. Thus, when the _instrumentation_ variable is updated, it is _not_ updated in the original context, which is under a separate class altogether (although with the exact same prototype/name, but a different ID in the VM and a different memory space).\r\n\r\nThis does not happen:\r\n\r\n1. When running the unit tests under Maven. I presume SureFire _et al_ are handling passing the agent to it.\r\n2. On OSX. This procedure seems to run fine on OSX.\r\n\r\nI have forked the project on github, and patched it in a way that uses reflection to update all potential copies of _instrumentation_ to work around this issue, which appears to work on my system."}}
{"actor":{"display_login":"rliesenfeld"}}