{"action":"created","issue":{"url":"https://api.github.com/repos/jmarranz/relproxy/issues/7","repository_url":"https://api.github.com/repos/jmarranz/relproxy","labels_url":"https://api.github.com/repos/jmarranz/relproxy/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/jmarranz/relproxy/issues/7/comments","events_url":"https://api.github.com/repos/jmarranz/relproxy/issues/7/events","html_url":"https://github.com/jmarranz/relproxy/issues/7","id":181868337,"number":7,"title":"Doesn't seem to work on Java8","user":{"login":"maxott","id":726959,"avatar_url":"https://avatars.githubusercontent.com/u/726959?v=3","gravatar_id":"","url":"https://api.github.com/users/maxott","html_url":"https://github.com/maxott","followers_url":"https://api.github.com/users/maxott/followers","following_url":"https://api.github.com/users/maxott/following{/other_user}","gists_url":"https://api.github.com/users/maxott/gists{/gist_id}","starred_url":"https://api.github.com/users/maxott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxott/subscriptions","organizations_url":"https://api.github.com/users/maxott/orgs","repos_url":"https://api.github.com/users/maxott/repos","events_url":"https://api.github.com/users/maxott/events{/privacy}","received_events_url":"https://api.github.com/users/maxott/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-09T06:02:47Z","updated_at":"2016-10-09T11:37:46Z","closed_at":null,"body":"Just tried to recreate the example at the end of the manual and reloading won't work:\r\n\r\n```\r\nReloaded com.mycompany.app.TestListener@6a41eaa2 - class com.mycompany.app.TestListener Calling method: public abstract void com.mycompany.app.OutputListener.write(java.io.PrintStream) - [Ljava.lang.Object;@7cd62f43\r\nOLD: com.mycompany.app.TestListener@1e88b3c - class com.mycompany.app.TestListener\r\nuppercase\r\nlowercase\r\nNEW: com.mycompany.app.TestListener@6a41eaa2 - class com.mycompany.app.TestListener\r\njava.lang.IllegalArgumentException: object is not an instance of declaring class\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:483)\r\n\tat com.mycompany.app.App$2.onReload(App.java:97)\r\n\tat com.innowhere.relproxy.impl.GenericProxyInvocationHandler.invoke(GenericProxyInvocationHandler.java:40)\r\n\tat com.sun.proxy.$Proxy0.write(Unknown Source)\r\n\tat com.mycompany.app.RelProxyBuiltinImpl.runLoop(RelProxyBuiltinImpl.java:95)\r\n\tat com.mycompany.app.App.mainTest(App.java:191)\r\n\tat com.mycompany.app.App.<init>(App.java:41)\r\n\tat com.mycompany.app.App.main(App.java:31)\r\n```\r\n\r\nI slightly changed the `RelProxyOnReloadListener` implementation to:\r\n\r\n```\r\n        RelProxyOnReloadListener proxyListener = new RelProxyOnReloadListener() {\r\n            public void onReload(Object objOld, Object objNew, Object proxy, Method method, Object[] args) {\r\n                System.out.println(\"Reloaded \" + objNew + \" - \" + objNew.getClass() + \" Calling method: \" + method + \" - \" + args);\r\n\r\n                try {\r\n                  System.out.println(\"OLD: \" + objOld + \" - \" + objOld.getClass());\r\n                  method.invoke(objOld, args);\r\n                  System.out.println(\"NEW: \" + objNew + \" - \" + objNew.getClass());\r\n                  method.invoke(objNew, args);\r\n                } catch (Exception e) {\r\n                  e.printStackTrace();\r\n                }\r\n\r\n            }\r\n        };\r\n```\r\n\r\nIt appears that in my environment, the `Method` object also changes on the recompile.\r\n\r\n```\r\n$ java -version\r\njava version \"1.8.0_65\"\r\nJava(TM) SE Runtime Environment (build 1.8.0_65-b17)\r\nJava HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)\r\n```\r\n\r\nAny ideas on how that could be solved? Am I doing something wrong?"},"comment":{"url":"https://api.github.com/repos/jmarranz/relproxy/issues/comments/252481517","html_url":"https://github.com/jmarranz/relproxy/issues/7#issuecomment-252481517","issue_url":"https://api.github.com/repos/jmarranz/relproxy/issues/7","id":252481517,"user":{"login":"maxott","id":726959,"avatar_url":"https://avatars.githubusercontent.com/u/726959?v=3","gravatar_id":"","url":"https://api.github.com/users/maxott","html_url":"https://github.com/maxott","followers_url":"https://api.github.com/users/maxott/followers","following_url":"https://api.github.com/users/maxott/following{/other_user}","gists_url":"https://api.github.com/users/maxott/gists{/gist_id}","starred_url":"https://api.github.com/users/maxott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxott/subscriptions","organizations_url":"https://api.github.com/users/maxott/orgs","repos_url":"https://api.github.com/users/maxott/repos","events_url":"https://api.github.com/users/maxott/events{/privacy}","received_events_url":"https://api.github.com/users/maxott/received_events","type":"User","site_admin":false},"created_at":"2016-10-09T11:37:46Z","updated_at":"2016-10-09T11:37:46Z","body":"Tried the same with java7 (on a Mac) - same result\r\n\r\n```\r\n$ java -version\r\njava version \"1.7.0_75\"\r\nJava(TM) SE Runtime Environment (build 1.7.0_75-b13)\r\nJava HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)\r\n```\r\n\r\nInterestingly, if I restart the app I immediately;y get an error:\r\n\r\n```\r\n$ java -Dfile.encoding=UTF-8 -classpath target/classes:/Users/max/.m2/repository/com/innowhere/relproxy/0.8.8/relproxy-0.8.jar com.mycompany.app.App\r\nRelProxy to be enabled, development mode detected\r\nBefore compile: /Users/max/src/Playground/jproxy-test/my-app/src/main/java/com/mycompany/app/TestListener.java\r\nAfter compile: /Users/max/src/Playground/jproxy-test/my-app/src/main/java/com/mycompany/app/TestListener.java\r\nRelProxy running\r\nReloaded com.mycompany.app.TestListener@5fa0f02a - class com.mycompany.app.TestListener Calling method: public native int java.lang.Object.hashCode() - null\r\nOLD: com.mycompany.app.TestListener@3ef78672 - class com.mycompany.app.TestListener\r\nNEW: com.mycompany.app.TestListener@5fa0f02a - class com.mycompany.app.TestListener\r\nReloaded com.mycompany.app.TestListener@6c9bc6a9 - class com.mycompany.app.TestListener Calling method: public native int java.lang.Object.hashCode() - null\r\nOLD: com.mycompany.app.TestListener@3ef78672 - class com.mycompany.app.TestListener\r\nNEW: com.mycompany.app.TestListener@6c9bc6a9 - class com.mycompany.app.TestListener\r\nRelProxy stopped\r\nException in thread \"main\" java.lang.RuntimeException: Unexpected Error\r\n\tat com.mycompany.app.App.assertTrue(App.java:202)\r\n\tat com.mycompany.app.App.mainTest(App.java:182)\r\n\tat com.mycompany.app.App.<init>(App.java:41)\r\n\tat com.mycompany.app.App.main(App.java:31)\r\n```"}}
{"actor":{"display_login":"maxott"}}