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
Many java apps running on macOS Sonoma complain (warning) the following way:
WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
I was wondering if JFA could help resolving this. Therefore, I added the following line in NSApplicationDelegate.java:
NSApplication app = NSApplication.sharedApplication();
NSApplicationDelegate appd = new NSApplicationDelegate(){
@Override
public boolean respondsToSelector(ID arg0) {
// TODO Auto-generated method stub
return false;
}
@Override
public void performSelectorOnMainThread(ID arg0, ID arg1, boolean arg2) {
// TODO Auto-generated method stub
}
@Override
public NSMethodSignature methodSignatureForSelector(ID arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public String description() {
// TODO Auto-generated method stub
return null;
}
@Override
public void dealloc() {
// TODO Auto-generated method stub
}
@Override
public String className() {
// TODO Auto-generated method stub
return null;
}
@Override
public void applicationWillUpdate(NSNotification arg0) {
// TODO Auto-generated method stub
}
@Override
public void applicationWillFinishLaunching(NSNotification arg0) {
// TODO Auto-generated method stub
}
@Override
public void applicationWillBecomeActive(NSNotification arg0) {
// TODO Auto-generated method stub
}
@Override
public boolean applicationSupportsSecureRestorableState(NSApplication arg0) {
/* This is the method that should be implemented to avoid warning with Sonoma */
return true;
}
@Override
public NSMenu applicationDockMenu(NSApplication arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public void applicationDidUpdate(NSNotification arg0) {
// TODO Auto-generated method stub
}
@Override
public void applicationDidFinishLaunching(NSNotification arg0) {
// TODO Auto-generated method stub
}
@Override
public void applicationDidBecomeActive(NSNotification arg0) {
// TODO Auto-generated method stub
}
};
app.setDelegate(appd);
However, the last line throws an Exception (AquaTest is my testing application):
Exception in thread "main" java.lang.IllegalArgumentException: is not supported
at de.jangassen.jfa.ObjcToJava.toID(ObjcToJava.java:139)
at de.jangassen.jfa.ObjcToJava.toFoundationArgument(ObjcToJava.java:111)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:274)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:550)
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:517)
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:523)
at de.jangassen.jfa.ObjcToJava.getFoundationArguments(ObjcToJava.java:209)
at de.jangassen.jfa.ObjcToJava.invokeNative(ObjcToJava.java:169)
at de.jangassen.jfa.ObjcToJava.invoke(ObjcToJava.java:164)
at com.sun.proxy.$Proxy1.setDelegate(Unknown Source)
at AquaTest.main(AquaTest.java:106)
Maybe I'm completely wrong in this implementation. Any idea if JFA could help in resolving the above described warning ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Many java apps running on macOS Sonoma complain (warning) the following way:
I was wondering if JFA could help resolving this. Therefore, I added the following line in NSApplicationDelegate.java:
Then, in the Java app, I tried this:
However, the last line throws an Exception (AquaTest is my testing application):
Maybe I'm completely wrong in this implementation. Any idea if JFA could help in resolving the above described warning ?
Beta Was this translation helpful? Give feedback.
All reactions