{"action":"created","issue":{"url":"https://api.github.com/repos/jacoco/jacoco/issues/434","repository_url":"https://api.github.com/repos/jacoco/jacoco","labels_url":"https://api.github.com/repos/jacoco/jacoco/issues/434/labels{/name}","comments_url":"https://api.github.com/repos/jacoco/jacoco/issues/434/comments","events_url":"https://api.github.com/repos/jacoco/jacoco/issues/434/events","html_url":"https://github.com/jacoco/jacoco/pull/434","id":167688278,"number":434,"title":"Fix instrumentation to not violate Java Virtual Machine Specification regarding initialization of final fields","user":{"login":"Godin","id":138671,"avatar_url":"https://avatars.githubusercontent.com/u/138671?v=3","gravatar_id":"","url":"https://api.github.com/users/Godin","html_url":"https://github.com/Godin","followers_url":"https://api.github.com/users/Godin/followers","following_url":"https://api.github.com/users/Godin/following{/other_user}","gists_url":"https://api.github.com/users/Godin/gists{/gist_id}","starred_url":"https://api.github.com/users/Godin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Godin/subscriptions","organizations_url":"https://api.github.com/users/Godin/orgs","repos_url":"https://api.github.com/users/Godin/repos","events_url":"https://api.github.com/users/Godin/events{/privacy}","received_events_url":"https://api.github.com/users/Godin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jacoco/jacoco/labels/bug","name":"bug","color":"ff3333"},{"url":"https://api.github.com/repos/jacoco/jacoco/labels/core","name":"core","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"Godin","id":138671,"avatar_url":"https://avatars.githubusercontent.com/u/138671?v=3","gravatar_id":"","url":"https://api.github.com/users/Godin","html_url":"https://github.com/Godin","followers_url":"https://api.github.com/users/Godin/followers","following_url":"https://api.github.com/users/Godin/following{/other_user}","gists_url":"https://api.github.com/users/Godin/gists{/gist_id}","starred_url":"https://api.github.com/users/Godin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Godin/subscriptions","organizations_url":"https://api.github.com/users/Godin/orgs","repos_url":"https://api.github.com/users/Godin/repos","events_url":"https://api.github.com/users/Godin/events{/privacy}","received_events_url":"https://api.github.com/users/Godin/received_events","type":"User","site_admin":false},"assignees":[{"login":"Godin","id":138671,"avatar_url":"https://avatars.githubusercontent.com/u/138671?v=3","gravatar_id":"","url":"https://api.github.com/users/Godin","html_url":"https://github.com/Godin","followers_url":"https://api.github.com/users/Godin/followers","following_url":"https://api.github.com/users/Godin/following{/other_user}","gists_url":"https://api.github.com/users/Godin/gists{/gist_id}","starred_url":"https://api.github.com/users/Godin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Godin/subscriptions","organizations_url":"https://api.github.com/users/Godin/orgs","repos_url":"https://api.github.com/users/Godin/repos","events_url":"https://api.github.com/users/Godin/events{/privacy}","received_events_url":"https://api.github.com/users/Godin/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/jacoco/jacoco/milestones/21","html_url":"https://github.com/jacoco/jacoco/milestones/0.7.8","labels_url":"https://api.github.com/repos/jacoco/jacoco/milestones/21/labels","id":1791031,"number":21,"title":"0.7.8","description":"Instrumentation with creation of \"companion\" classes instead of addition of members.","creator":{"login":"Godin","id":138671,"avatar_url":"https://avatars.githubusercontent.com/u/138671?v=3","gravatar_id":"","url":"https://api.github.com/users/Godin","html_url":"https://github.com/Godin","followers_url":"https://api.github.com/users/Godin/followers","following_url":"https://api.github.com/users/Godin/following{/other_user}","gists_url":"https://api.github.com/users/Godin/gists{/gist_id}","starred_url":"https://api.github.com/users/Godin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Godin/subscriptions","organizations_url":"https://api.github.com/users/Godin/orgs","repos_url":"https://api.github.com/users/Godin/repos","events_url":"https://api.github.com/users/Godin/events{/privacy}","received_events_url":"https://api.github.com/users/Godin/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":8,"state":"open","created_at":"2016-05-26T23:07:05Z","updated_at":"2016-08-01T07:25:52Z","due_on":null,"closed_at":null},"comments":23,"created_at":"2016-07-26T19:16:50Z","updated_at":"2016-08-14T00:48:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jacoco/jacoco/pulls/434","html_url":"https://github.com/jacoco/jacoco/pull/434","diff_url":"https://github.com/jacoco/jacoco/pull/434.diff","patch_url":"https://github.com/jacoco/jacoco/pull/434.patch"},"body":"Currently `FieldProbeArrayStrategy` creates `static final` field `$jacocoData`, value for which is set by bytecode instruction `putstatic` in method `$jacocoInit`, but according to [JVMS](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.putstatic):\r\n\r\n>  if the field is final the instruction must occur in the \\<clinit\\> method of the current class. Otherwise, an IllegalAccessError is thrown.\r\n\r\nStarting with OpenJDK 9 EA b127 this condition is checked for class files with version `>=53` - http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/c558d46c1af2#l11.76 Unfortunately we compile classes into 52 even with JDK 9, because maven-shade-plugin can't handle 53, and that's why we don't get failure in core validation tests, but later in integration tests for Ant on one of JDK classes:\r\n```\r\nException in thread \"main\" java.lang.IllegalAccessError: Update to static final field java.sql.Timestamp.$jacocoData attempted from a different method (java.sql.Timestamp) than the initializer method <clinit> \r\n    at java.sql.Timestamp.$jacocoInit(java.sql@9-ea/Timestamp.java)\r\n    at java.sql.Timestamp.<clinit>(java.sql@9-ea/Timestamp.java)\r\n    at org.jacoco.ant.TestTarget.main(TestTarget.java:36)\r\n```\r\n\r\nThere is also a report in our mailing list - https://groups.google.com/d/msg/jacoco/jHw39ZUjUNY/L-gHeMeBBQAJ\r\n\r\nSee https://bugs.openjdk.java.net/browse/JDK-8157181 which is associated with this check and which also states:\r\n> Methods that do not satisfy condition violate the assumptions of the compilers. Compiling such methods results in different behavior of compiled and interpreted code.\r\n\r\nand which discusses removal of dependency on class file version.\r\n\r\nAlso might be that this check will be backported - see linked tickets, e.g. https://bugs.openjdk.java.net/browse/JDK-8161989\r\n\r\nSo that we should try to find a way to compile classes (or at least test targets) into bytecode version 53 ( #411 ).\r\n\r\nIn any case - field must not be `final`. But unfortunately this will make `FieldProbeArrayStrategy` unusable for interfaces with methods, because [JVMS](https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.5-200-A.3) states that\r\n\r\n> Fields of interfaces must have their ACC_PUBLIC, ACC_STATIC, and ACC_FINAL flags set"},"comment":{"url":"https://api.github.com/repos/jacoco/jacoco/issues/comments/239649591","html_url":"https://github.com/jacoco/jacoco/pull/434#issuecomment-239649591","issue_url":"https://api.github.com/repos/jacoco/jacoco/issues/434","id":239649591,"user":{"login":"Godin","id":138671,"avatar_url":"https://avatars.githubusercontent.com/u/138671?v=3","gravatar_id":"","url":"https://api.github.com/users/Godin","html_url":"https://github.com/Godin","followers_url":"https://api.github.com/users/Godin/followers","following_url":"https://api.github.com/users/Godin/following{/other_user}","gists_url":"https://api.github.com/users/Godin/gists{/gist_id}","starred_url":"https://api.github.com/users/Godin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Godin/subscriptions","organizations_url":"https://api.github.com/users/Godin/orgs","repos_url":"https://api.github.com/users/Godin/repos","events_url":"https://api.github.com/users/Godin/events{/privacy}","received_events_url":"https://api.github.com/users/Godin/received_events","type":"User","site_admin":false},"created_at":"2016-08-14T00:48:29Z","updated_at":"2016-08-14T00:48:29Z","body":"Reported as JI-9042842"}}
{"actor":{"display_login":"Godin"}}