views:

224

answers:

2

I'm trying to slightly extend an undocumented class in a third-party framework we're using. I decompiled the .class file with jd-gui and see an inner class defined like this:

private class DeactivateAction extends AbstractAction {
 public DeactivateAction() {
  super("Deactivate");
 }

 public void actionPerformed(ActionEvent paramActionEvent) {
  if (MyContainingType.this.someBoolean) {
   MyContainingType.access$102(MyContainingType.this, false);
   MyContainingType.this.add(MyContainingType.this.interceptor);
  }
 }
}

I am not sure how to interpret the "access$102" line here. MyContainingType extends javax.swing.JLayeredPane. This doesn't compile for me, so how can I interpret this and convert it correctly in my extended class?

+5  A: 

That is a synthetic accessor.

Even inner classes don't really have access to their enclosing class's private members. The compiler "synthesizes" default (package) access methods to allow inner classes to work with private fields of the enclosing class.

You should be able to look at the enclosing class to figure out what access$102 is doing.

The javap tool, with the -c option can be very useful too.

erickson
A: 

AFAIK jd-gui is still improving on inner classes. Until version 0.2.9 I wasn't able to decompile inner classes at all. Now it works much better and I'm really lokking forward to the next releases!

'access$102' looks like a placeholder for a static method to me. You should be able to find something in MyContainingType that has a similiar signature.

Andreas_D