java8 support present interface method parameter name need to add compile argument, not debug option
在 2019年1月17日星期四,Willem Jiang <willem.ji...@gmail.com> 写道: > Java compile will remove the parameters name by default. We faced the > same problem in CXF simple frontend. > The solution could be enable the debug option in the compiler or add > annotation to the parameters. > > If we decide to setting the option on the compiler, we should not only > throw exception in the runtime, but also document it. > > > Willem Jiang > > Twitter: willemjiang > Weibo: 姜宁willem > > On Thu, Jan 17, 2019 at 5:23 PM wjm wjm <zzz...@gmail.com> wrote: > > > > Scenes: > > 1.producer is springMVC dev mode > > class QueryWrapper { > > int x; > > int y; > > } > > void method(QueryWrapper querys, int p2); > > > > will produce swagger operation, have 3 parameters: x, y, p2 > > > > 2.consumer is POJO dev mode, declare a interface: > > interface TestIntf { > > void method(int x, int y, int p2); > > } > > until now, everything is ok. > > > > 3.producer upgrade > > class QueryWrapper { > > int x; > > int y; > > int z; > > } > > will produce swagger operation, have 4 parameters: x,y,z,p2 > > > > in this time, old POJO consumers will have problems: > > assign x to x, y to y, p2 to z > > that's because we map parameters by their index > > > > to resolve the problem: > > we need to map parameters by their name > > this require customers change their compile argument in pom.xml to > allow > > interface present method parameter name > > if did not add compile argument, SDK can throw exception, and print how > > to add the compile argument. > > > > any idea? >