Skip to content

Conversation

@jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Aug 14, 2019

Context: #466

While looking at class-parse --dump output for various
Kotlin-compiled .class files, providing support for the
EnclosingMethod and SourceFile annotation blobs looks to be
useful.

Add support for parsing the EnclosingMethod and SourceFile
annotations.

Update the generated XML so that the SourceFile annotation is
avaialble from the //class/@source-file-name or
//interface/@source-file-name attributes.

Update the generated XML so that the EnclosingMethod annotation is
available from these new attributes on //class or //interface:

  • enclosing-method-jni-type: The JNI signature of the type
    declaring the enclosing method.

  • enclosing-method-name: The name of the enclosing method.

  • enclosing-method-signature: The JNI signature of the enclosing
    method.

For example, if TestType.action() had an anonymous inner class:

    class TestType {
      public void action (Object value) {
        Runnable r = new Runnable () {
          public void run() {
            System.out.println ("foo");
          }
        };
      }
    }

This could result in the creation of a new TestType$1 class for the
anonymous inner class, with the resulting enclosing-* attributes:

    enclosing-method-jni-type="Lcom/xamarin/JavaType;"
    enclosing-method-name="action"
    enclosing-method-signature="(Ljava/lang/Object;)V"

@jonpryor jonpryor force-pushed the jonp-enclosingmethod-annotation branch from c892d17 to 5e3be2f Compare August 14, 2019 18:13
Context: dotnet#466

While looking at `class-parse --dump` output for various
Kotlin-compiled `.class` files, providing support for the
`EnclosingMethod` and `SourceFile` annotation blobs looks to be
useful.

Add support for parsing the `EnclosingMethod` and `SourceFile`
annotations.

Update the generated XML so that the `SourceFile` annotation is
avaialble from the `//class/@source-file-name` or
`//interface/@source-file-name` attributes.

Update the generated XML so that the `EnclosingMethod` annotation is
available from these new attributes on `//class` or `//interface`:

  * `enclosing-method-jni-type`: The JNI signature of the type
    declaring the enclosing method.

  * `enclosing-method-name`: The name of the enclosing method.

  * `enclosing-method-signature`: The JNI signature of the enclosing
    method.

For example, if `TestType.action()` had an anonymous inner class:

	class TestType {
	  public void action (Object value) {
	    Runnable r = new Runnable () {
	      public void run() {
	        System.out.println ("foo");
	      }
	    };
	  }
	}

This could result in the creation of a new `TestType$1` class for the
anonymous inner class, with the resulting `enclosing-*` attributes:

	enclosing-method-jni-type="Lcom/xamarin/JavaType;"
	enclosing-method-name="action"
	enclosing-method-signature="(Ljava/lang/Object;)V"
@jonpryor jonpryor force-pushed the jonp-enclosingmethod-annotation branch from 5e3be2f to 0dbc003 Compare August 15, 2019 15:02
@jonpryor
Copy link
Contributor Author

It helps if I commit & push my entire local patch...

@jonpryor jonpryor merged commit a30523e into dotnet:master Aug 15, 2019
@jonpryor jonpryor deleted the jonp-enclosingmethod-annotation branch August 15, 2019 15:15
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant