Skip to content

Commit 27eda70

Browse files
committed
Revert "Revert "[generator] Remove androidx.annotation from Annotation names (#882)""
This reverts commit 3f12cd2.
1 parent 623284d commit 27eda70

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@ 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+
};
1014
public AnnotationData (XElement e)
1115
{
1216
var a = e.Attribute ("name");
1317
Name = a == null ? null : a.Value;
14-
string predef = "android.support.annotation.";
15-
if (Name.StartsWith (predef, StringComparison.Ordinal))
18+
foreach (var predef in Prefixes) {
19+
if (!Name.StartsWith (predef, StringComparison.Ordinal))
20+
continue;
1621
Name = Name.Substring (predef.Length);
22+
break;
23+
}
1724
Values = e.Elements ("val").Select (c => new AnnotationValue (c)).ToArray ();
1825
}
1926

0 commit comments

Comments
 (0)