{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":57242769,"defaultBranch":"main","name":"java.interop","ownerLogin":"jonpryor","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2016-04-27T19:46:07.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/155958?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1716496611.0","currentOid":""},"activityList":{"items":[{"before":null,"after":"f5b06d779190a3f073cb1d9056e82dd3895f468c","ref":"refs/heads/dev/jonp/jonp-codeql-2024-may-23","pushedAt":"2024-05-23T20:36:51.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[java-source-utils] Ignore CodeQL SM00697 java/path-injection-local\n\nFixes: https://codeql.microsoft.com/issues/5011e9f8-1b9e-4735-b9c5-89d78d9c04b2\nFixes: https://codeql.microsoft.com/issues/a9013ebf-d97c-41d8-aa62-92da7f8ea1c7\nFixes: https://codeql.microsoft.com/issues/b42d4728-2ce4-4599-b5cb-4d2affb86985\nFixes: https://codeql.microsoft.com/issues/bafce9a0-95ae-4aac-95e0-5ba8af1f3944\nFixes: https://codeql.microsoft.com/issues/bcc73986-161f-40b4-96a4-1c7e52959941\nFixes: https://codeql.microsoft.com/issues/dd199e97-a989-4f18-9fc7-a23a497eba32\nFixes: https://codeql.microsoft.com/issues/e844028d-77d8-4e04-9bfd-24005727ea84\n\nContext: 5fa7ac458ec225cf58396d015ebb9aa6a538062d\nContext: https://codeql.microsoft.com/issues/repository?Uri=https%3A%2F%2Fgithub.com%2Fxamarin%2Fjava.interop#\nContext: https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/codeql/codeql-semmle#guidance-on-suppressions\n\nCommit 5fa7ac45 \"addressed\" numerous LGTM warnings around\n\"path injection\".\n\nWe're now using CodeQL, and even though CodeQL *started as* LGTM, it\n(apparently) no longer supports the previous `// lgtm` comments.\nIt instead wants `// CodeQL` comments, updated to use an \"Opaque Id\".\n\nUpdate the comments to silence the CodeQL warnings.","shortMessageHtmlLink":"[java-source-utils] Ignore CodeQL SM00697 java/path-injection-local"}},{"before":null,"after":"e645a9603ce44f564e2545bcfa669176264c3e6e","ref":"refs/heads/jonp-build-with-net8","pushedAt":"2024-02-08T02:36:13.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[build] Target `net8.0`\n\nContext: https://github.com/xamarin/java.interop/pull/1153\n\n*Actually* building *and running* NativeAOT artifacts requires .NET 8.\n\nUpdate `$(DotNetTargetFramework)` so that .NET 8 is used.","shortMessageHtmlLink":"[build] Target net8.0"}},{"before":null,"after":"ba37b3771f4d80557a8413a09d4cee46ead69e6b","ref":"refs/heads/dev/jonp/jonp-ManagedPeer-il2057","pushedAt":"2023-12-02T03:36:51.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[Java.Interop-PerformanceTests] Add perf tests\n\nContext: https://github.com/xamarin/java.interop/pull/1168#discussion_r1408298059\n\nWhy arrays and not dictionaries, especially considering that\n7079166f2473d1ff2b41adc8d1bcd56cc8fed4ff involves an O(N\\*\\*2) lookup?\n\nFor two reasons:\n\n 1. the `JniPrimitiveArrayTypes` array is created for *all* apps,\n and thus contributes to app startup overheads for all apps.\n Thus, we want to minimize creation time.\n 2. the data is *small*: 8 entries within `JniPrimitiveArrayTypes`,\n each of which contains an array of 4 elements. *N* is *small*\n within O(N\\*\\*2).\n\nWhile this works for a gut feeling, time for some performance tests!\n\nUpdate `Java.Interop-PerformanceTests` to measure the timing overhead\nto create 1000000 instances of `JniPrimitiveArrayInfo[]` vs. the time\nto create 1000000 instances of `Dictionary`.\n\n\t% dotnet test --logger \"console;verbosity=detailed\" bin/TestDebug-net7.0/Java.Interop-PerformanceTests.dll\n\t…\n\t# CreationTiming: Array Creation: 403ms\n\t# CreationTiming: Dict Creation: 1483ms\n\t…\n\t# LookupTiming: Array Lookup: 97ms\n\t# LookupTiming: Dict Lookup: 173ms\n\nArray creation is pretty fast compared to a Dictionary, with\nArray creation taking 27% the time of Dictionaries.\n\nLookup is also pretty fast, verifying that when *N* is small,\nO(N\\*\\*2) isn't much to worry about; lookup takes half the time.\n\nNote that this is for a *Debug* build; Release builds should\nmake things better for Arrays.","shortMessageHtmlLink":"[Java.Interop-PerformanceTests] Add perf tests"}},{"before":null,"after":"24f9b0fd85df7e0bcbe622edc6a28477c5fc06f1","ref":"refs/heads/jonp-remove-jdk8-support","pushedAt":"2023-05-31T23:36:45.653Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[build] Remove support for JDK 8.\n\nContext: 7a32bb976ab41dca91f6cff59b8caea9d01ea53d\nContext: https://stackoverflow.com/questions/55853220/handling-change-in-newlines-by-xml-transformation-for-cdata-from-java-8-to-java\nContext: https://bugs.java.com/bugdatabase/view_bug?bug_id=8223291\n\n**Background**: Since commit bc5bcf4f, *two* JDKs were required in\norder to *fully* build and test Java.Interop: JDK 1.8 and JDK-11.\nThis is because `src/Java.Interop` requires JDK-11+ to build, while\nsome unit tests required JDK 1.8 to pass (because Java XML output\nchanged between JDK 1.8 and JDK-11; see also 7a32bb97).\n\nRecently, a question arose: how well does .NET Android work\nwith JDK 17? ([Android Studio recently bumped][0] the bundled JDK\nfrom JDK-11 to JDK-17.) The \"straightforward\" approach of\n\"provision JDK-17 and just build everything with JDK-17\" quickly\nmeant that Java.Interop needed to build under JDK-17.\n\nThis in turn segued into a \"how do I make the MSBuild property\nmeanings clearer\", as `$(JavaCPath)` would be for JDK 1.8, while\n`$(JavaC11Path)` was for JDK-11, but with JDK-17 being provisioned\n`$(JavaC11Path)` *actually* was for JDK-17, which is just confusing.\n\nAfter discussion, we decided that we don't need to continue using\nJDK 1.8 anymore. Android API-31 requires JDK-11 in order to use\nvarious Android SDK build tools, and the Google Play Store requires\na target SDK version of API-33 starting 2023-Aug. There is not much\npoint in maintaining JDK 1.8 support.\n\nJDK 11 or later is now required.\n\nUpdate to use Gradle 8.1.1. This is needed for later JDK-17 support.\n\n`java/util/Collection.java` existed to help test API documentation\nimport (when `$ANDROID_SDK_PATH` is set). JDK-11 does not support\ncompiling `java/util/Collection.java` anymore; it errors out with:\n\n\tjava/java/util/Collection.java:1: error: package exists in another module: java.base\n\tpackage java.util;\n\t^\n\n\"Rename\" this type to `android/animation/TypeEvaluator.java`, and\nupdate the API documentation import tests accordingly.\n\nUpdate the `ExpectedTypeDeclaration.MajorVersion` values to 0x37.\n\nThe `.class` files for nested types has seen the addition of a new\n`NestHost` constant; see also:\n\n * https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.7.28\n * https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-5.html#jvms-5.4.4\n\nUpdate `ExpectedTypeDeclaration.ConstantPoolCount` as appropriate.\n\nAdditional `NestHost`-related fallout is that `JavaType.class` now\nincludes `com/xamarin/JavaType$RNC$RPNC` in the `InnerClasses` table.\n\nUpdate `tools/java-source-utils` unit tests so that JDK-11 can now be\nused to run (and pass!) the unit tests. (This previously required\nJDK 1.8.)\n\n[0]: https://web.archive.org/web/20230507035529/https://developer.android.com/studio/releases/#jdk-17","shortMessageHtmlLink":"[build] Remove support for JDK 8."}},{"before":"6aedf1ca0baaeece6d2ef75deb19a077e8fc78f0","after":"72b041a542f2929828e84587b1c6c5b44be90f81","ref":"refs/heads/main","pushedAt":"2023-05-30T16:41:08.913Z","pushType":"push","commitsCount":10,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"Localized file check-in by OneLocBuild Task: Build definition ID 12262: Build ID 7838962 (#1111)\n\n* Localized file check-in by OneLocBuild Task: Build definition ID 12262: Build ID 7788766\r\n\r\n* Localized file check-in by OneLocBuild Task: Build definition ID 12262: Build ID 7801951\r\n\r\n* Localized file check-in by OneLocBuild Task: Build definition ID 12262: Build ID 7808296\r\n\r\n* Localized file check-in by OneLocBuild Task: Build definition ID 12262: Build ID 7838962","shortMessageHtmlLink":"Localized file check-in by OneLocBuild Task: Build definition ID 1226…"}},{"before":"4d69b727a916f7038774c0fa2875ddad42f68565","after":"cb29a4bd729722e5a9301d22785095ada225af2f","ref":"refs/heads/jonp-allow-jdk-17","pushedAt":"2023-05-13T00:13:00.399Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"Fix `make run-tests`\n\n`` was failing because `JI_JVM_PATH` was\nbeing set to an empty string.","shortMessageHtmlLink":"Fix make run-tests"}},{"before":"30c41f9eb03c914bbad286562e0f1c0b9b39edb6","after":"4d69b727a916f7038774c0fa2875ddad42f68565","ref":"refs/heads/jonp-allow-jdk-17","pushedAt":"2023-05-12T23:56:16.991Z","pushType":"push","commitsCount":1,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"Fix `make run-tests`\n\n`` was failing because `JI_JVM_PATH` was\nbeing set to an empty string.","shortMessageHtmlLink":"Fix make run-tests"}},{"before":"7de05e6f0c7de7de864f3e0749e70d78ff44de54","after":"30c41f9eb03c914bbad286562e0f1c0b9b39edb6","ref":"refs/heads/jonp-allow-jdk-17","pushedAt":"2023-05-12T23:47:02.755Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"set JAVA_HOME=$(Java8SdkDirectory)\n\nLooks like tools/java-source-utils tests still require JDK 1.8\nto pass on CI?","shortMessageHtmlLink":"set JAVA_HOME=$(Java8SdkDirectory)"}},{"before":"a2e2df52c72d9ec686ba8510dec753e5fe855a98","after":"7de05e6f0c7de7de864f3e0749e70d78ff44de54","ref":"refs/heads/jonp-allow-jdk-17","pushedAt":"2023-05-12T23:11:35.583Z","pushType":"push","commitsCount":1,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"set JAVA_HOME=$(Java11SdkDirectory)","shortMessageHtmlLink":"set JAVA_HOME=$(Java11SdkDirectory)"}},{"before":"d07d9f20f7bf643c971c99051dcf161a82f58309","after":"a2e2df52c72d9ec686ba8510dec753e5fe855a98","ref":"refs/heads/jonp-allow-jdk-17","pushedAt":"2023-05-12T23:05:47.875Z","pushType":"push","commitsCount":1,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"Fix jnimarshalmethodgen\n\nJdkInfo.props rename strikes again!","shortMessageHtmlLink":"Fix jnimarshalmethodgen"}},{"before":"5c4bfff712546bff7c82221d6795f1a0e29318c9","after":"d07d9f20f7bf643c971c99051dcf161a82f58309","ref":"refs/heads/jonp-allow-jdk-17","pushedAt":"2023-05-12T18:05:37.855Z","pushType":"push","commitsCount":1,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"JDK 17 requires a new gradle (?!)\n\nUse Gradle 8.1.1, fix `build.gradle` so it works with Gradle 8.1.1.","shortMessageHtmlLink":"JDK 17 requires a new gradle (?!)"}},{"before":"80b391dbf1bde6502b57cc57a3f60327bafb2667","after":"5c4bfff712546bff7c82221d6795f1a0e29318c9","ref":"refs/heads/jonp-allow-jdk-17","pushedAt":"2023-05-11T23:52:26.745Z","pushType":"push","commitsCount":1,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"Fix unit test failures\n\nUnit tests \"manually\" read the `JdkInfo*.props` files, and since\nthe file names and property names changed, things broke. Oops.","shortMessageHtmlLink":"Fix unit test failures"}},{"before":null,"after":"80b391dbf1bde6502b57cc57a3f60327bafb2667","ref":"refs/heads/jonp-allow-jdk-17","pushedAt":"2023-05-11T21:21:27.592Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"Support testing with JDK 17\n\nContext: https://github.com/xamarin/xamarin-android/pull/8029\n\nUpdate `` task to emit a new `$(Java*MajorVersion)`\nMSBuild property. This is used by `src/Java.Base` so that it knows\nwhich JDK version it's binding.\n\nBegin explicitly qualifying all `$(Jdk*)` and `$(Java*)` MSBuild\nproperties to explicitly disambiguate between JDK 1.8 and JDK-11\ncontexts. Eventually we may \"swap\" things so that properties without\na version are for e.g. JDK 11 (17, etc.) and `$(Jdk8*)` is for\nJDK 1.8-requiring contexts.\n\nNote: to get this to *build* we had to update `src/Java.Base` to\nsupport binding against JDK-17, which was an expected diversion.\nThis \"JDK-17 Java.Base binding\" was a \"time limited\" effort.","shortMessageHtmlLink":"Support testing with JDK 17"}},{"before":"554d8193f2d3413c5a2e43b0478db111d72e3d35","after":"6aedf1ca0baaeece6d2ef75deb19a077e8fc78f0","ref":"refs/heads/main","pushedAt":"2023-05-10T21:19:43.000Z","pushType":"push","commitsCount":8,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[Xamarin.Android.Tools.Bytecode] Ignore empty `bv` values. (#1107)\n\nFixes: https://github.com/xamarin/java.interop/issues/1106\r\n\r\nContext: https://github.com/devtodev-analytics/android-sdk-2.0/blob/ce131e63414d7e6e870c7276c67636fdcfbbd2eb/DTDAnalytics-android%202.3.3/DTDAnalytics-2.3.3.aar\r\n\r\nWe started seeing warnings when parsing newer Kotlin metadata\r\nannotations:\r\n\r\n\t% dotnet class-parse.dll classes.jar\r\n\tclass-parse: warning: Unable to parse Kotlin metadata on 'Utf8(\"com/devtodev/analytics/external/DTDLogLevel\")': System.FormatException: The input string '' was not in a correct format.\r\n\t at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, ReadOnlySpan`1 value, TypeCode type)\r\n\t at System.Int32.Parse(String s)\r\n\t at Xamarin.Android.Tools.Bytecode.KotlinMetadata.ParseInteger(String value) in …/xamarin/Java.Interop/src/Xamarin.Android.Tools.Bytecode/Kotlin/KotlinMetadata.cs:line 148\r\n\t at Xamarin.Android.Tools.Bytecode.KotlinMetadata.<>c.b__26_0(String v) in …/xamarin/Java.Interop/src/Xamarin.Android.Tools.Bytecode/Kotlin/KotlinMetadata.cs:line 122\r\n\t at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()\r\n\t at Xamarin.Android.Tools.Bytecode.KotlinMetadata.ParseVersion(Annotation annotation, String key) in …/xamarin/Java.Interop/src/Xamarin.Android.Tools.Bytecode/Kotlin/KotlinMetadata.cs:line 122\r\n\t at Xamarin.Android.Tools.Bytecode.KotlinMetadata.FromAnnotation(Annotation annotation) in …/xamarin/Java.Interop/src/Xamarin.Android.Tools.Bytecode/Kotlin/KotlinMetadata.cs:line 30\r\n\t at Xamarin.Android.Tools.Bytecode.KotlinFixups.Fixup(IList`1 classes) in …/xamarin/Java.Interop/src/Xamarin.Android.Tools.Bytecode/Kotlin/KotlinFixups.cs:line 23\r\n\r\nThis is because the `bv` entry is set to an empty byte array instead\r\nof an empty string, and we are trying to parse its contents as an\r\ninteger array: `bv: []`.\r\n\r\nLooking at the [Kotlin source][0], they [decided to deprecate][1] the\r\n`bv` value, and it may no longer be supplied:\r\n\r\n\t/**\r\n\t * The version of the bytecode interface (naming conventions, signatures) of the class file annotated with this annotation.\r\n\t */\r\n\t@Deprecated(\r\n\t \"Bytecode version had no significant use in Kotlin metadata and it will be removed in a future version.\",\r\n\t level = DeprecationLevel.WARNING,\r\n\t)\r\n\t@get:JvmName(\"bv\")\r\n\tval bytecodeVersion: IntArray = [1, 0, 3],\r\n\r\nWe will just silently ignore a missing `bv` value, since we do not\r\nconsume it.\r\n\r\n[0]: https://github.com/JetBrains/kotlin/blob/c6d9821ef0746bbbd4c93b7e9c4a2b2468824ce9/libraries/stdlib/jvm/runtime/kotlin/Metadata.kt#L34-L42\r\n[1]: https://youtrack.jetbrains.com/issue/KT-41758","shortMessageHtmlLink":"[Xamarin.Android.Tools.Bytecode] Ignore empty bv values. (xamarin#1107"}},{"before":"cd829ae49b738521bb20eacf62f40f521ee740ec","after":"ba8877e019c254b9940bd5950f6946ae8acb6a6f","ref":"refs/heads/jonp-class-parse-modules","pushedAt":"2023-04-21T16:45:46.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[class-parse] Use annotated-visibility\n\nContext: https://github.com/xamarin/java.interop/pull/1097#discussion_r1173002648\nContext: https://github.com/xamarin/java.interop/pull/1097#issuecomment-1516927676\nContext: b274a67f38e2f4012ab8414cba2c778f53f0b13c\n\nDuring code review, two questions came to light:\n\n 1. Will this cause API breakage in AndroidX/etc., because\n `module-info.class` will make types \"disappear\"?\n (See also b274a67f).\n\n 2. `class-parse` can accept *multiple* `.jar` files and `.class`\n files on the command-line. Should `module-info.class` processing\n apply to *everything*?\n\nAddress the first concern by keeping `//*/@visibility` as `public`,\nand instead if we think the type should be \"internal\" we instead add\nan `//*/@annotated-visibility` attribute value of `module-info`.\nIf there is *already* an `//*/@annotated-visibility` value, then we\n*append* ` module-info` to the attribute value.\n\nAddress the second concern by re-working `class-parse` command-line\nparsing. There is now a \"global `ClassPath`\", which will be used\nto hold `.class` files provided on the command-line. `.jar` and\n`.jmod` files provided on the command-line will be given their own\n`ClassPath` instances, and `module-info.class`-based visibility\nfixups are specific to each `ClassPath` instance. Global files are\nprocessed together. There is thus no way for `module-info.class`\nvisibility changes from `a.jar` to impact `b.jar`. After\nvisibilities are fixed up, we then merge everything into the \"global\"\n`ClassPath` instance before writing transforming to XML.\n\nAdditionally, `class-parse --dump` can now accept `.jar` files,\nand will dump out *all* `.class` filers within the `.jar` file.\nTo make this output easier, each \"entry\" starts with a \"header\" of\n`-- Begin {ClassFile.FullJniName}`, and a blank link will be printed\nbetween each entry.","shortMessageHtmlLink":"[class-parse] Use annotated-visibility"}},{"before":"b18bfdf9b32a1c16e87c9f65adf61f217ca779f5","after":"cd829ae49b738521bb20eacf62f40f521ee740ec","ref":"refs/heads/jonp-class-parse-modules","pushedAt":"2023-04-20T22:27:12.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[class-parse] Use annotated-visibility\n\nContext: https://github.com/xamarin/java.interop/pull/1097#discussion_r1173002648\nContext: https://github.com/xamarin/java.interop/pull/1097#issuecomment-1516927676\nContext: b274a67f38e2f4012ab8414cba2c778f53f0b13c\n\nDuring code review, two questions came to light:\n\n 1. Will this cause API breakage in AndroidX/etc., because\n `module-info.class` will make types \"disappear\"?\n (See also b274a67f).\n\n 2. `class-parse` can accept *multiple* `.jar` files and `.class`\n files on the command-line. Should `module-info.class` processing\n apply to *everything*?\n\nAddress the first concern by keeping `//*/@visibility` as `public`,\nand instead if we think the type should be \"internal\" we instead add\nan `//*/@annotated-visibility` attribute value of `module-info`.\nIf there is *already* an `//*/@annotated-visibility` value, then we\n*append* ` module-info` to the attribute value.\n\nAddress the second concern by re-working `class-parse` command-line\nparsing. There is now a \"global `ClassPath`\", which will be used\nto hold `.class` files provided on the command-line. `.jar` and\n`.jmod` files provided on the command-line will be given their own\n`ClassPath` instances, and `module-info.class`-based visibility\nfixups are specific to each `ClassPath` instance. Global files are\nprocessed together. There is thus no way for `module-info.class`\nvisibility changes from `a.jar` to impact `b.jar`. After\nvisibilities are fixed up, we then merge everything into the \"global\"\n`ClassPath` instance before writing transforming to XML.\n\nAdditionally, `class-parse --dump` can now accept `.jar` files,\nand will dump out *all* `.class` filers within the `.jar` file.\nTo make this output easier, each \"entry\" starts with a \"header\" of\n`-- Begin {ClassFile.FullJniName}`, and a blank link will be printed\nbetween each entry.","shortMessageHtmlLink":"[class-parse] Use annotated-visibility"}},{"before":"bf9200c0b8c9f5413a584d6320f6662d8f78f99d","after":"b18bfdf9b32a1c16e87c9f65adf61f217ca779f5","ref":"refs/heads/jonp-class-parse-modules","pushedAt":"2023-04-20T18:16:37.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[class-parse] support Module AttributeInfo\n\nFixes: https://github.com/xamarin/java.interop/issues/1096\n\nContext: https://stackoverflow.com/questions/57358750/module-info-class-file-is-different-in-the-module-jar-file-and-compiled-module-i\nContext: 678c4bd2c838141be0e18b23690da8dcdd94e0ec\n\nJDK 9 adds support for [modules][0], which are (kinda sorta) like\n.NET Assemblies: modules can depend upon other modules, export\npackages, etc.\n\nIn particular:\n\n> **exports and exports…to.** An exports module directive specifies\n> one of the module’s packages whose `public` types (and their nested\n> `public` and `protected` types) should be accessible to code in all\n> other modules.\n\nThis allows an equivalent to the [C# `internal` access modifier][1]:\n`public` types in a *non-`export`ed package* should be treated as\n\"internal\", while `public` types in an `export`ed package are\n\"fully public\".\n\nUpdate `Xamarin.Android.Tools.Bytecode.dll` to extract the module-\nrelated information, the update `XmlClassDeclarationBuilder` so that\nit updates all `public` types *outside* of the \"exported\" packages to\nhave a visibility of `kotlin-internal`.\n\nWhy a `//*/@visibility` value of `kotlin-internal`? From a\n[suggestion][2] for the commit message of 678c4bd2, which was sadly\noverlooked in the final merge:\n\n> Note: we introduce and use a new `//*/@visibility` value of\n> `kotlin-internal` because `internal` is an *existing* value that may\n> be used in `Metadata.xml` files, e.g. making `public` API `internal`\n> so that it can still be used in the binding, but isn't *public*.\n\nIf we use `internal`, *those types are still bound*, it's just that\nthe bound types have C# `internal` visibility, while we *want* them\nto be *skipped entirely*. A visibility value of `kotlin-internal`\nallows us to skip them, which is desired.\n\n`tests/Xamarin.Android.Tools.Bytecode-Tests` has been updated to:\n\n 1. Contain a `module-info.java`, which declares a `com.xamarin`\n module.\n\n 2. Add a new `com.xamarin.internal.PublicClassNotInModuleExports`\n type which is *not* in the `com.xamarin` package, but instead\n a *nested* package. The type is `public`.\n\n 3. Build a `xatb.jar` artifact\n\nThis makes for a simple one-off test:\n\n\t% dotnet build tests/Xamarin.Android.Tools.Bytecode-Tests/*.csproj\n\t% dotnet build tools/class-parse/*.csproj\n\t% dotnet bin/Debug-net7.0/class-parse.dll \\\n\t tests/Xamarin.Android.Tools.Bytecode-Tests/obj/Debug-net7.0/xatb.jar\n\t…\n\t \n\nNote that `com.xamarin.internal.PublicClassNotInModuleExports` is now\nshown as `kotlin-internal` instead of `public`.\n\nAside, a discovered oddity: `jar cf …` *modifies* `module-info.class`,\nadding a `ModulePackages` attribute! (Specifically, if you compare\nthe \"on-disk\" `module-info.class` to the one within\n`tests/Xamarin.Android.Tools.Bytecode-Tests/obj/$(Configuration)/xatb.jar`,\nthey differ in size!)\n\n[0]: https://www.oracle.com/corporate/features/understanding-java-9-modules.html\n[1]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/internal\n[2]: https://github.com/xamarin/java.interop/pull/793#issuecomment-777762450","shortMessageHtmlLink":"[class-parse] support Module AttributeInfo"}},{"before":"ecc04de00ccd4f647a510ac4044c8240d6153f46","after":"bf9200c0b8c9f5413a584d6320f6662d8f78f99d","ref":"refs/heads/jonp-class-parse-modules","pushedAt":"2023-04-20T15:52:07.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[class-parse] support Module AttributeInfo\n\nFixes: https://github.com/xamarin/java.interop/issues/1096\n\nContext: https://stackoverflow.com/questions/57358750/module-info-class-file-is-different-in-the-module-jar-file-and-compiled-module-i\nContext: 678c4bd2c838141be0e18b23690da8dcdd94e0ec\n\nJDK 9 adds support for [modules][0], which are (kinda sorta) like\n.NET Assemblies: modules can depend upon other modules, export\npackages, etc.\n\nIn particular:\n\n> **exports and exports…to.** An exports module directive specifies\n> one of the module’s packages whose `public` types (and their nested\n> `public` and `protected` types) should be accessible to code in all\n> other modules.\n\nThis allows an equivalent to the [C# `internal` access modifier][1]:\n`public` types in a *non-`export`ed package* should be treated as\n\"internal\", while `public` types in an `export`ed package are\n\"fully public\".\n\nUpdate `Xamarin.Android.Tools.Bytecode.dll` to extract the module-\nrelated information, the update `XmlClassDeclarationBuilder` so that\nit updates all `public` types *outside* of the \"exported\" packages to\nhave a visibility of `kotlin-internal`.\n\nWhy a `//*/@visibility` value of `kotlin-internal`? From a\n[suggestion][2] for the commit message of 678c4bd2, which was sadly\noverlooked in the final merge:\n\n> Note: we introduce and use a new `//*/@visibility` value of\n> `kotlin-internal` because `internal` is an *existing* value that may\n> be used in `Metadata.xml` files, e.g. making `public` API `internal`\n> so that it can still be used in the binding, but isn't *public*.\n\nIf we use `internal`, *those types are still bound*, it's just that\nthe bound types have C# `internal` visibility, while we *want* them\nto be *skipped entirely*. A visibility value of `kotlin-internal`\nallows us to skip them, which is desired.\n\n`tests/Xamarin.Android.Tools.Bytecode-Tests` has been updated to:\n\n 1. Contain a `module-info.java`, which declares a `com.xamarin`\n module.\n\n 2. Add a new `com.xamarin.internal.PublicClassNotInModuleExports`\n type which is *not* in the `com.xamarin` package, but instead\n a *nested* package. The type is `public`.\n\n 3. Build a `xatb.jar` artifact\n\nThis makes for a simple one-off test:\n\n\t% dotnet build tests/Xamarin.Android.Tools.Bytecode-Tests/*.csproj\n\t% dotnet build tools/class-parse/*.csproj\n\t% dotnet bin/Debug-net7.0/class-parse.dll \\\n\t tests/Xamarin.Android.Tools.Bytecode-Tests/obj/Debug-net7.0/xatb.jar\n\t…\n\t \n\nNote that `com.xamarin.internal.PublicClassNotInModuleExports` is now\nshown as `kotlin-internal` instead of `public`.\n\nAside, a discovered oddity: `jar cf …` *modifies* `module-info.class`,\nadding a `ModulePackages` attribute! (Specifically, if you compare\nthe \"on-disk\" `module-info.class` to the one within\n`tests/Xamarin.Android.Tools.Bytecode-Tests/obj/$(Configuration)/xatb.jar`,\nthey differ in size!)\n\n[0]: https://www.oracle.com/corporate/features/understanding-java-9-modules.html\n[1]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/internal\n[2]: https://github.com/xamarin/java.interop/pull/793#issuecomment-777762450","shortMessageHtmlLink":"[class-parse] support Module AttributeInfo"}},{"before":"705a17eaa4d8f073c54a45db0f8443812ad460f1","after":"ecc04de00ccd4f647a510ac4044c8240d6153f46","ref":"refs/heads/jonp-class-parse-modules","pushedAt":"2023-04-20T01:20:52.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[class-parse] support Module AttributeInfo\n\nFixes: https://github.com/xamarin/java.interop/issues/1096\n\nContext: https://stackoverflow.com/questions/57358750/module-info-class-file-is-different-in-the-module-jar-file-and-compiled-module-i\nContext: 678c4bd2c838141be0e18b23690da8dcdd94e0ec\n\nJDK 9 adds support for [modules][0], which are (kinda sorta) like\n.NET Assemblies: modules can depend upon other modules, export\npackages, etc.\n\nIn particular:\n\n> **exports and exports…to.** An exports module directive specifies\n> one of the module’s packages whose `public` types (and their nested\n> `public` and `protected` types) should be accessible to code in all\n> other modules.\n\nThis allows an equivalent to the [C# `internal` access modifier][1]:\n`public` types in a *non-`export`ed package* should be treated as\n\"internal\", while `public` types in an `export`ed package are\n\"fully public\".\n\nUpdate `Xamarin.Android.Tools.Bytecode.dll` to extract the module-\nrelated information, the update `XmlClassDeclarationBuilder` so that\nit updates all `public` types *outside* of the \"exported\" packages to\nhave a visibility of `kotlin-internal`.\n\nWhy an `//*/@visibility` value of `kotlin-internal`? From a\n[suggestion][2] for the commit message of 678c4bd2, which was sadly\noverlooked in the final draft:\n\n> Note: we introduce and use a new `//*/@visibility` value of\n> `kotline-internal` because `internal` is an *existing* value that may\n> be used in `Metadata.xml` files, e.g. making `public` API `internal`\n> so that it can still be used in the binding, but isn't *public*.\n\nIf we use `internal`, *those types are still bound*, it's just that\nthe bound types have C# `internal` visibility, while we *want* them\nto be *skipped entirely*. A visibility value of `kotlin-internal`\nallows us to skip them, which is desired.\n\n`tests/Xamarin.Android.Tools.Bytecode-Tests` has been updated to:\n\n 1. Contain a `module-info.java`, which declares a `com.xamarin`\n module.\n\n 2. Add a new `com.xamarin.internal.PublicClassNotInModuleExports`\n type which is *not* in the `com.xamarin` package, but instead\n a *nested* package. The type is `public`.\n\n 3. Build a `xatb.jar` artifact\n\nThis makes for a simple one-off test:\n\n\t% dotnet build tests/Xamarin.Android.Tools.Bytecode-Tests/*.csproj\n\t% dotnet build tools/class-parse/*.csproj\n\t% dotnet bin/Debug-net7.0/class-parse.dll \\\n\t tests/Xamarin.Android.Tools.Bytecode-Tests/obj/Debug-net7.0/xatb.jar\n\t…\n\t \n\nNote that `com.xamarin.internal.PublicClassNotInModuleExports` is now\nshown as `internal` instead of `public`.\n\nAside, a discovered oddity: `jar cf …` *modifies* `module-info.class`,\nadding a `ModulePackages` attribute! (Specifically, if you compare\nthe \"on-disk\" `module-info.class` to the one within\n`tests/Xamarin.Android.Tools.Bytecode-Tests/obj/$(Configuration)/xatb.jar`,\nthey differ in size!)\n\n[0]: https://www.oracle.com/corporate/features/understanding-java-9-modules.html\n[1]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/internal\n[2]: https://github.com/xamarin/java.interop/pull/793#issuecomment-777762450","shortMessageHtmlLink":"[class-parse] support Module AttributeInfo"}},{"before":null,"after":"705a17eaa4d8f073c54a45db0f8443812ad460f1","ref":"refs/heads/jonp-class-parse-modules","pushedAt":"2023-04-12T07:54:47.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[class-parse] support Module AttributeInfo\n\nFixes: https://github.com/xamarin/java.interop/issues/1096\n\nContext: https://stackoverflow.com/questions/57358750/module-info-class-file-is-different-in-the-module-jar-file-and-compiled-module-i\n\nJDK 9 adds support for [modules][0], which are (kinda sorta) like\n.NET Assemblies: modules can depend upon other modules, export\npackages, etc.\n\nIn particular:\n\n> **exports and exports…to.** An exports module directive specifies\n> one of the module’s packages whose `public` types (and their nested\n> `public` and `protected` types) should be accessible to code in all\n> other modules.\n\nThis allows an equivalent to the [C# `internal` access modifier][1]:\n`public` types in a *non-`export`ed package* should be treated as\n\"internal\", while `public` types in an `export`ed package are\n\"fully public\".\n\nUpdate `Xamarin.Android.Tools.Bytecode.dll` to extract the module-\nrelated information, the update `XmlClassDeclarationBuilder` so that\nit updates all `public` types *outside* of the \"exported\" packages to\nhave a visibility of `internal`.\n\n`tests/Xamarin.Android.Tools.Bytecode-Tests` has been updated to:\n\n 1. Contain a `module-info.java`, which declares a `com.xamarin`\n module.\n\n 2. Add a new `com.xamarin.internal.PublicClassNotInModuleExports`\n type which is *not* in the `com.xamarin` package, but instead\n a *nested* package. The type is `public`.\n\n 3. Build a `xatb.jar` artifact\n\nThis makes for a simple one-off test:\n\n\t% dotnet build tests/Xamarin.Android.Tools.Bytecode-Tests/*.csproj\n\t% dotnet build tools/class-parse/*.csproj\n\t% dotnet bin/Debug-net7.0/class-parse.dll \\\n\t tests/Xamarin.Android.Tools.Bytecode-Tests/obj/Debug-net7.0/xatb.jar\n\t…\n\t \n\nNote that `com.xamarin.internal.PublicClassNotInModuleExports` is now\nshown as `internal` instead of `public`.\n\nAside, a discovered oddity: `jar cf …` *modifies* `module-info.class`,\nadding a `ModulePackages` attribute! (Specifically, if you compare\nthe \"on-disk\" `module-info.class` to the one within\n`tests/Xamarin.Android.Tools.Bytecode-Tests/obj/$(Configuration)/xatb.jar`,\nthey differ in size!)\n\n[0]: https://www.oracle.com/corporate/features/understanding-java-9-modules.html\n[1]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/internal","shortMessageHtmlLink":"[class-parse] support Module AttributeInfo"}},{"before":"73ebad2496a0d6df251fd24e216248da70e3fea9","after":"554d8193f2d3413c5a2e43b0478db111d72e3d35","ref":"refs/heads/main","pushedAt":"2023-04-11T22:54:59.000Z","pushType":"push","commitsCount":7,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[ci] Automatically retry failed native unit test failures once (#1095)\n\nContext: https://github.com/xamarin/java.interop/issues/514\r\n\r\nThere is a known native crash that occasionally occurs when running\r\nunit tests on CI; see Issue #514:\r\n\r\n\t* Assertion: should not be reached at class-accessors.c:81\r\n\t \r\n\t \r\n\t =================================================================\r\n\t \tNative Crash Reporting\r\n\t =================================================================\r\n\t Got a SIGABRT while executing native code. This usually indicates\r\n\t a fatal error in the mono runtime or one of the native libraries \r\n\t used by your application.\r\n\t =================================================================\r\n\t \r\n\t =================================================================\r\n\t \tNative stacktrace:\r\n\t =================================================================\r\n\t \t0x102d2091b - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_dump_native_crash_info\r\n\t \t0x102cb97b5 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_handle_native_crash\r\n\t \t0x102d1fe71 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : sigabrt_signal_handler\r\n\t \t0x7fff79156b5d - /usr/lib/system/libsystem_platform.dylib : _sigtramp\r\n\t \t0x10a126f87 - Unknown\r\n\t \t0x7fff790106a6 - /usr/lib/system/libsystem_c.dylib : abort\r\n\t \t0x102f28837 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : monoeg_assert_abort\r\n\t \t0x102f09a9f - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_log_write_logfile\r\n\t \t0x102f28bbe - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : monoeg_g_logv_nofree\r\n\t \t0x102f28d3f - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : monoeg_assertion_message\r\n\t \t0x102db6ee5 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_class_get_flags\r\n\t \t0x102dac83b - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_class_setup_fields\r\n\t \t0x102dacdc1 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_class_init_internal\r\n\t \t0x102da7e7f - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_class_is_subclass_of_internal\r\n\t \t0x102e2e4f3 - /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono : mono_class_is_subclass_of\r\n\t \t0x106bf1348 - /Users/runner/runners/2.160.0/work/1/s/bin/TestDebug/libjava-interop.dylib : _ZL19get_gc_bridge_indexP19JavaInteropGCBridgeP10_MonoClass\r\n\t \t0x106bf0a4c - /Users/runner/runners/2.160.0/work/1/s/bin/TestDebug/libjava-interop.dylib : _ZL20gc_bridge_class_kindP10_MonoClass\r\n\t SIGQUIT: [libjvm.dylib+0x49bf1d], sa_mask[0]=11111111011111110111111111111111, sa_flags=SA_RESTART|SA_SIGINFO\r\n\t Start time: 2019-11-04 19:57:01Z\r\n\t End time: 2019-11-04 19:57:02Z\r\n\t Duration: 1.803 seconds\r\n\r\nThis crash doesn't happen \"in the wild\" so it is unlikely to get\r\nfixed anytime soon.\r\n\r\nAs a workaround for our CI, we will use AzDO's \r\n[`retryCountOnTaskFailure` parameter][0] to automatically re-run a\r\nnative test suite once if it fails. This should reduce the need for\r\nus to re-run failed pipelines for flaky tests.\r\n\r\nNote that AzDO's implementation isn't perfect; the task will succeed\r\nif there are no failures on retry, but the original failures will\r\nstill be listed in the log. 🤷‍♂️ \r\n\r\n[0]: https://learn.microsoft.com/en-us/azure/devops/release-notes/2021/pipelines/sprint-195-update#automatic-retries-for-a-task","shortMessageHtmlLink":"[ci] Automatically retry failed native unit test failures once (xamar…"}},{"before":null,"after":"0d5cddbb8e13950c8f0b47a532c7b31349fe07aa","ref":"refs/heads/jonp-ji-1090","pushedAt":"2023-03-30T19:57:59.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[Xamarin.Android.Tools.Bytecode] Ignore synthetic ctor params\n\nFixes: https://github.com/xamarin/java.interop/issues/1090\n\nAttempting to parse [TensorFlow 1.13.1][0] with a Debug build of\n`class-parse` results in an assertion failure:\n\n\t% curl -o tensorflow-android-1.13.1.aar https://repo1.maven.org/maven2/org/tensorflow/tensorflow-android/1.13.1/tensorflow-android-1.13.1.aar\n\t% unzip tensorflow-android-1.13.1.aar classes.jar\n\t% dotnet bin/Debug-net7.0/class-parse.dll classes.jar\n\tUnexpected number of method parameters; expected 0, got 1\n\t at Xamarin.Android.Tools.Bytecode.MethodInfo.UpdateParametersFromMethodParametersAttribute(ParameterInfo[] parameters)\n\t at Xamarin.Android.Tools.Bytecode.MethodInfo.GetParameters()\n\t at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.GetMethodParameters(MethodInfo method)+MoveNext()\n\t at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content)\n\t at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content)\n\t at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.GetMethod(String element, String name, MethodInfo method, String returns)\n\t at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.b__23_2(MethodInfo c)\n\nNote: this will only happen for Debug builds of `class-parse`, which\nwe do not ship. Thus, this will only happen if you are using a local\nbuild of xamarin/Java.Interop.\n\nThe assertion occurs when processing the constructor for\n`org/tensorflow/Session$Runner$Reference.class`, which is a non-static\ninner class:\n\n\t% unzip classes.jar 'org/tensorflow/Session$Runner$Reference.class'\n\t% dotnet bin/Debug-net7.0/class-parse.dll --dump 'org/tensorflow/Session$Runner$Reference.class'\n\t…\n\tMethods Count: 2\n\t\t0: (Lorg/tensorflow/Session$Runner;)V Public\n\t\t\tCode(60, Unknown[LineNumberTable](30), LocalVariableTableAttribute(LocalVariableTableEntry(Name='this', Descriptor='Lorg/tensorflow/Session$Runner$Reference;', StartPC=0, Index=0)), Xamarin.Android.Tools.Bytecode.StackMapTableAttribute)\n\t\t\tMethodParametersAttribute(MethodParameterInfo(Name='this$1', AccessFlags=Final, Synthetic))\n\nNote the `MethodParameterInfo.AccessFlags` value for the parameter:\n`AccessFlags=Final, Synthetic`. This differs from the\n`Final, Mandated` value that is checked for by\n`MethodInfo.UpdateParametersFromMethodParametersAttribute()`:\n\n\tvar OuterThis = MethodParameterAccessFlags.Final | MethodParameterAccessFlags.Mandated;\n\t// …\n\twhile (startIndex < pinfo.Count &&\n\t (pinfo [startIndex].AccessFlags & OuterThis) == OuterThis) {\n\t startIndex++;\n\t}\n\nBecause the parameter is `Final, Synthetic` and not `Final, Mandated`,\nthe parameter is *not* skipped, which results in the assertion message\n`expected 0, got 1`.\n\n@jonpryor does not know how or why `Final, Synthetic` is being used\nby `Session$Runner$Reference.class`, and is unable to reproduce this\nparticular Java bytecode output with the JDK 1.8 and JDK 11 compilers.\n\nUpdate `MethodInfo.UpdateParametersFromMethodParametersAttribute()`\nto also skip `Final, Synthetic` parameters. This allows\n`Session$Runner$Reference.class` to be processed without assertions:\n\n\t% dotnet bin/Debug-net7.0/class-parse.dll classes.jar\n\t# no errors\n\nAdditionally, update the assertion message so that it includes the\ndeclaring class name, method name, and method descriptor.\n\n[0]: https://mvnrepository.com/artifact/org.tensorflow/tensorflow-android/1.13.1","shortMessageHtmlLink":"[Xamarin.Android.Tools.Bytecode] Ignore synthetic ctor params"}},{"before":"054dd3a06a1a8bd54fcf9e27bb07dfc6a99931f6","after":"6138fa50ea555f7fd6b6769d9e54d65e3c5879fe","ref":"refs/heads/jonp-ctor-calls-partial-method","pushedAt":"2023-03-30T17:43:27.038Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[generator] Add support for peerConstructorPartialMethod\n\nContext: https://github.com/xamarin/java.interop/issues/1085\nContext: https://github.com/dotnet/runtime/pull/82121\n\nSome Java objects are *big*, e.g. [`Bitmap`][0] instances, but as\nfar as MonoVM is concerned, the `Bitmap` instances are *tiny*: a\nfew pointers, and that's it. MonoVM doesn't know that it could be\nreferencing several MB of data in the Java VM.\n\nMonoVM is gaining support for [`GC.AddMemoryPressure()`][1] and\n[`GC.RemoveMemoryPressure()`][2], which potentially allows for the\nparent of all cross-VM GC integrations: using the `GC` methods to\ninform MonoVM of how much non-managed memory has been allocated.\nThis could allow MonoVM to collect more frequently when total process\nmemory is low.\n\nHow should we call `GC.AddMemoryPressure()` and\n`GC.RemoveMemoryPressure()`?\n\n`GC.RemoveMemoryPressure()` is straightforward: a class can override\n`Java.Lang.Object.Dispose(bool)`.\n\n`GC.AddMemoryPressure()` is the problem: where and how can it be\ncalled from a class binding? This is trickier, as there was no way\nto have custom code called by the bound type. Instead, various\nforms of \"hacky workarounds\" are often employed, e.g. copying\n`generator`-emitted content into a `partial` class, then using\n`metadata` to *prevent* `generator` from binding those members.\nIt's all around fugly.\n\nFortunately C# has a solution: [`partial` methods][3]!\n\nAdd support for a `peerConstructorPartialMethod` metadata entry,\napplicable to `` elements, which contains the name of a\n`partial` method to both declare and invoke from the \"peer constructor\":\n\n\t_OnBitmapCreated\n\nThis will alter our existing \"peer constructor\" generation code, a'la:\n\n\tpartial class Bitmap : Java.Lang.Object {\n\t internal Bitmap (IntPtr h, JniHandleOwnership t) : base (h, t)\n\t {\n\t }\n\t}\n\nto instead become:\n\n\tpartial class Bitmap : Java.Lang.Object {\n\t partial void _OnBitmapCreated ();\n\t internal Bitmap (IntPtr h, JniHandleOwnership t) : base (h, t)\n\t {\n\t _OnBitmapCreated ();\n\t }\n\t}\n\nThis allows a hand-written `partial class Bitmap` to do:\n\n // Hand-written code\n partial class Bitmap {\n int _memoryPressure;\n\n partial void _OnBitmapCreated ()\n {\n _memoryPressure = ByteCount;\n GC.AddMemoryPressure (_memoryPressure);\n }\n\n protected override void Dispose (bool disposing)\n {\n if (_memoryPressure != 0) {\n GC.RemoveMemoryPressure (_memoryPressure);\n _memoryPressure = 0;\n }\n }\n }\n\nTODO: \"extend\" this for ``s as well?\n\n[0]: https://developer.android.com/reference/android/graphics/Bitmap\n[1]: https://learn.microsoft.com/dotnet/api/system.gc.addmemorypressure?view=net-7.0\n[2]: https://learn.microsoft.com/dotnet/api/system.gc.removememorypressure?view=net-7.0\n[3]: https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/partial-method","shortMessageHtmlLink":"[generator] Add support for peerConstructorPartialMethod"}},{"before":"148a553d6f93dc543241f4e5d12d97c4699a993f","after":"054dd3a06a1a8bd54fcf9e27bb07dfc6a99931f6","ref":"refs/heads/jonp-ctor-calls-partial-method","pushedAt":"2023-03-14T11:21:43.448Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[generator] Emit partial method for peer constructor\n\nContext: https://github.com/xamarin/java.interop/issues/1085\nContext: https://github.com/dotnet/runtime/pull/82121\n\nSome Java objects are *big*, e.g. [`Bitmap`][0] instances, but as\nfar as MonoVM is concerned, the `Bitmap` instances are *tiny*: a\nfew pointers, and that's it. MonoVM doesn't know that it could be\nreferencing several MB of data in the Java VM.\n\nMonoVM is gaining support for [`GC.AddMemoryPressure()`][1] and\n[`GC.RemoveMemoryPressure()`][2], which potentially allows for the\nparent of all cross-VM GC integrations: using the `GC` methods to\ninform MonoVM of how much non-managed memory has been allocated.\nThis could allow MonoVM to collect more frequently when total process\nmemory is low.\n\nHow should we call `GC.AddMemoryPressure()` and\n`GC.RemoveMemoryPressure()`?\n\n`GC.RemoveMemoryPressure()` is straightforward: a class can override\n`Java.Lang.Object.Dispose(bool)`.\n\n`GC.AddMemoryPressure()` is the problem: where and how can it be\ncalled from a class binding? This is trickier, as there was no way\nto have custom code called by the bound type. Instead, various\nforms of \"hacky workarounds\" are often employed, e.g. copying\n`generator`-emitted content into a `partial` class, then using\n`metadata` to *prevent* `generator` from binding those members.\nIt's all around fugly.\n\nFortunately C# has a solution: [`partial` methods][3]!\n\nWe take our existing \"peer constructor\" generation code, a'la:\n\n\tpartial class Bitmap : Java.Lang.Object {\n\t internal Bitmap (IntPtr h, JniHandleOwnership t) : base (h, t)\n\t {\n\t }\n\t}\n\nand extend it to:\n\n\tpartial class Bitmap : Java.Lang.Object {\n\t partial void _OnBitmapCreated ();\n\t internal Bitmap (IntPtr h, JniHandleOwnership t) : base (h, t)\n\t {\n\t _OnBitmapCreated ();\n\t }\n\t}\n\nThis allows a `partial class Bitmap` to do:\n\n\t// Hand-written code\n\tpartial class Bitmap {\n\t int _memoryPressure;\n\n\t partial void _OnBitmapCreated ()\n\t {\n\t _memoryPressure = ByteCount;\n\t GC.AddMemoryPressure (_memoryPressure);\n\t }\n\n\t protected override void Dispose (bool disposing)\n\t {\n\t if (_memoryPressure != 0) {\n\t GC.RemoveMemoryPressure (_memoryPressure);\n\t _memoryPressure = 0;\n\t\t}\n\t }\n\t}\n\nTODO: Are there any other places where such `partial` methods would\nbe useful? This appears to be the minimum required for this scenario.\n\n[0]: https://developer.android.com/reference/android/graphics/Bitmap\n[1]: https://learn.microsoft.com/dotnet/api/system.gc.addmemorypressure?view=net-7.0\n[2]: https://learn.microsoft.com/dotnet/api/system.gc.removememorypressure?view=net-7.0\n[3]: https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/partial-method","shortMessageHtmlLink":"[generator] Emit partial method for peer constructor"}},{"before":null,"after":"148a553d6f93dc543241f4e5d12d97c4699a993f","ref":"refs/heads/jonp-ctor-calls-partial-method","pushedAt":"2023-03-14T09:13:25.228Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[generator] Emit partial method for peer constructor\n\nContext: https://github.com/xamarin/java.interop/issues/1085\nContext: https://github.com/dotnet/runtime/pull/82121\n\nSome Java objects are *big*, e.g. [`Bitmap`][0] instances, but as\nfar as MonoVM is concerned, the `Bitmap` instances are *tiny*: a\nfew pointers, and that's it. MonoVM doesn't know that it could be\nreferencing several MB of data in the Java VM.\n\nMonoVM is gaining support for [`GC.AddMemoryPressure()`][1] and\n[`GC.RemoveMemoryPressure()`][2], which potentially allows for the\nparent of all cross-VM GC integrations: using the `GC` methods to\ninform MonoVM of how much non-managed memory has been allocated.\nThis could allow MonoVM to collect more frequently when total process\nmemory is low.\n\nHow should we call `GC.AddMemoryPressure()` and\n`GC.RemoveMemoryPressure()`?\n\n`GC.RemoveMemoryPressure()` is straightforward: a class can override\n`Java.Lang.Object.Dispose(bool)`.\n\n`GC.AddMemoryPressure()` is the problem: where and how can it be\ncalled from a class binding? This is trickier, as there was no way\nto have custom code called by the bound type. Instead, various\nforms of \"hacky workarounds\" are often employed, e.g. copying\n`generator`-emitted content into a `partial` class, then using\n`metadata` to *prevent* `generator` from binding those members.\nIt's all around fugly.\n\nFortunately C# has a solution: [`partial` methods][3]!\n\nWe take our existing \"peer constructor\" generation code, a'la:\n\n\tpartial class Bitmap : Java.Lang.Object {\n\t internal Bitmap (IntPtr h, JniHandleOwnership t) : base (h, t)\n\t {\n\t }\n\t}\n\nand extend it to:\n\n\tpartial class Bitmap : Java.Lang.Object {\n\t partial void _OnBitmapCreated ();\n\t internal Bitmap (IntPtr h, JniHandleOwnership t) : base (h, t)\n\t {\n\t _OnBitmapCreated ();\n\t }\n\t}\n\nThis allows a `partial class Bitmap` to do:\n\n\t// Hand-written code\n\tpartial class Bitmap {\n\t int _memoryPressure;\n\n\t partial void _OnBitmapCreated ()\n\t {\n\t _memoryPressure = ByteCount;\n\t GC.AddMemoryPressure (_memoryPressure);\n\t }\n\n\t protected override void Dispose (bool disposing)\n\t {\n\t if (_memoryPressure != 0) {\n\t GC.RemoveMemoryPressure (_memoryPressure);\n\t _memoryPressure = 0;\n\t\t}\n\t }\n\t}\n\nTODO: Are there any other places where such `partial` methods would\nbe useful? This appears to be the minimum required for this scenario.\n\n[0]: https://developer.android.com/reference/android/graphics/Bitmap\n[1]: https://learn.microsoft.com/dotnet/api/system.gc.addmemorypressure?view=net-7.0\n[2]: https://learn.microsoft.com/dotnet/api/system.gc.removememorypressure?view=net-7.0\n[3]: https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/partial-method","shortMessageHtmlLink":"[generator] Emit partial method for peer constructor"}},{"before":"e1ee4b1c3731295d80cfa7de418e0edd06ccd98a","after":"73ebad2496a0d6df251fd24e216248da70e3fea9","ref":"refs/heads/main","pushedAt":"2023-03-14T09:13:18.772Z","pushType":"push","commitsCount":33,"pusher":{"login":"jonpryor","name":"Jonathan Pryor","path":"/jonpryor","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/155958?s=80&v=4"},"commit":{"message":"[generator] Support Buffer.duplicate() binding in API-34 (#1086)\n\nContext: https://github.com/xamarin/xamarin-android/pull/7796\r\nContext: 22d5687bc5c572ea0eadbd1a23f02f424af782d1\r\nContext: 5a0e37e0d788cb9eeea2a44eb8b22d17b4cb5a8d\r\n\r\nImagine the following covariant-return-type -using construct, which\r\nis new in API-34 `android.jar`:\r\n\r\n\t// Java\r\n\tpublic abstract class Buffer {\r\n\t public abstract Buffer duplicate ();\r\n\t}\r\n\tpublic abstract class CharBuffer extends Buffer {\r\n\t public abstract CharBuffer duplicate ();\r\n\t}\r\n\r\nBy default this is bound as:\r\n\r\n\t// C#\r\n\t[Register(…)]\r\n\tpublic abstract partial class Buffer {\r\n\t [Register(…)]\r\n\t public abstract Buffer Duplicate ();\r\n\t}\r\n\t[Register(…)]\r\n\tpublic abstract partial class CharBuffer : Buffer {\r\n\t [Register(…)]\r\n\t public abstract CharBuffer Duplicate ();\r\n\t}\r\n\r\nAlas, this results in [error CS0533][0]:\r\n\r\n\terror CS0533: 'CharBuffer.Duplicate()' hides inherited abstract member 'Buffer.Duplicate()'\r\n\r\nC# supports this semantic if we use [`abstract override`][1], similar\r\nto [reabstraction of Default Interface Methods][2] in 22d5687b:\r\n\r\n\tpublic abstract class CharBuffer : Buffer {\r\n\t public override abstract CharBuffer Duplicate ();\r\n\t}\r\n\r\nTheoretically, we can tell `generator` how to fix this via the\r\n`//attr[@name='managedOverride']` metadata property (5a0e37e0):\r\n\r\n\toverride\r\n\r\nHowever, `//attr[@name='managedOverride']` was not written to support\r\nupdating`abstract` methods.\r\n\r\nFix that oversight so that using `//attr[@name='managedOverride']`\r\ncan be used to emit `override abstract`:\r\n\r\n\t[Register(…)]\r\n\tpublic abstract partial class CharBuffer : Buffer {\r\n\t [Register(…)]\r\n\t public override abstract CharBuffer Duplicate ();\r\n\t}\r\n\r\n~~ Method Invokers ~~\r\n\r\nThis gets us halfway there, but there is another issue: method invokers\r\nfor both the class and base class methods are *also* emitted into the\r\n`*Invoker` subclass:\r\n\r\n\tpartial class BufferInvoker : CharBuffer {\r\n\t public override sealed unsafe Buffer Duplicate() {…}\r\n\t // so far so good…\r\n\t}\r\n\tpartial class CharBufferInvoker : CharBuffer {\r\n\t [Register (\"duplicate\", \"()Ljava/nio/Buffer;\", \"\")]\r\n\t public override sealed unsafe Buffer Duplicate() {…}\r\n\r\n\t [Register (\"duplicate\", \"()Ljava/nio/CharBuffer;\", \"\")]\r\n\t public override sealed unsafe CharBuffer Duplicate() {…}\r\n\t // uh oh\r\n\t}\r\n\r\nThis results in the following error:\r\n\r\n\terror CS0111: Type 'CharBufferInvoker' already defines a member called 'Duplicate' with the same parameter types\r\n\terror CS0508: 'CharBufferInvoker.Duplicate()': return type must be 'CharBuffer' to match overridden member 'CharBuffer.Duplicate()'\r\n\r\nThis perhaps(?) could be something `generator` could detect and\r\nprevent, but the feasibility and cost is unknown and expected to be\r\nhigh. Since this is a very rare case, we will fix it with metadata,\r\nhowever we have never had metadata to apply to invokers before.\r\n\r\nWe have decided to support `//attr[@name='skipInvokerMethods']`\r\nmetadata on the `class` that the invoker class would be created for:\r\n\r\n\tjava/nio/Buffer.duplicate()Ljava/nio/Buffer;\r\n\r\nThe value is a comma, space, and newline-separated list of\r\n\"JNI signature-like\" values consisting of:\r\n\r\n 1. The simplified JNI name of the declaring class that contains the\r\n the invoker method to skip, e.g. `java/nio/Buffer`\r\n 2. `.`\r\n 3. The Java name of the invoker method to skip, e.g. `duplicate`.\r\n 4. The JNI method signature of the method to skip, e.g.\r\n `()Ljava/nio/Buffer;`\r\n\r\nThe above `java/nio/Buffer.duplicate()Ljava/nio/Buffer;` value tells\r\n`generator` to skip generating the `Buffer Buffer.duplicate ()` invoker\r\nmethod when generating the `CharBufferInvoker` type. Multiple invokers\r\nto skip can be specified as a comma or space separated list.\r\n\r\n[0]: https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0533\r\n[1]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/classes#1467-abstract-methods\r\n[2]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods#reabstraction","shortMessageHtmlLink":"[generator] Support Buffer.duplicate() binding in API-34 (xamarin#1086)"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAAEUm4HGQA","startCursor":null,"endCursor":null}},"title":"Activity · jonpryor/java.interop"}