Repository navigation
Remove API adjuster #11899
Copy link
Copy link
Closed
Labels
Area: BindingsIssues in Java Library Binding projects.Issues in Java Library Binding projects.java-interopIssues migrated from dotnet/java-interop / relates to the Java.Interop subtreeIssues migrated from dotnet/java-interop / relates to the Java.Interop subtreeneeds-triageIssues that need to be assigned.Issues that need to be assigned.possibly-staleIssues that are potentially no longer relevant.Issues that are potentially no longer relevant.
Description
Context: #5580
The current binding workflow with class-parse results in three api.xml files:
- The
class-parseoutput, inapi.xml.class-parse - The "adjusted" output, in
api.xml(viagenerator --only-xml-adjuster --xml-adjuster-output=api.xml) - The "fixed" output, after applying
Metadata.xmltoapi.xml, inapi.xml.fixed.
The problem is (2): it removes types present in (1).
Take for example #5580, in which the HttpRequest..serializer type is not bound.
The problem is that it's removed by (2):
Error while processing type '[Class] com.vmware.chameleon.http.HttpRequest..serializer': Type 'kotlinx.serialization.internal.GeneratedSerializer' was not found. (TaskId:36)
and thus is not present in api.xml. Consequently, you can't write Metadata.xml transforms which attempt to reference the type, as the type doesn't exist when Metadata.xml is being processed.
The only workaround here is to use <add-node/> with Metadata.xml, copying the XML fragment from api.xml.class-parse, a'la
<add-node path="//package[@name='com.vmware.chameleon.http']">
<class
abstract="false"
deprecated="deprecated"
jni-extends="Ljava/lang/Object;"
extends="java.lang.Object"
extends-generic-aware="java.lang.Object"
final="true"
name="HttpRequest..serializer"
jni-signature="Lcom/vmware/chameleon/http/HttpRequest$$serializer;"
source-file-name="HttpRequest.kt"
static="true"
visibility="public">
<implements
name="kotlinx.serialization.internal.GeneratedSerializer"
name-generic-aware="kotlinx.serialization.internal.GeneratedSerializer<com.vmware.chameleon.http.HttpRequest>"
jni-type="Lkotlinx/serialization/internal/GeneratedSerializer<Lcom/vmware/chameleon/http/HttpRequest;>;" />
<method
abstract="false"
deprecated="not deprecated"
final="false"
name="childSerializers"
native="false"
return="kotlinx.serialization.KSerializer<?>[]"
jni-return="[Lkotlinx/serialization/KSerializer<*>;"
static="false"
synchronized="false"
visibility="public"
bridge="false"
synthetic="false"
jni-signature="()[Lkotlinx/serialization/KSerializer;"
return-not-null="true" />
<method
abstract="false"
deprecated="not deprecated"
final="false"
name="deserialize"
native="false"
return="com.vmware.chameleon.http.HttpRequest"
jni-return="Lcom/vmware/chameleon/http/HttpRequest;"
static="false"
synchronized="false"
visibility="public"
bridge="false"
synthetic="false"
jni-signature="(Lkotlinx/serialization/Decoder;)Lcom/vmware/chameleon/http/HttpRequest;"
return-not-null="true">
<parameter
name="decoder"
type="kotlinx.serialization.Decoder"
jni-type="Lkotlinx/serialization/Decoder;"
not-null="true" />
</method>
<method
abstract="false"
deprecated="not deprecated"
final="false"
name="deserialize"
native="false"
return="java.lang.Object"
jni-return="Ljava/lang/Object;"
static="false"
synchronized="false"
visibility="public"
bridge="true"
synthetic="true"
jni-signature="(Lkotlinx/serialization/Decoder;)Ljava/lang/Object;">
<parameter
name="p0"
type="kotlinx.serialization.Decoder"
jni-type="Lkotlinx/serialization/Decoder;" />
</method>
<method
abstract="false"
deprecated="not deprecated"
final="false"
name="getDescriptor"
native="false"
return="kotlinx.serialization.SerialDescriptor"
jni-return="Lkotlinx/serialization/SerialDescriptor;"
static="false"
synchronized="false"
visibility="public"
bridge="false"
synthetic="false"
jni-signature="()Lkotlinx/serialization/SerialDescriptor;"
return-not-null="true" />
<method
abstract="false"
deprecated="not deprecated"
final="false"
name="patch"
native="false"
return="com.vmware.chameleon.http.HttpRequest"
jni-return="Lcom/vmware/chameleon/http/HttpRequest;"
static="false"
synchronized="false"
visibility="public"
bridge="false"
synthetic="false"
jni-signature="(Lkotlinx/serialization/Decoder;Lcom/vmware/chameleon/http/HttpRequest;)Lcom/vmware/chameleon/http/HttpRequest;"
return-not-null="true">
<parameter
name="this"
type="kotlinx.serialization.Decoder"
jni-type="Lkotlinx/serialization/Decoder;"
not-null="true" />
<parameter
name="decoder"
type="com.vmware.chameleon.http.HttpRequest"
jni-type="Lcom/vmware/chameleon/http/HttpRequest;"
not-null="true" />
</method>
<method
abstract="false"
deprecated="not deprecated"
final="false"
name="patch"
native="false"
return="java.lang.Object"
jni-return="Ljava/lang/Object;"
static="false"
synchronized="false"
visibility="public"
bridge="true"
synthetic="true"
jni-signature="(Lkotlinx/serialization/Decoder;Ljava/lang/Object;)Ljava/lang/Object;">
<parameter
name="p0"
type="kotlinx.serialization.Decoder"
jni-type="Lkotlinx/serialization/Decoder;" />
<parameter
name="p1"
type="java.lang.Object"
jni-type="Ljava/lang/Object;" />
</method>
<method
abstract="false"
deprecated="not deprecated"
final="false"
name="serialize"
native="false"
return="void"
jni-return="V"
static="false"
synchronized="false"
visibility="public"
bridge="false"
synthetic="false"
jni-signature="(Lkotlinx/serialization/Encoder;Lcom/vmware/chameleon/http/HttpRequest;)V">
<parameter
name="encoder"
type="kotlinx.serialization.Encoder"
jni-type="Lkotlinx/serialization/Encoder;"
not-null="true" />
<parameter
name="value"
type="com.vmware.chameleon.http.HttpRequest"
jni-type="Lcom/vmware/chameleon/http/HttpRequest;"
not-null="true" />
</method>
<method
abstract="false"
deprecated="not deprecated"
final="false"
name="serialize"
native="false"
return="void"
jni-return="V"
static="false"
synchronized="false"
visibility="public"
bridge="true"
synthetic="true"
jni-signature="(Lkotlinx/serialization/Encoder;Ljava/lang/Object;)V">
<parameter
name="p0"
type="kotlinx.serialization.Encoder"
jni-type="Lkotlinx/serialization/Encoder;" />
<parameter
name="p1"
type="java.lang.Object"
jni-type="Ljava/lang/Object;" />
</method>
<field
deprecated="not deprecated"
final="true"
name="INSTANCE"
static="true"
synthetic="false"
transient="false"
type="com.vmware.chameleon.http.HttpRequest..serializer"
type-generic-aware="com.vmware.chameleon.http.HttpRequest..serializer"
jni-signature="Lcom/vmware/chameleon/http/HttpRequest$$serializer;"
visibility="public"
volatile="false" />
</class>
</add-node>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: BindingsIssues in Java Library Binding projects.Issues in Java Library Binding projects.java-interopIssues migrated from dotnet/java-interop / relates to the Java.Interop subtreeIssues migrated from dotnet/java-interop / relates to the Java.Interop subtreeneeds-triageIssues that need to be assigned.Issues that need to be assigned.possibly-staleIssues that are potentially no longer relevant.Issues that are potentially no longer relevant.
Activity
jonpryor commentedon Feb 3, 2021
Note: in the case of #5580, the above
<add-node/>does not work, becausegeneratordoesn't like..in the name.If I manually replace all instances of
HttpRequest..serializerwithHttpRequest._serializer, aHttpRequest._serializerbinding is created. Unfortunately it's not valid, because the register attribute is wrong.Instead, I can add
managedNameinto the<add-node/>text, and then it works!Something I hadn't considered.
Regardless,
generatorshould do more than "silently fail" when a type name has..in it.jpobst commentedon Mar 11, 2021
I just happened to notice the
..issue ingenerator. Leaving a link here for future me:https://github.com/xamarin/java.interop/blob/main/tools/generator/Java.Interop.Tools.Generator.ObjectModel/GenBaseSupport.cs#L24-L27
akalghatgi commentedon Apr 20, 2021
@jpobst when is this planned... we are stuck with are release...
[generator] Separate metadata fixup step from parsing step. (#822)
[generator] Add Java.Interop.Tools.JavaTypeSystem (#849)
jpobst commentedon May 23, 2022
I'm not sure this really explains what the issue is, or what the desired fix is. Resolving all Java types and removing types and members that depend on types we cannot resolve is a needed step in the binding process, lest we create broken bindings.
I think we would need to explore:
For example, in this reported case:
Why is
GeneratedSerializernot found? Why do we still want to bindHttpRequest..serializerif it requires the missingGeneratedSerializer?dotnet-policy-service commentedon Jul 1, 2026
We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
dotnet-policy-service commentedon Jul 15, 2026
This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.