C-namespace section in spring reference document

I am reading the spring doc and I could not understand below from the c-namespace section in the reference doc

In rare cases where constructor argument names are not available (usually if bytecode was compiled without debug information), you can use rollback for argument indices

My questions:

  • When a constructor argument is not available.
  • Which means the -byte code is compiled without debugging information. Can this be verified with eclipse?

I tested this over the internet but could get any link. I found an installation of a constructor using the c: namespace , but didn't explain anything

+3


source to share


2 answers


Constructor argument names are available only if the class is compiled with variable debug information. When used, javac

this is a parameter -g:vars

. In Eclipse, this is Windows > Preferences > Java > Compiler > Add variable attributes to generated class files

.



+2


source


If the class in question was compiled javac

without a flag -g

("debug info" - see javac docs ), then the compiled class bytecode will not contain the names of the constructor parameters. This means that Spring cannot use reflection according to the names of the constructor parameters, so you need to type them by position (i.e. by index).

It is a build environment that generates compiled bytecode to deliver debug information. Once the code is compiled, there is nothing you can do to extract this information without recompiling it.



See also What does javac's -g: vars debug option do?

+2


source







All Articles