An argument or local variable has no name, only a number.
I believe the command line argument for adding local variable names is -parameters
to enable access via reflection https://www.beyondjava.net/reading-java-8-method-parameter-named-reflection
It's the decompiler's job to determine/guess a variable name. I use Fernflower which does a reasonable job.
Input
import java.util.stream.Stream;
interface IFoo {
public abstract void hello(String what);
public static void print(String... args) {
Stream<String> stream = Stream.of(args);
stream.forEach(System.out::println);
}
}
output using Fernflower
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
import java.io.PrintStream;
import java.util.function.Consumer;
import java.util.stream.Stream;
interface IFoo {
void hello(String what);
static void print(String... args) {
Stream<String> stream = Stream.of(args);
PrintStream var10001 = System.out;
System.out.getClass();
stream.forEach(var10001::println);
}
}
NOTE: The System.out.getClass();
is generated by the javac
compiler to test for a null
value.