Recently, i was maintaining a long last web project that uses an old version of our web framework (open-source on github now as the name of Argo).
I wrote the following Action, and annotated with @Path with a parameter id.
When browsing url storm/delete/1, it should bind the parameter Integer id with the value 1 in url, but it was not happen. I debugged, and find the parameter id is still null.
I digged into the source code, and find the part to bind the url parameter with Action parameter.
It loop through Action parameters, and tries to find the parameter value in url.
The paramNames array is evaluate by paramNames = getMethodParamNames()
I set a debug point in getMethodParamNames, and finally found it fails because the parameNames is not correctly evaluated.
(left-up corner: the Action, right-up corner: getMethodParamNames() function)
The paramNames array here is {"this"}, which should be {"id"}. I watches some expression, and found the attr.variableNames array is infact {"e", "this", "id", ... }
I did some search on google, and found a tool jclasslib to browse LocalVariableAttribute of a .class file.
This explains why it failed, as there is another local variable e which appear before every other local variables.
It seems the LocalVariableTable is not orderred by appearence, and I verrified the guessing by javadoc.
If LocalVariableTable attributes are present in the attributes table of a given Code attribute, then they may appear in any order.
The getMethodParamNames implementation assumes the LocalVariableTable is orderred, which of course fails if the compiled .class is not orgnized in this way.