You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I get "pattern matching for instanceof" working?
The issue #2345 states that "You can use post-Java11 features that are implemented by javac, like switch expressions, text blocks, and pattern matching for instanceof."
I have j2objc master compiled with jdk 17, running with Java 17, it silently converts pattern matching for instanceof but the variable to which it should be casted, is not declared in objc output. For example:
if ( oinstanceofListl ) {
l.clear();
}
is converted to (regardless -XDallVersions -source 17 options):
if ([o isKindOfClass:[JavaUtilArrayList class]]) {
[l clear];
}
The text was updated successfully, but these errors were encountered:
How can I get "pattern matching for instanceof" working?
Can't do that now, as new Java language features in Java 17 aren't implemented yet (I'm currently working on Java Records). The j2objc translator gets those new language features that are "syntactic sugar" automatically, since it uses javac as its front-end. Those features that require code generation changes require j2objc to be updated.
How can I get "pattern matching for instanceof" working?
The issue #2345 states that "You can use post-Java11 features that are implemented by javac, like switch expressions, text blocks, and pattern matching for instanceof."
I have j2objc master compiled with jdk 17, running with Java 17, it silently converts pattern matching for instanceof but the variable to which it should be casted, is not declared in objc output. For example:
is converted to (regardless -XDallVersions -source 17 options):
The text was updated successfully, but these errors were encountered: