{"action":"created","issue":{"url":"https://api.github.com/repos/mapstruct/mapstruct/issues/631","labels_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/631/labels{/name}","comments_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/631/comments","events_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/631/events","html_url":"https://github.com/mapstruct/mapstruct/issues/631","id":102022259,"number":631,"title":"NullPointerException when using generics in mapper interface","user":{"login":"gunnarmorling","id":28612,"avatar_url":"https://avatars.githubusercontent.com/u/28612?v=3","gravatar_id":"","url":"https://api.github.com/users/gunnarmorling","html_url":"https://github.com/gunnarmorling","followers_url":"https://api.github.com/users/gunnarmorling/followers","following_url":"https://api.github.com/users/gunnarmorling/following{/other_user}","gists_url":"https://api.github.com/users/gunnarmorling/gists{/gist_id}","starred_url":"https://api.github.com/users/gunnarmorling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunnarmorling/subscriptions","organizations_url":"https://api.github.com/users/gunnarmorling/orgs","repos_url":"https://api.github.com/users/gunnarmorling/repos","events_url":"https://api.github.com/users/gunnarmorling/events{/privacy}","received_events_url":"https://api.github.com/users/gunnarmorling/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-19T23:25:21Z","updated_at":"2015-08-23T21:12:44Z","closed_at":null,"body":"From [SO](http://stackoverflow.com/questions/32096886/mapstruct-mapping-of-generics):\r\n\r\n    @Mapper\r\n    public interface MyMapper<X extends Base_1, Y extends Base_2>{\r\n        public X mapBase_2ToBase_1(Y obj);\r\n    }\r\n\r\nThis causes the following NPE:\r\n\r\n    java.lang.NullPointerException\r\n    at org.mapstruct.ap.util.SpecificCompilerWorkarounds.replaceTypeElementIfNecessary(SpecificCompilerWorkarounds.java:90)\r\n    at org.mapstruct.ap.util.Executables.getAllEnclosedExecutableElements(Executables.java:189)\r\n    at org.mapstruct.ap.model.common.Type.getAllExecutables(Type.java:395)\r\n    at org.mapstruct.ap.model.common.Type.getSetters(Type.java:464)\r\n    at org.mapstruct.ap.model.common.Type.getPropertyWriteAccessors(Type.java:353)\r\n    at org.mapstruct.ap.model.BeanMappingMethod$Builder.souceMethod(BeanMappingMethod.java:93)\r\n    at org.mapstruct.ap.processor.MapperCreationProcessor.getMappingMethods(MapperCreationProcessor.java:345)\r\n    at org.mapstruct.ap.processor.MapperCreationProcessor.getMapper(MapperCreationProcessor.java:143)\r\n    at org.mapstruct.ap.processor.MapperCreationProcessor.process(MapperCreationProcessor.java:114)\r\n    at org.mapstruct.ap.processor.MapperCreationProcessor.process(MapperCreationProcessor.java:73)\r\n    at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:193)\r\n    at org.mapstruct.ap.MappingProcessor.processMapperTypeElement(MappingProcessor.java:173)\r\n    at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:154)"},"comment":{"url":"https://api.github.com/repos/mapstruct/mapstruct/issues/comments/133938580","html_url":"https://github.com/mapstruct/mapstruct/issues/631#issuecomment-133938580","issue_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/631","id":133938580,"user":{"login":"sjaakd","id":6173283,"avatar_url":"https://avatars.githubusercontent.com/u/6173283?v=3","gravatar_id":"","url":"https://api.github.com/users/sjaakd","html_url":"https://github.com/sjaakd","followers_url":"https://api.github.com/users/sjaakd/followers","following_url":"https://api.github.com/users/sjaakd/following{/other_user}","gists_url":"https://api.github.com/users/sjaakd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjaakd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjaakd/subscriptions","organizations_url":"https://api.github.com/users/sjaakd/orgs","repos_url":"https://api.github.com/users/sjaakd/repos","events_url":"https://api.github.com/users/sjaakd/events{/privacy}","received_events_url":"https://api.github.com/users/sjaakd/received_events","type":"User","site_admin":false},"created_at":"2015-08-23T21:12:44Z","updated_at":"2015-08-23T21:12:44Z","body":"@gunnarmorling , I'll have a more thorough look. I'll guess if we want to support this, we'll have to act on the type bound iso the type itself (which besides being a type var, can also be an upper / lower bound of a wild card type. The generated code will look something like this:\r\n\r\n```java\r\npackage org.mapstruct.ap.test.bugs._631;\r\n\r\nimport javax.annotation.Generated;\r\n\r\n@Generated(\r\n    value = \"org.mapstruct.ap.MappingProcessor\",\r\n    date = \"2015-08-23T22:58:51+0200\",\r\n    comments = \"version: , compiler: javac, environment: Java 1.8.0_05 (Oracle Corporation)\"\r\n)\r\npublic class SourceTargetMapperImpl implements SourceTargetMapper  {\r\n\r\n    @Override\r\n    public Base_1 mapBase_2ToBase_1(Base_2 obj) {\r\n        if ( obj == null ) {\r\n            return null;\r\n        }\r\n\r\n        Base_1 x = new Base_1();\r\n\r\n        return x;\r\n    }\r\n}\r\n```\r\n\r\nWDYT?"}}