Eclipse下,选项Add variable attributes to generated class files (used by the debugger)的含义

在Eclipse-》preferences-》Java-》Compiler-》Classfile Generation下,选项Add variable attributes to generated class files (used by the debugger)的含有,顾名思义,就是说如果选择此选项,那么方法的参数变量名就不会写入编译生成的类文件中。相反,如果勾选了此选项,那么变量名就会写入类文件。参考下图:

Eclipse下,选项Add variable attributes to generated class files (used by the debugger)的含义

                                                                 Java源文件

Eclipse下,选项Add variable attributes to generated class files (used by the debugger)的含义

                                                                  未勾选后的类文件

Eclipse下,选项Add variable attributes to generated class files (used by the debugger)的含义

                                                                  勾选后的类文件

    如果不勾选此选项,在结合Spring框架时,会出现构造方法参数name匹配不上,可以通过添加注解@ConstructorProperties来解决。如下图:

Eclipse下,选项Add variable attributes to generated class files (used by the debugger)的含义

Eclipse下,选项Add variable attributes to generated class files (used by the debugger)的含义