Remove the "val$" prefix from all object fields. The "val$" prefix is used for auto-generated variables, and users should be able to see/use them without the "val$" prefix.
Remove the "val$" prefix from all object fields. The "val$" prefix is used for auto-generated variables, and users should be able to see/use them without the "val$" prefix.

The most important use-case for this change is as follows:

  void OuterMethod() {
    String foo;
    new InnerClass() {
      @Override
      String getFoo () {
        return foo;  // SET BREAKPOINT HERE
      };
   }

In Java 8, "foo" gets captured as "InnerClass.this->val$foo". Therefore, the UI shows it as "this.val$foo". Further, the user has to type "val$foo" to use it in an expression.
With this CL, the "val$" prefix is removed.

In Java 7, there is no "this.val$foo" variable. Therefore, users cannot see the "foo" variable or use it in expressions at all. This CL does not fix this Java-7 problem.

Note that there are two other interesting cases that this CL also supports:

  1. If the variable is re-defined in the inner method scope:
    void OuterMethod() {
      String foo;
      new InnerClass() {
        @Override
        String getFoo () {
          String savedOuterFoo = foo;
          String foo = "redefinedInnerFoo";
          return foo + savedOuterFoo;  // SET BREAKPOINT HERE
        };
     }

    In this case, the user can access inner local variable using expression="foo", and the outer local variable using expression="this.foo".

  2. If the variable is re-defined in the inner class scope:
    void OuterMethod() {
      String foo;
      new InnerClass() {
        String foo = "redefinedFieldFoo";
        @Override
        String getFoo () {
          return foo + savedOuterFoo;  // SET BREAKPOINT HERE
        };
     }

    In this case, the outer local variable is not accessible (and won't be captured anyways) from inside the inner class. Nothing to do.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149115787

GoogleCloudPlatform/cloud-debug-java,GoogleCloudPlatform/cloud-debug-java,GoogleCloudPlatform/cloud-debug-java,GoogleCloudPlatform/cloud-debug-java