Open
Description
When we run Java2Swift, we generally get a large number of warnings like this:
warning: Unable to translate 'java.util.Collection' method 'removeIf': Java class 'java.util.function.Predicate' has not been translated into Swift
warning: Unable to translate 'java.util.Collection' method 'parallelStream': Java class 'java.util.stream.Stream' has not been translated into Swift
warning: Unable to translate 'java.util.Collection' method 'forEach': Java class 'java.util.function.Consumer' has not been translated into Swift
The user experience isn't great for several reasons:
- There are often a large number of warnings.
- It's not obvious how to address those warnings.
- It's not clear after-the-fact which APIs were dropped.
We should re-work how we report these kinds of issues. Specifically, I think we should report just one warning per target, and have that warning also produce the contents of a Java2Swift.config
file that contains suggested mappings for those types, e.g.,
{
"classes" : {
"java.util.function.Consumer" : "Consumer",
"java.util.function.Predicate" : "Predicate",
"java.util.stream.Stream" : "Stream"
}
}
Additionally, we could emit comments into the generated Swift sources indicating which APIs weren't mapped into Swift, and why, e.g.,
// Java API not available in Swift because java.util.Predicate has not been translated into Swift:
// boolean removeIf(Predicate<? super E> filter);