-
Notifications
You must be signed in to change notification settings - Fork 565
Description
Context
60363ef added an option to wrap Java exception types in .NET exception types for certain Android APIs.
JavaDictionary.Get() is an example:
Expected behavior
JavaDictionary inherits from Java.Lang.Object and implements IDictionary:
The documentation for the IDictionary.Item[Object] indexer property mentions two exceptions:
ArgumentNullExceptionNotSupportedException
Actual behavior
JavaDictionary.Get() can currently throw the following two different exceptions instead:
InvalidCastExceptionNullReferenceException
Depending on the goals of the Java exception wrapping, throwing different System exceptions from JavaDictionary.Get() than the ones documented for IDictionary.Item[Object] might be unintended. Maybe only the exception conditions documented for IDictionary.Item[Object] (like "key is null") need to be surfaced as System exceptions, and other exceptions, if any, can be left as Java exceptions?
Related scenarios
If this JavaDictionary.Get() scenario does look good to change, then there are probably a few additional similar cases to change too.
Another slightly different case is JavaCollection.Add(). I think it might have been wrapped because JavaCollection implements ICollection, but I just noticed today that the non-generic ICollection interface doesn't include an Add() method. Only the generic ICollection<T> includes an Add() method. So maybe JavaCollection.Add() doesn't need to wrap any exceptions?