Skip to content

Commit

Permalink
[generator] fix bogus type name in warnings for duplicate fields. (#191)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
atsushieno authored and jonpryor committed Oct 11, 2017
1 parent 4d6c5a9 commit 1865534
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/generator/GenBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,11 @@ public bool GenFields (StreamWriter sw, string indent, CodeGenerationOptions opt
bool needsProperty = false;
foreach (Field f in fields) {
if (ContainsName (f.Name)) {
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);
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);
continue;
}
if (seen != null && seen.Contains (f.Name)) {
Report.Warning (0, Report.WarningDuplicateField, "Skipping {0}.{1}.{2}, due to a duplicate field.", this.Namespace, this.Name, f.Name);
Report.Warning (0, Report.WarningDuplicateField, "Skipping {0}.{1}, due to a duplicate field. (Field) (Java type: {2})", this.FullName, f.Name, this.JavaName);
continue;
}
if (f.Validate (opt, TypeParameters)) {
Expand Down

0 comments on commit 1865534

Please sign in to comment.