0

How the java de-compiler get to know the variable or object names?

I have a scenario, where I need to know the name of the object using which a method is called, so that some specific operations can be performed.

ashishakp
  • 111
  • 1
  • 8
  • Duplicate of: http://stackoverflow.com/questions/2237803/can-i-obtain-method-parameter-name-using-java-reflection – jAC Oct 24 '16 at 11:51

1 Answers1

2

You can't unless you read the debug information or your code is compiled with parameter names added in Java 8 (rarely is).

Usually the decompiler just makes up a name.

BTW Objects don't have names, only references have names known at compile time.

If you want to process the source which has these names, you can use a library to process the java source code.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130