Skip to content

Commit 27a4bf1

Browse files
committed
Revert "[generator] Remove androidx.annotation from Annotation names (#882)"
This reverts commit 1e8f513. Context: #885 Testing?
1 parent 77d598d commit 27a4bf1

File tree

2 files changed

+2
-41
lines changed

2 files changed

+2
-41
lines changed

src/Xamarin.Android.Tools.AnnotationSupport/Objects/AnnotatedItem.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -98,37 +98,5 @@ IEnumerable<string> ParseArguments (string args)
9898
yield return x;
9999
}
100100
}
101-
102-
public override string ToString ()
103-
{
104-
var s = new System.Text.StringBuilder ();
105-
foreach (var a in Annotations) {
106-
s.Append ("@").Append (a.Name);
107-
if (a.Values.Count > 0) {
108-
s.Append ("(");
109-
AppendAnnotationValue (a.Values [0]);
110-
for (int i = 1; i < a.Values.Count; ++i) {
111-
s.Append (", ");
112-
AppendAnnotationValue (a.Values [i]);
113-
}
114-
s.Append (")");
115-
}
116-
s.Append (" ");
117-
}
118-
s.Append (TypeName).Append (".").Append (MemberName);
119-
if (Arguments?.Length > 0) {
120-
s.Append ("(").Append (Arguments [0]);
121-
for (int i = 1; i < Arguments.Length; ++i) {
122-
s.Append (", ").Append (Arguments [i]);
123-
}
124-
s.Append (")");
125-
}
126-
return s.ToString ();
127-
128-
void AppendAnnotationValue (AnnotationValue d)
129-
{
130-
s.Append (d.Name).Append("=").Append (d.ValueAsArray);
131-
}
132-
}
133101
}
134102
}

src/Xamarin.Android.Tools.AnnotationSupport/Objects/AnnotationData.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,13 @@ namespace Xamarin.AndroidTools.AnnotationSupport
77
{
88
public class AnnotationData : AnnotationObject
99
{
10-
static readonly string[] Prefixes = new[] {
11-
"android.support.annotation.",
12-
"androidx.annotation.",
13-
};
1410
public AnnotationData (XElement e)
1511
{
1612
var a = e.Attribute ("name");
1713
Name = a == null ? null : a.Value;
18-
foreach (var predef in Prefixes) {
19-
if (!Name.StartsWith (predef, StringComparison.Ordinal))
20-
continue;
14+
string predef = "android.support.annotation.";
15+
if (Name.StartsWith (predef, StringComparison.Ordinal))
2116
Name = Name.Substring (predef.Length);
22-
break;
23-
}
2417
Values = e.Elements ("val").Select (c => new AnnotationValue (c)).ToArray ();
2518
}
2619

0 commit comments

Comments
 (0)