{"action":"created","issue":{"url":"https://api.github.com/repos/mockito/mockito/issues/824","repository_url":"https://api.github.com/repos/mockito/mockito","labels_url":"https://api.github.com/repos/mockito/mockito/issues/824/labels{/name}","comments_url":"https://api.github.com/repos/mockito/mockito/issues/824/comments","events_url":"https://api.github.com/repos/mockito/mockito/issues/824/events","html_url":"https://github.com/mockito/mockito/issues/824","id":195766713,"number":824,"title":"Exception when using mock-maker-inline","user":{"login":"vyazelenko","id":696855,"avatar_url":"https://avatars.githubusercontent.com/u/696855?v=3","gravatar_id":"","url":"https://api.github.com/users/vyazelenko","html_url":"https://github.com/vyazelenko","followers_url":"https://api.github.com/users/vyazelenko/followers","following_url":"https://api.github.com/users/vyazelenko/following{/other_user}","gists_url":"https://api.github.com/users/vyazelenko/gists{/gist_id}","starred_url":"https://api.github.com/users/vyazelenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vyazelenko/subscriptions","organizations_url":"https://api.github.com/users/vyazelenko/orgs","repos_url":"https://api.github.com/users/vyazelenko/repos","events_url":"https://api.github.com/users/vyazelenko/events{/privacy}","received_events_url":"https://api.github.com/users/vyazelenko/received_events","type":"User","site_admin":false},"labels":[{"id":450180641,"url":"https://api.github.com/repos/mockito/mockito/labels/final-class-or-methods","name":"final-class-or-methods","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-15T10:18:03Z","updated_at":"2016-12-16T10:00:49Z","closed_at":null,"body":"I was trying out `mock-maker-inline` feature with the following example:\r\n```java\r\nimport static org.mockito.Mockito.*;\r\n\r\nfinal class FinalClass {\r\n  int m1() {\r\n    throw new RuntimeException(\"42\");\r\n  }\r\n}\r\n\r\npublic class TestMockFinal {\r\n  public static void main(String[] args) {\r\n    FinalClass cl = mock(FinalClass.class);\r\n    when(cl.m1()).thenReturn(-1);\r\n    if (cl.m1() != -1) {\r\n      throw new Error(\"Not mocked!\");\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nWhen I run this code I get the following error:\r\n```\r\nException in thread \"main\" java.lang.ExceptionInInitializerError\r\n\tat org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:24)\r\n\tat org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)\r\n\tat org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:168)\r\n\tat org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:162)\r\n\tat org.mockito.internal.MockitoCore.mock(MockitoCore.java:64)\r\n\tat org.mockito.Mockito.mock(Mockito.java:1665)\r\n\tat org.mockito.Mockito.mock(Mockito.java:1578)\r\n\tat TestMockFinal.main(TestMockFinal.java:11)\r\nCaused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@379619aa\r\n\tat org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:86)\r\n\tat org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:40)\r\n\tat org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:18)\r\n\tat org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:17)\r\n\t... 8 more\r\nCaused by: java.lang.IllegalStateException: Error during attachment using: ByteBuddyAgent.AttachmentProvider.Compound{attachmentProviders=[ByteBuddyAgent.AttachmentProvider.ForJigsawVm.INSTANCE, ByteBuddyAgent.AttachmentProvider.ForJ9Vm.INSTANCE, ByteBuddyAgent.AttachmentProvider.ForToolsJarVm.JVM_ROOT, ByteBuddyAgent.AttachmentProvider.ForToolsJarVm.JDK_ROOT, ByteBuddyAgent.AttachmentProvider.ForToolsJarVm.MACINTOSH]}\r\n\tat net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:314)\r\n\tat net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:280)\r\n\tat net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:248)\r\n\tat net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:234)\r\n\tat org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<init>(InlineByteBuddyMockMaker.java:101)\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\n\tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\n\tat java.lang.reflect.Constructor.newInstance(Constructor.java:423)\r\n\tat java.lang.Class.newInstance(Class.java:442)\r\n\tat org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:81)\r\n\t... 11 more\r\nCaused by: java.lang.reflect.InvocationTargetException\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:301)\r\n\t... 21 more\r\nCaused by: com.sun.tools.attach.AttachNotSupportedException: no providers installed\r\n\tat com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208)\r\n\t... 26 more\r\n```\r\n\r\nEnvironment:\r\n- Windows 7 (64 bit)\r\n- JDK 1.8.0_112 (64 bit)\r\n```\r\njava version \"1.8.0_112\"\r\nJava(TM) SE Runtime Environment (build 1.8.0_112-b15)\r\nJava HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)\r\n```\r\n- Mockito 2.3.4\r\n- ByteBuddy 1.5.5 (transitive from Mockito)\r\n"},"comment":{"url":"https://api.github.com/repos/mockito/mockito/issues/comments/267558793","html_url":"https://github.com/mockito/mockito/issues/824#issuecomment-267558793","issue_url":"https://api.github.com/repos/mockito/mockito/issues/824","id":267558793,"user":{"login":"bric3","id":803621,"avatar_url":"https://avatars.githubusercontent.com/u/803621?v=3","gravatar_id":"","url":"https://api.github.com/users/bric3","html_url":"https://github.com/bric3","followers_url":"https://api.github.com/users/bric3/followers","following_url":"https://api.github.com/users/bric3/following{/other_user}","gists_url":"https://api.github.com/users/bric3/gists{/gist_id}","starred_url":"https://api.github.com/users/bric3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bric3/subscriptions","organizations_url":"https://api.github.com/users/bric3/orgs","repos_url":"https://api.github.com/users/bric3/repos","events_url":"https://api.github.com/users/bric3/events{/privacy}","received_events_url":"https://api.github.com/users/bric3/received_events","type":"User","site_admin":false},"created_at":"2016-12-16T10:00:49Z","updated_at":"2016-12-16T10:00:49Z","body":"Thanks @vyazelenko \r\nI'm not sure what's wrong here. Maybe @raphw has a better idea. Do you think you can debug the agent installation `net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:314)` ? Preferrably with ByteBuddy 1.5.9 as the fix will go after this version."}}
{"actor":{"display_login":"bric3"}}