例1:

class Outer {
	public void md1(final int a) {
		final int b = 1;
		class LocalA {
			int c = a;
		}
		class LocalB extends LocalA {
			LocalB() {
				super();
			}
		}
	}
}

解语法糖后的形式如下:

class Outer {
    public void md1(final int a) {
        final int b = 1;
    }
}
class Outer$1LocalA {
	/* synthetic */ final Outer this$0;
	/* synthetic */ final int val$a;

	Outer$1LocalA(/* synthetic */ final Outer this$0,
			      /* synthetic */ final int val$a) {
		this.this$0 = this$0;
		this.val$a = val$a;
		super();
	}

	int c = val$a;
}
class Outer$1LocalB extends Outer$1LocalA {
    /*synthetic*/ final Outer this$0;
    /*synthetic*/ final int val$a;

    Outer$1LocalB(/*synthetic*/ final Outer this$0,
    		      /*synthetic*/ final int val$a) {
        this.this$0 = this$0;
        this.val$a = val$a;
        super(this$0, val$a);
    }
}

例2:

class Outer {
	public void md1(final int a,final int b) {
		class LocalA {
			int c = b;

			class LocalB {
				int d = a;
			}
		}
	}
} 

解语法糖后如下:

class Outer {
	public void md1(final int a, final int b) {}
}
class Outer$1LocalA {
	/* synthetic */ final Outer this$0;
	/* synthetic */ final int val$a;
	/* synthetic */ final int val$b;

	Outer$1LocalA(/* synthetic */ final Outer this$0,
			      /* synthetic */ final int val$b,
			      /* synthetic */ final int val$a) {
		this.this$0 = this$0;
		this.val$b = val$b;
		this.val$a = val$a;
		super();
	}

	int c = val$b;
}
class Outer$1LocalA$LocalB {
	/* synthetic */ final Outer$1LocalA this$1;

	Outer$1LocalA$LocalB(/* synthetic */ final Outer$1LocalA this$1) {
		this.this$1 = this$1;
		super();
	}

	int d = this$1.val$a;
}

  

例3:

class Outer {
	public void md1(final int a) {
		class LocalA {
			int x1 = a;
		}

		class LocalB {
           Object x2 = new LocalA();
		}
	}
}

解语法糖后如下:  

class Outer {
    public void md1(final int a) {    }
}
class Outer$1LocalA {
    /*synthetic*/ final Outer this$0;
    /*synthetic*/ final int val$a;

    Outer$1LocalA(/*synthetic*/ final Outer this$0,
    		      /*synthetic*/ final int val$a) {
        this.this$0 = this$0;
        this.val$a = val$a;
        super();
    }
    int x1 = val$a;
}
class Outer$1LocalB {
    /*synthetic*/ final Outer this$0;
    /*synthetic*/ final int val$a;

    Outer$1LocalB(/*synthetic*/ final Outer this$0,
    		      /*synthetic*/ final int val$a) {
        this.this$0 = this$0;
        this.val$a = val$a;
        super();
    }
    Object x2 = new Outer$1LocalA(this$0, val$a);
}

 

例4:

class Test {
    public void md1(final int a) {
		class Outer {
			class Inner {
				int c = a;
			}

		}
        class LocalC  extends Outer.Inner{
        	LocalC(Outer a){
        		a.super();
        	}
        }
    }
}

解语法糖如下:

class Test$1Outer$Inner {
    /*synthetic*/ final Test$1Outer this$1;

    Test$1Outer$Inner(/*synthetic*/ final Test$1Outer this$1) {
        this.this$1 = this$1;
        super();
    }
    int c = this$1.val$a;
},
class Test$1Outer {
    /*synthetic*/ final Test this$0;
    /*synthetic*/ final int val$a;

    Test$1Outer(/*synthetic*/ final Test this$0, /*synthetic*/ final int val$a) {
        this.this$0 = this$0;
        this.val$a = val$a;
        super();
    }
},
class Test$1LocalC extends Test$1Outer$Inner {
    /*synthetic*/ final Test this$0;

    Test$1LocalC(/*synthetic*/ final Test this$0, Test$1Outer a) {
        this.this$0 = this$0;
        super(a<*nullchk*>);
    }
},
class Test {
    public void md1(final int a) {   }
}

  

 

例5:

class Outer {
	public void md(final int a) {
		class AOuter {
			class BOuter {
				// final Outer this$0 合成的变量
				class COuter {
					// final Outer$AOuter this$1 合成的变量
					int b = a;
				}
			}
		}
	}
}

解语法糖后如下:

class Outer {
    public void md(final int a) { }
}
class Outer$1AOuter {
    /*synthetic*/ final Outer this$0;
    /*synthetic*/ final int val$a;

    Outer$1AOuter(/*synthetic*/ final Outer this$0,
    		      /*synthetic*/ final int val$a) {
        this.this$0 = this$0;
        this.val$a = val$a;
        super();
    }
}
class Outer$1AOuter$BOuter {
    /*synthetic*/ final Outer$1AOuter this$1;

    Outer$1AOuter$BOuter(/*synthetic*/ final Outer$1AOuter this$1) {
        this.this$1 = this$1;
        super();
    }
}
class Outer$1AOuter$BOuter$COuter {
    /*synthetic*/ final Outer$1AOuter$BOuter this$2;

    Outer$1AOuter$BOuter$COuter(/*synthetic*/ final Outer$1AOuter$BOuter this$2) {
        this.this$2 = this$2;
        super();
    }
    int b = this$2.this$1.val$a;
}

例6:

 

  

05-11 17:39