Currently generated bindings are forcing to use explicit casts in the Java code, which produces some cluttering as well as a lot of compiler warnings.
For example:
NSMutableArray a = NSMutableArray.alloc().init();
a.add("String");
I can’t specify type NSMutableArray without explicitly casting return value of .init() method.
This is because init() is declared like this:
public native NSMutableArray<?> init();
I’d suggest to change generated code to this:
public native <T> NSMutableArray<T> init();
So, Java compiler will be able to deduce the return value at the assignment:
NSMutableArray<String> a = NSMutableArray.alloc().init();
a.add("String");
Also, in NSArray:
public static native <_ObjectType> NSArray<?> arrayWithObjects(...)
Should be:
public static native <_ObjectType> NSArray<_ObjectType> arrayWithObjects(...)
and Object… vararg param there should be also _ObjectType.
Same issue with NSMutableDictionary, NSDictionary…
Please let me know if those are doable, in that case I will add a few more examples from standard ios frameworks I bumped at.