Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generator] Use + for nested types, not / #1302

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static CallableWrapperMethod CreateMethod (MethodDefinition methodDefinition, Ca
static CallableWrapperMethod CreateMethod (string name, CallableWrapperType declaringType, string? signature, string? connector, string? managedParameters, string? outerType, string? superCall)
{
signature = signature ?? throw new ArgumentNullException ("`connector` cannot be null.", nameof (connector));
var method_name = "n_" + name + ":" + signature + ":" + connector;
var method_name = "n_" + name + ":" + signature + ":" + connector?.Replace ('/', '+');

var method = new CallableWrapperMethod (declaringType, name, method_name, signature);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static string ToCliTypePart (string part)
for (int i = 0; i < parts.Length; ++i) {
parts [i] = ToPascalCase (parts [i], 1);
}
return string.Join ("/", parts);
return string.Join ("+", parts);
}

static string ToPascalCase (string value, int minLength)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public partial interface IParent : IJavaObject, IJavaPeerable {
}

// Metadata.xml XPath interface reference: path="/api/package[@name='com.xamarin.android']/interface[@name='Parent.Child']"
[Register ("com/xamarin/android/Parent$Child", "", "Com.Xamarin.Android.IParent/IChildInvoker")]
[Register ("com/xamarin/android/Parent$Child", "", "Com.Xamarin.Android.IParent+IChildInvoker")]
public partial interface IChild : IJavaObject, IJavaPeerable {
int Bar {
// Metadata.xml XPath method reference: path="/api/package[@name='com.xamarin.android']/interface[@name='Parent.Child']/method[@name='getBar' and count(parameter)=0]"
[Register ("getBar", "()I", "GetGetBarHandler:Com.Xamarin.Android.IParent/IChildInvoker, MyAssembly")]
[Register ("getBar", "()I", "GetGetBarHandler:Com.Xamarin.Android.IParent+IChildInvoker, MyAssembly")]
get;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public partial interface IParent : IJavaObject, IJavaPeerable {
public partial interface IChild : IJavaObject, IJavaPeerable {
int Bar {
// Metadata.xml XPath method reference: path="/api/package[@name='com.xamarin.android']/interface[@name='Parent.Child']/method[@name='getBar' and count(parameter)=0]"
[Register ("getBar", "()I", "GetGetBarHandler:Com.Xamarin.Android.IParent/IChildInvoker, MyAssembly")]
[Register ("getBar", "()I", "GetGetBarHandler:Com.Xamarin.Android.IParent+IChildInvoker, MyAssembly")]
get;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public void GenerateProperNestedInterfaceSignatures ()

var generated = writer.ToString ();

Assert.True (generated.Contains ("GetOnActivityDestroyed_IHandler:Com.Xamarin.Android.Application/IActivityLifecycleInterface, MyAssembly"));
Assert.True (generated.Contains ("GetOnActivityDestroyed_IHandler:Com.Xamarin.Android.Application+IActivityLifecycleInterface, MyAssembly"));
Assert.False (generated.Contains ("GetOnActivityDestroyed_IHandler:Com.Xamarin.Android.Application.IActivityLifecycleInterface, MyAssembly"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class PublicClass : global::Java.Lang.Object {
[Register ("xamarin/test/PublicClass$ProtectedInterface", "", "Xamarin.Test.PublicClass/IProtectedInterfaceInvoker")]
protected internal partial interface IProtectedInterface : IJavaObject, IJavaPeerable {
// Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='PublicClass.ProtectedInterface']/method[@name='foo' and count(parameter)=0]"
[Register ("foo", "()V", "GetFooHandler:Xamarin.Test.PublicClass/IProtectedInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
[Register ("foo", "()V", "GetFooHandler:Xamarin.Test.PublicClass+IProtectedInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
void Foo ();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class View : global::Java.Lang.Object {
[Register ("android/view/View$OnClickListener", "", "Android.Views.View/IOnClickListenerInvoker")]
public partial interface IOnClickListener : IJavaObject, IJavaPeerable {
// Metadata.xml XPath method reference: path="/api/package[@name='android.view']/interface[@name='View.OnClickListener']/method[@name='onClick' and count(parameter)=1 and parameter[1][@type='android.view.View']]"
[Register ("onClick", "(Landroid/view/View;)V", "GetOnClick_Landroid_view_View_Handler:Android.Views.View/IOnClickListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
[Register ("onClick", "(Landroid/view/View;)V", "GetOnClick_Landroid_view_View_Handler:Android.Views.View+IOnClickListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
void OnClick (global::Android.Views.View v);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract partial class Action : global::Java.Lang.Object {
[Register ("xamarin/test/NotificationCompatBase$Action$Factory", "", "Xamarin.Test.NotificationCompatBase/Action/IFactoryInvoker")]
public partial interface IFactory : IJavaObject, IJavaPeerable {
// Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='NotificationCompatBase.Action.Factory']/method[@name='build' and count(parameter)=1 and parameter[1][@type='int']]"
[Register ("build", "(I)Lxamarin/test/NotificationCompatBase$Action;", "GetBuild_IHandler:Xamarin.Test.NotificationCompatBase/Action/IFactoryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
[Register ("build", "(I)Lxamarin/test/NotificationCompatBase$Action;", "GetBuild_IHandler:Xamarin.Test.NotificationCompatBase+Action+IFactoryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
global::Xamarin.Test.NotificationCompatBase.Action Build (int p0);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ IEnumerable<GenBase> Ancestors ()
public string AnnotatedVisibility => support.AnnotatedVisibility;

// not: not currently assembly qualified, but it uses needed
// Type.GetType() conventions such as '/' for nested types.
// Type.GetType() conventions such as '+' for nested types.
public string AssemblyQualifiedName => string.IsNullOrWhiteSpace (Namespace)
? $"{FullName.Replace ('.', '/')}"
: $"{Namespace}." + $"{FullName.Substring (Namespace.Length + 1).Replace ('.', '/')}";
? $"{FullName.Replace ('.', '+')}"
: $"{Namespace}." + $"{FullName.Substring (Namespace.Length + 1).Replace ('.', '+')}";

public int ApiAvailableSince { get; set; }

Expand Down
Loading