From 1e4330edcfd657938635b37ed8fdef37ed20e0bf Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Sat, 17 Jun 2017 00:49:02 +0900 Subject: [PATCH] [generator] do not emit static properties as instance. Without this, abstract classes that implement java.time.chrono.Chronology fail to bind because they will try to implement those static properties as instance (this check had been done for methods, but not for properties). --- tools/generator/InterfaceGen.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/generator/InterfaceGen.cs b/tools/generator/InterfaceGen.cs index 87e5d40a6..bcac79d8e 100644 --- a/tools/generator/InterfaceGen.cs +++ b/tools/generator/InterfaceGen.cs @@ -214,7 +214,7 @@ void GenExtensionMethods (StreamWriter sw, string indent, CodeGenerationOptions void GenProperties (StreamWriter sw, string indent, CodeGenerationOptions opt) { - foreach (Property prop in Properties) + foreach (Property prop in Properties.Where (p => !p.Getter.IsStatic)) prop.GenerateDeclaration (sw, indent, opt, this, AssemblyQualifiedName + "Invoker"); } @@ -256,14 +256,14 @@ void GenerateInvoker (StreamWriter sw, string indent, CodeGenerationOptions opt) sw.WriteLine (); HashSet members = new HashSet (); - GenerateInvoker (sw, Properties, indent + "\t", opt, members); - GenerateInvoker (sw, Methods, indent + "\t", opt, members); + GenerateInvoker (sw, Properties.Where (p => !p.Getter.IsStatic), indent + "\t", opt, members); + GenerateInvoker (sw, Methods.Where (m => !m.IsStatic), indent + "\t", opt, members); if (FullName == "Java.Lang.ICharSequence") GenCharSequenceEnumerator (sw, indent + "\t", opt); foreach (InterfaceGen iface in GetAllDerivedInterfaces ()) { - GenerateInvoker (sw, iface.Properties, indent + "\t", opt, members); - GenerateInvoker (sw, iface.Methods.Where (m => !IsCovariantMethod (m) && !(iface.FullName.StartsWith ("Java.Lang.ICharSequence") && m.Name.EndsWith ("Formatted"))), indent + "\t", opt, members); + GenerateInvoker (sw, iface.Properties.Where (p => !p.Getter.IsStatic), indent + "\t", opt, members); + GenerateInvoker (sw, iface.Methods.Where (m => !m.IsStatic && !IsCovariantMethod (m) && !(iface.FullName.StartsWith ("Java.Lang.ICharSequence") && m.Name.EndsWith ("Formatted"))), indent + "\t", opt, members); if (iface.FullName == "Java.Lang.ICharSequence") GenCharSequenceEnumerator (sw, indent + "\t", opt); } @@ -271,7 +271,7 @@ void GenerateInvoker (StreamWriter sw, string indent, CodeGenerationOptions opt) sw.WriteLine (); } - void GenerateInvoker (StreamWriter sw, List properties, string indent, CodeGenerationOptions opt, HashSet members) + void GenerateInvoker (StreamWriter sw, IEnumerable properties, string indent, CodeGenerationOptions opt, HashSet members) { foreach (Property prop in properties) { if (members.Contains (prop.Name)) @@ -635,7 +635,7 @@ public void GenerateAbstractMembers (ClassGen gen, StreamWriter sw, string inden m.GenerateAbstractDeclaration (sw, indent, opt, this, gen); opt.ContextGeneratedMethods.Add (m); } - foreach (Property prop in Properties) { + foreach (Property prop in Properties.Where (p => !p.Getter.IsStatic)) { if (gen.ContainsProperty (prop.Name, false)) continue; prop.GenerateAbstractDeclaration (sw, indent, opt, gen);