javadebuggingintellij-ideareactive-programmingsodium

What does dollar sign mean in generated variable names during debugging Java in InteliJ IDEA ? Is it a closure?


What does dollar sign mean in variable names during debugging Java in InteliJ ? Is it a closure ? Please see the image and code snippet below.

Here is part of the Stream class:

public final Listener listen(final Handler<A> action) {
    return listen_(Node.NULL, new TransactionHandler<A>() {
        public void run(Transaction trans2, A a) {
            action.run(a);
        }
    });
}

I suspect that the $1 in Stream$1@915 refers to the closure created in the method above. I am not sure though. Can someone confirm this ? Or if that is not the case, explain what the dollar sign means in this generated name ?

The code is taken from the Sodium Functional Reactive library which I am trying understand how it works.

enter image description here


Solution

  • It's a reference to the anonymous inner class thats generated by this closure like construct. In general, inner classes are compiled and the class file name will be yourClassName$yourInnerClassName. In the case of an anonymous inner class declaration, since you don't name it explicitly, it will appear as a generated name using numbers. Perhaps this article will help?