Skip to content

Commit

Permalink
Merge pull request #27 from umjammer/0.8.11
Browse files Browse the repository at this point in the history
0.8.11
  • Loading branch information
umjammer authored Mar 26, 2024
2 parents 2910790 + d9add86 commit 5ca39de
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 291 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ implementation of Objective-C interfaces in Java.
* separate same parts of jna-platform (like jna-platform-extended)
* deprecate rococoa-contrib
* ~~selector and java method binding for notification~~
* exception in callback method cannot be shown as reason, shown as "Exception calling method for selector foo:"
* `OCInvocationCallbacks.java:170`

----

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.sun.tools.attach.VirtualMachineDescriptor;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.rococoa.Foundation;
import org.rococoa.ObjCObject;
Expand All @@ -29,13 +28,10 @@
import org.rococoa.cocoa.appkit.NSWorkspace;
import org.rococoa.cocoa.corefoundation.CoreFoundation;
import org.rococoa.cocoa.coreimage.CIImage;
import org.rococoa.cocoa.foundation.NSBundle;
import org.rococoa.cocoa.foundation.NSDictionary;
import org.rococoa.cocoa.foundation.NSNotification;
import org.rococoa.cocoa.foundation.NSNotificationCenter;
import org.rococoa.cocoa.foundation.NSObject;
import org.rococoa.cocoa.foundation.NSString;
import org.rococoa.cocoa.gamecontroller.GCController;
import vavi.util.Debug;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -171,8 +167,6 @@ void test62() throws Exception {
if (!a.active()) {
a.activateWithOptions(0);
}
RococaRobot ide = new RococaRobot();
// ide.keyClick(kVK_ANSI_);
} catch (NoSuchElementException e) {
Debug.println(Level.WARNING, "run minecraft before running this test");
}
Expand Down Expand Up @@ -207,7 +201,7 @@ void test8() throws Exception {

CountDownLatch cdl = new CountDownLatch(1);

class MyObserver implements Callback {
static class MyObserver implements Callback {

public void applicationWasActivated(NSNotification notification) {
NSWorkspace workspace = Rococoa.cast(notification.object(), NSWorkspace.class);
Expand All @@ -225,7 +219,7 @@ public void applicationWasDeactivated(NSNotification notification) {
@Test
@EnabledIfSystemProperty(named = "vavi.test", matches = "ide")
void test9() throws Exception {
ObjCObject proxy = Rococoa.proxy(new CoreGraphicsLibraryTest.MyObserver());
ObjCObject proxy = Rococoa.proxy(new MyObserver());
Selector sel1 = Foundation.selector("applicationWasActivated:");
Selector sel2 = Foundation.selector("applicationWasDeactivated:");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static NSMutableArray toArray(NSObject...objects) {
@SuppressWarnings("unchecked")
public <T extends NSObject> List<T> toList() {
List<NSObject> result = new ArrayList<>();
for (int i = 0; i <this.count(); i++) {
for (int i = 0; i < this.count(); i++) {
result.add(this.objectAtIndex(i));
}
return (List<T>) result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.sun.jna.Pointer;
Expand Down Expand Up @@ -170,7 +171,12 @@ public Object intercept(@This Object proxy, @Origin Method method, @AllArguments
if (!Modifier.isAbstract(method.getModifiers())) {
// method is not abstract, so a Java override has been provided, which we call
logging.finest(String.format("superMethod.invoke [%s %s].%s(%s)", javaClassName, ocInstance, method.getName(), new VarArgsUnpacker(args)));
return superMethod.invoke(proxy, args);
try {
return superMethod.invoke(proxy, args);
} catch (Throwable t) {
logging.log(Level.WARNING, String.format("superMethod.invoke [%s %s].%s(%s) failure", javaClassName, ocInstance, method.getName(), new VarArgsUnpacker(args)), t);
throw t;
}
}
// normal case
return invokeCocoa(method, args);
Expand Down
19 changes: 1 addition & 18 deletions rococoa-core/src/test/java/Test1.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.rococoa.cocoa.foundation.NSString;
Expand All @@ -20,29 +19,13 @@


/**
* Test1.
* Integration Test.
*
* @author <a href="mailto:[email protected]">Naohide Sano</a> (nsano)
* @version 0.00 2023-06-30 nsano initial version <br>
*/
public class Test1 {

@Test
@Disabled
void test1() throws Exception {
// MethodHandle methodHandleFieldDirect = lookup.unreflectGetter(fieldName);
// CallSite callSiteField = new ConstantCallSite(methodHandleFieldDirect);
// methodHandleFieldDirect = callSiteField.dynamicInvoker();
// name = (String) methodHandleFieldDirect.invokeExact(new Employee());
//
//
////Lookup invoke dynamic
// methodType = MethodType.methodType(String.class);
// methodHandle = lookup.findVirtual(Employee.class, "getName", methodType);
// CallSite callSiteMethod = new ConstantCallSite(methodHandleFieldDirect);
// methodHandle = callSiteMethod.dynamicInvoker();
}

@Test
@DisabledIfEnvironmentVariable(named = "GITHUB_WORKFLOW", matches = ".*")
void test2() throws Exception {
Expand Down
Loading

0 comments on commit 5ca39de

Please sign in to comment.