{"action":"created","issue":{"url":"https://api.github.com/repos/jhalterman/modelmapper/issues/162","repository_url":"https://api.github.com/repos/jhalterman/modelmapper","labels_url":"https://api.github.com/repos/jhalterman/modelmapper/issues/162/labels{/name}","comments_url":"https://api.github.com/repos/jhalterman/modelmapper/issues/162/comments","events_url":"https://api.github.com/repos/jhalterman/modelmapper/issues/162/events","html_url":"https://github.com/jhalterman/modelmapper/issues/162","id":107018877,"number":162,"title":"Exception thrown when trying to add mapping when classes are compiled with jdk8 named parameters","user":{"login":"knes1","id":5746086,"avatar_url":"https://avatars.githubusercontent.com/u/5746086?v=3","gravatar_id":"","url":"https://api.github.com/users/knes1","html_url":"https://github.com/knes1","followers_url":"https://api.github.com/users/knes1/followers","following_url":"https://api.github.com/users/knes1/following{/other_user}","gists_url":"https://api.github.com/users/knes1/gists{/gist_id}","starred_url":"https://api.github.com/users/knes1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knes1/subscriptions","organizations_url":"https://api.github.com/users/knes1/orgs","repos_url":"https://api.github.com/users/knes1/repos","events_url":"https://api.github.com/users/knes1/events{/privacy}","received_events_url":"https://api.github.com/users/knes1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2015-09-17T16:07:38Z","updated_at":"2016-07-25T15:28:11Z","closed_at":null,"body":"ModelMapper seems to be throwing exceptions when trying to register mappings when following conditions are satisfied:\r\n- Classes are compiled with jdk8 named parameters support (-parameters argument to javac)\r\n- Destination class implements an interface (such as Comparable)\r\n\r\nHere's a test case that fails when compiled with -parameters option:\r\n```\r\npublic class ModelMapperTest {\r\n\r\n\t@Test\r\n\tpublic void testModelMapper() {\r\n\t\tModelMapper modelMapper = new ModelMapper();\r\n\t\tmodelMapper.addMappings(new TestDTOMapping());\r\n\t\tModel model = new Model();\r\n\t\tmodelMapper.map(new ModelDto(\"test\"), model);\r\n\t\tAssert.assertEquals(\"test\", model.getTest());\r\n\t}\r\n\r\n\tpublic static class Model implements Comparable<Model> {\r\n\t\tprivate String test;\r\n\r\n\t\tpublic String getTest() {\r\n\t\t\treturn test;\r\n\t\t}\r\n\r\n\t\tpublic void setTest(String test) {\r\n\t\t\tthis.test = test;\r\n\t\t}\r\n\r\n\t\t@Override\r\n\t\tpublic int compareTo(Model o) {\r\n\t\t\treturn test.compareTo(o.test);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static class ModelDto {\r\n\t\tprivate String testDTO;\r\n\r\n\t\tpublic ModelDto(String testDTO) {\r\n\t\t\tthis.testDTO = testDTO;\r\n\t\t}\r\n\r\n\t\tpublic String getTestDTO() {\r\n\t\t\treturn testDTO;\r\n\t\t}\r\n\r\n\t\tpublic void setTestDTO(String testDTO) {\r\n\t\t\tthis.testDTO = testDTO;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic static class TestDTOMapping extends PropertyMap<ModelDto, Model> {\r\n\r\n\t\t@Override\r\n\t\tprotected void configure() {\r\n\t\t\tmap(source.getTestDTO(), destination.getTest());\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nYou can clone test case from here: https://github.com/knes1/modelmapper-test\r\n(after cloning the repo just run `mvn clean test` - project is configured to be compiled with named parameters support)\r\n\r\nWhen running this testcase I receive following error:\r\n```\r\norg.modelmapper.ConfigurationException: ModelMapper configuration errors:\r\n\r\n1) Failed to generate proxy class for io.github.knes1.modelmappertest.ModelMapperTest$Model. Ensure that io.github.knes1.modelmappertest.ModelMapperTest$Model has a non-private constructor.\r\nCaused by: java.lang.RuntimeException\r\n\tat org.modelmapper.internal.asm.MethodVisitor.visitParameter(Unknown Source)\r\n\tat org.modelmapper.internal.asm.ClassReader.b(Unknown Source)\r\n\tat org.modelmapper.internal.asm.ClassReader.accept(Unknown Source)\r\n\tat org.modelmapper.internal.asm.ClassReader.accept(Unknown Source)\r\n\tat org.modelmapper.internal.cglib.proxy.BridgeMethodResolver.resolveAll(BridgeMethodResolver.java:61)\r\n\tat org.modelmapper.internal.cglib.proxy.Enhancer.emitMethods(Enhancer.java:911)\r\n\tat org.modelmapper.internal.cglib.proxy.Enhancer.generateClass(Enhancer.java:498)\r\n\tat org.modelmapper.internal.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)\r\n\tat org.modelmapper.internal.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)\r\n\tat org.modelmapper.internal.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)\r\n\tat org.modelmapper.internal.cglib.proxy.Enhancer.createClass(Enhancer.java:317)\r\n\tat org.modelmapper.internal.ProxyFactory.proxyClassFor(ProxyFactory.java:68)\r\n\tat org.modelmapper.internal.ProxyFactory.proxyFor(ProxyFactory.java:83)\r\n\tat org.modelmapper.internal.ExplicitMappingBuilder.createProxy(ExplicitMappingBuilder.java:294)\r\n\tat org.modelmapper.internal.ExplicitMappingBuilder.createProxies(ExplicitMappingBuilder.java:248)\r\n\tat org.modelmapper.internal.ExplicitMappingBuilder.visitPropertyMap(ExplicitMappingBuilder.java:230)\r\n\tat org.modelmapper.PropertyMap.configure(PropertyMap.java:380)\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:497)\r\n\tat org.modelmapper.internal.ExplicitMappingBuilder.build(ExplicitMappingBuilder.java:195)\r\n\tat org.modelmapper.internal.TypeMapImpl.addMappings(TypeMapImpl.java:72)\r\n\tat org.modelmapper.internal.TypeMapStore.getOrCreate(TypeMapStore.java:101)\r\n\tat org.modelmapper.ModelMapper.addMappings(ModelMapper.java:93)\r\n\tat io.github.knes1.modelmappertest.ModelMapperTest.testModelMapper(ModelMapperTest.java:17)\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:497)\r\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n\tat org.junit.runner.JUnitCore.run(JUnitCore.java:137)\r\n\tat com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)\r\n\tat com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)\r\n\tat com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)\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:497)\r\n\tat com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)\r\n\r\n2) Failed to configure mappings\r\nCaused by: org.modelmapper.internal.ErrorsException\r\n\tat org.modelmapper.internal.Errors.toException(Errors.java:254)\r\n\tat org.modelmapper.internal.ProxyFactory.proxyClassFor(ProxyFactory.java:70)\r\n\tat org.modelmapper.internal.ProxyFactory.proxyFor(ProxyFactory.java:83)\r\n\tat org.modelmapper.internal.ExplicitMappingBuilder.createProxy(ExplicitMappingBuilder.java:294)\r\n\tat org.modelmapper.internal.ExplicitMappingBuilder.createProxies(ExplicitMappingBuilder.java:248)\r\n\tat org.modelmapper.internal.ExplicitMappingBuilder.visitPropertyMap(ExplicitMappingBuilder.java:230)\r\n\tat org.modelmapper.PropertyMap.configure(PropertyMap.java:380)\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:497)\r\n\tat org.modelmapper.internal.ExplicitMappingBuilder.build(ExplicitMappingBuilder.java:195)\r\n\tat org.modelmapper.internal.TypeMapImpl.addMappings(TypeMapImpl.java:72)\r\n\tat org.modelmapper.internal.TypeMapStore.getOrCreate(TypeMapStore.java:101)\r\n\tat org.modelmapper.ModelMapper.addMappings(ModelMapper.java:93)\r\n\tat io.github.knes1.modelmappertest.ModelMapperTest.testModelMapper(ModelMapperTest.java:17)\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:497)\r\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n\tat org.junit.runner.JUnitCore.run(JUnitCore.java:137)\r\n\tat com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)\r\n\tat com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)\r\n\tat com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)\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:497)\r\n\tat com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)\r\n\r\n2 errors\r\n```"},"comment":{"url":"https://api.github.com/repos/jhalterman/modelmapper/issues/comments/234987898","html_url":"https://github.com/jhalterman/modelmapper/issues/162#issuecomment-234987898","issue_url":"https://api.github.com/repos/jhalterman/modelmapper/issues/162","id":234987898,"user":{"login":"jhalterman","id":228804,"avatar_url":"https://avatars.githubusercontent.com/u/228804?v=3","gravatar_id":"","url":"https://api.github.com/users/jhalterman","html_url":"https://github.com/jhalterman","followers_url":"https://api.github.com/users/jhalterman/followers","following_url":"https://api.github.com/users/jhalterman/following{/other_user}","gists_url":"https://api.github.com/users/jhalterman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhalterman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhalterman/subscriptions","organizations_url":"https://api.github.com/users/jhalterman/orgs","repos_url":"https://api.github.com/users/jhalterman/repos","events_url":"https://api.github.com/users/jhalterman/events{/privacy}","received_events_url":"https://api.github.com/users/jhalterman/received_events","type":"User","site_admin":false},"created_at":"2016-07-25T15:28:11Z","updated_at":"2016-07-25T15:28:11Z","body":"Just pushed 5933cf1215d5ac35cdce6ec83edf3787140ebde7 which should fix this. @meetyg are you able to try out the latest in master?"}}
{"actor":{"display_login":"jhalterman"}}