Skip to content

Commit 565c125

Browse files
committed
Address some review feedback.
1 parent 4fe6e5d commit 565c125

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

src/Java.Interop.Tools.JavaTypeSystem/Adapters/JavaXmlApiExporter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ public static void Save (JavaTypeCollection types, XmlWriter writer)
2626
if (types.Platform.HasValue ())
2727
writer.WriteAttributeString ("platform", types.Platform);
2828

29+
writer.WriteAttributeString ("api-source", "JavaTypeSystem");
30+
2931
foreach (var pkg in types.Packages.Values) {
3032

31-
if (!pkg.Types.Any (t => !t.IsReferenceOnly))
33+
if (!pkg.Types.Any (t => !t.IsReferencedOnly))
3234
continue;
3335

3436
writer.WriteStartElement ("package");
@@ -41,7 +43,7 @@ public static void Save (JavaTypeCollection types, XmlWriter writer)
4143
writer.WriteAttributeString ("jni-name", pkg.JniName);
4244

4345
foreach (var type in pkg.Types) {
44-
if (type.IsReferenceOnly)
46+
if (type.IsReferencedOnly)
4547
continue; // skip reference only types
4648

4749
SaveType (type, writer);

src/Java.Interop.Tools.JavaTypeSystem/Adapters/ManagedApiImporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static JavaParameterModel ParseParameterModel (JavaMethodModel parent, JniTypeNa
213213

214214
static void AddReferenceTypeRecursive (JavaTypeModel type, JavaTypeCollection collection)
215215
{
216-
collection.AddReferenceType (type);
216+
collection.AddReferencedType (type);
217217

218218
foreach (var nested in type.NestedTypes)
219219
AddReferenceTypeRecursive (nested, collection);

src/Java.Interop.Tools.JavaTypeSystem/JavaModels/JavaClassModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override void Resolve (JavaTypeCollection types, List<JavaUnresolvableMod
4141
// is a reference only type, we need to force it to resolve here. This will be
4242
// needed later when we attempt to resolve base methods.
4343
try {
44-
if (BaseTypeReference.ReferencedType is JavaClassModel klass && klass.FullName != "java.lang.Object" && klass.BaseTypeReference is null && klass.IsReferenceOnly)
44+
if (BaseTypeReference.ReferencedType is JavaClassModel klass && klass.FullName != "java.lang.Object" && klass.BaseTypeReference is null && klass.IsReferencedOnly)
4545
klass.Resolve (types, unresolvables);
4646
} catch (JavaTypeResolutionException) {
4747
// Ignore

src/Java.Interop.Tools.JavaTypeSystem/JavaModels/JavaTypeModel.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public abstract class JavaTypeModel : IJavaResolvable
2222
public string Deprecated { get; }
2323
public bool IsStatic { get; }
2424
public string ExtendedJniSignature { get; }
25-
public bool IsReferenceOnly { get; internal set; }
25+
public bool IsReferencedOnly { get; internal set; }
2626

2727
public JavaPackage Package { get; }
2828
public JavaTypeModel? ParentType { get; internal set; }
@@ -56,9 +56,6 @@ protected JavaTypeModel (JavaPackage javaPackage, string javaNestedName, string
5656
/// </summary>
5757
public string FullName {
5858
get {
59-
if (Name == "boolean")
60-
return "bool";
61-
6259
if (ParentType != null)
6360
return $"{ParentType.FullName}.{Name}";
6461

src/Java.Interop.Tools.JavaTypeSystem/JavaTypeCollection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class JavaTypeCollection
99
readonly Dictionary<string, JavaPackage> packages = new Dictionary<string, JavaPackage> ();
1010
readonly Dictionary<string, JavaTypeModel> types = new Dictionary<string, JavaTypeModel> ();
1111
readonly Dictionary<string, JavaTypeModel> types_flattened = new Dictionary<string, JavaTypeModel> ();
12-
readonly Dictionary<string, JavaTypeModel> reference_types_flattened = new Dictionary<string, JavaTypeModel> ();
12+
readonly Dictionary<string, JavaTypeModel> referenced_types_flattened = new Dictionary<string, JavaTypeModel> ();
1313
readonly Dictionary<string, JavaTypeModel> built_in_types = new Dictionary<string, JavaTypeModel> ();
1414

1515
// Expose ReadOnly versions so internal type management cannot be bypassed
@@ -21,7 +21,7 @@ public class JavaTypeCollection
2121
// We only keep a flattened version of reference types. The main issue is that the Managed nesting
2222
// may not match the Java nesting (ie: types nested in Java interfaces that C# originally didn't support).
2323
// Since we don't actually *need* this model to be nested it's simpler to keep them flattened.
24-
public IReadOnlyDictionary<string, JavaTypeModel> ReferenceTypesFlattened => reference_types_flattened;
24+
public IReadOnlyDictionary<string, JavaTypeModel> ReferencedTypesFlattened => referenced_types_flattened;
2525

2626
public string? ApiSource { get; set; }
2727
public string? Platform { get; set; }
@@ -91,11 +91,11 @@ public bool AddType (JavaTypeModel type)
9191
/// <summary>
9292
/// Adds a reference type to the collection.
9393
/// </summary>
94-
public void AddReferenceType (JavaTypeModel type)
94+
public void AddReferencedType (JavaTypeModel type)
9595
{
96-
type.IsReferenceOnly = true;
96+
type.IsReferencedOnly = true;
9797

98-
reference_types_flattened [type.FullName] = type;
98+
referenced_types_flattened [type.FullName] = type;
9999
}
100100

101101
// This is a little trickier than we may initially think, because nested classes
@@ -245,7 +245,7 @@ bool RemoveResolvedType (JavaTypeModel type)
245245
return value;
246246

247247
// Finally reference types
248-
if (ReferenceTypesFlattened.TryGetValue (type, out var ref_type))
248+
if (ReferencedTypesFlattened.TryGetValue (type, out var ref_type))
249249
return ref_type;
250250

251251
// We moved this type to "mono.android.app.IntentService" which makes this

0 commit comments

Comments
 (0)