{"action":"created","issue":{"url":"https://api.github.com/repos/orfjackal/retrolambda/issues/56","labels_url":"https://api.github.com/repos/orfjackal/retrolambda/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/orfjackal/retrolambda/issues/56/comments","events_url":"https://api.github.com/repos/orfjackal/retrolambda/issues/56/events","html_url":"https://github.com/orfjackal/retrolambda/issues/56","id":78026957,"number":56,"title":"Default methods are not correctly backported","user":{"login":"PietroDev","id":8865009,"avatar_url":"https://avatars.githubusercontent.com/u/8865009?v=3","gravatar_id":"","url":"https://api.github.com/users/PietroDev","html_url":"https://github.com/PietroDev","followers_url":"https://api.github.com/users/PietroDev/followers","following_url":"https://api.github.com/users/PietroDev/following{/other_user}","gists_url":"https://api.github.com/users/PietroDev/gists{/gist_id}","starred_url":"https://api.github.com/users/PietroDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PietroDev/subscriptions","organizations_url":"https://api.github.com/users/PietroDev/orgs","repos_url":"https://api.github.com/users/PietroDev/repos","events_url":"https://api.github.com/users/PietroDev/events{/privacy}","received_events_url":"https://api.github.com/users/PietroDev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-19T10:19:51Z","updated_at":"2015-05-19T10:29:04Z","closed_at":null,"body":"As stated in the guide:\r\n> Default methods are backported by copying the default methods to a companion class (interface name + \"$\") as static methods, replacing the default methods in the interface with abstract methods, and by adding the necessary method implementations to all classes which implement that interface.\r\n\r\nIf I have this interface:\r\n```java\r\npublic interface TestI {\r\n  default void test() {}\r\n}\r\n```\r\n\r\nand this class:\r\n```java\r\npublic class TestC implements TestI {}\r\n```\r\n\r\nas far as I understand the output of retrolambda will be:\r\n\r\n1. An interface with an abstract method test\r\n2. A new class with a static method (empty in the example)\r\n3. The class TestC with the implemented test method\r\n\r\nSo, If then I have a new class:\r\n```java\r\npublic class Test2 {\r\n  static {\r\n   new TestC().test();\r\n  }\r\n}\r\n```\r\n\r\nThis should work. Am I right?\r\n\r\nI'm asking this because it doesn't.\r\n> Test2.java:3: error: cannot find symbol\r\n    new TestC().test();\r\n               ^\r\n  symbol:   method test()\r\n  location: class TestC\r\n\r\nIf I decompile I found:\r\n```java\r\npublic abstract interface TestI {\r\n  public abstract void test();\r\n}\r\npublic class TestI$ {\r\n  public static void test(TestI paramTestI) {}\r\n}\r\n```\r\n\r\nand:\r\n```java\r\npublic class TestC  implements TestI {}\r\n```\r\nI don't think the last one is right. I'm doing something wrong or I didn't understand the section:\r\n> by adding the necessary method implementations to all classes which implement that interface.\r\n\r\nIf I use javap I obtain\r\n```java\r\npublic class TestC implements TestI {\r\n  public TestC();\r\n  public void test();\r\n}\r\n```\r\nSo the method is there but as the decompiler cannot find it neither javac does.\r\n\r\nI tried both using compatibility with bytecode 50 and 51 using the latest version.\r\n>java -Dretrolambda.defaultMethods=true -Dretrolambda.bytecodeVersion=50 -Dretrolambda.inputDir=. -Dretrolambda.classpath=. -jar retrolambda.jar\r\n\r\nYou can reproduce it by using the same source code\r\n\r\nOf course it would be nice if my TestC has all the implementation so that I can use it in other java7 project."},"comment":{"url":"https://api.github.com/repos/orfjackal/retrolambda/issues/comments/103430685","html_url":"https://github.com/orfjackal/retrolambda/issues/56#issuecomment-103430685","issue_url":"https://api.github.com/repos/orfjackal/retrolambda/issues/56","id":103430685,"user":{"login":"PietroDev","id":8865009,"avatar_url":"https://avatars.githubusercontent.com/u/8865009?v=3","gravatar_id":"","url":"https://api.github.com/users/PietroDev","html_url":"https://github.com/PietroDev","followers_url":"https://api.github.com/users/PietroDev/followers","following_url":"https://api.github.com/users/PietroDev/following{/other_user}","gists_url":"https://api.github.com/users/PietroDev/gists{/gist_id}","starred_url":"https://api.github.com/users/PietroDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PietroDev/subscriptions","organizations_url":"https://api.github.com/users/PietroDev/orgs","repos_url":"https://api.github.com/users/PietroDev/repos","events_url":"https://api.github.com/users/PietroDev/events{/privacy}","received_events_url":"https://api.github.com/users/PietroDev/received_events","type":"User","site_admin":false},"created_at":"2015-05-19T10:29:04Z","updated_at":"2015-05-19T10:29:04Z","body":"If it can help, I can add the following:\r\nUsing IntelliJ as IDE, when I type \"new TestC().\" it autocomplete with test() method, it found it. So if I type \"new TestC().test()\" it doesn't throw any error.\r\nBut when I then compile (maven or ant) it will throw the same error as above."}}