Skip to content

Commit 1865534

Browse files
atsushienojonpryor
authored andcommitted
[generator] fix bogus type name in warnings for duplicate fields. (#191)
It had annoyed me by reporting warnings on android.app.Notification.Action as "Android.App.Action", which doesn't exist. It was due to careless use of GenBase.Name combined with GenBase.Namespace which never cared about nested types.
1 parent 4d6c5a9 commit 1865534

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/generator/GenBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,11 @@ public bool GenFields (StreamWriter sw, string indent, CodeGenerationOptions opt
565565
bool needsProperty = false;
566566
foreach (Field f in fields) {
567567
if (ContainsName (f.Name)) {
568-
Report.Warning (0, Report.WarningFieldNameCollision, "Skipping {0}.{1}.{2}, due to a duplicate field, method or nested type name.", this.Namespace, this.Name, f.Name);
568+
Report.Warning (0, Report.WarningFieldNameCollision, "Skipping {0}.{1}, due to a duplicate field, method or nested type name. {2} (Java type: {3})", this.FullName, f.Name, HasNestedType (f.Name) ? "(Nested type)" : ContainsProperty (f.Name, false) ? "(Property)" : "(Method)", this.JavaName);
569569
continue;
570570
}
571571
if (seen != null && seen.Contains (f.Name)) {
572-
Report.Warning (0, Report.WarningDuplicateField, "Skipping {0}.{1}.{2}, due to a duplicate field.", this.Namespace, this.Name, f.Name);
572+
Report.Warning (0, Report.WarningDuplicateField, "Skipping {0}.{1}, due to a duplicate field. (Field) (Java type: {2})", this.FullName, f.Name, this.JavaName);
573573
continue;
574574
}
575575
if (f.Validate (opt, TypeParameters)) {

0 commit comments

Comments
 (0)