-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delay resolving super classes until referenced (#146)
* Delay resolving super classes till referenced * Fix a ref counting issue that led to crash in a PyType_Ready failure situation * Split the changes to keep the issue relevant ones * Trivial code cleanup * Minor code refactoring and more comments * Add a test for array component tyep resolution * Remove unwanted comments and wrong refcounting * Update src/test/python/jpy_gettype_test.py
- Loading branch information
1 parent
f618e82
commit 84628ad
Showing
10 changed files
with
224 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// Copyright 2024 jpy-consortium | ||
// | ||
|
||
package org.jpy.fixtures; | ||
|
||
import java.lang.reflect.Array; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Used as a test class for the test cases in jpy_gettype_test.py | ||
* | ||
* @author Jianfeng Mao | ||
*/ | ||
@SuppressWarnings("UnusedDeclaration") | ||
public class CyclicReferenceChild1 extends CyclicReferenceParent { | ||
private int x; | ||
|
||
private CyclicReferenceChild1(int x) { | ||
this.x = x; | ||
} | ||
|
||
public static CyclicReferenceChild1 of(int x) { | ||
return new CyclicReferenceChild1(x); | ||
} | ||
|
||
public int get_x() { | ||
return this.x; | ||
} | ||
|
||
public CyclicReferenceChild2[] getChild2s() { | ||
CyclicReferenceChild2[] child2s = new CyclicReferenceChild2[2]; | ||
child2s[0] = new CyclicReferenceChild2(); | ||
child2s[1] = new CyclicReferenceChild2(); | ||
return child2s; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// Copyright 2024 jpy-consortium | ||
// | ||
|
||
package org.jpy.fixtures; | ||
|
||
import java.lang.reflect.Array; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Used as a test class for the test cases in jpy_gettype_test.py | ||
* | ||
* @author Jianfeng Mao | ||
*/ | ||
@SuppressWarnings("UnusedDeclaration") | ||
public class CyclicReferenceChild2 extends CyclicReferenceParent { | ||
public String getName() { | ||
return "Child2: " + this.toString(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/test/java/org/jpy/fixtures/CyclicReferenceGrandParent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// Copyright 2024 jpy-consortium | ||
// | ||
|
||
package org.jpy.fixtures; | ||
|
||
import java.lang.reflect.Array; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Used as a test class for the test cases in jpy_gettype_test.py | ||
* | ||
* @author Jianfeng Mao | ||
*/ | ||
@SuppressWarnings("UnusedDeclaration") | ||
public class CyclicReferenceGrandParent { | ||
private int x; | ||
public int z = 100; | ||
|
||
public CyclicReferenceGrandParent() { | ||
} | ||
|
||
public void refChild2(CyclicReferenceChild2 child2) { | ||
} | ||
|
||
public int grandParentMethod() { | ||
return 888; | ||
} | ||
|
||
public int get_x() { | ||
return this.x; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// Copyright 2024 jpy-consortium | ||
// | ||
|
||
package org.jpy.fixtures; | ||
|
||
import java.lang.reflect.Array; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Used as a test class for the test cases in jpy_gettype_test.py | ||
* | ||
* @author Jianfeng Mao | ||
*/ | ||
@SuppressWarnings("UnusedDeclaration") | ||
public abstract class CyclicReferenceParent extends CyclicReferenceGrandParent { | ||
private int x; | ||
public int y = 10; | ||
|
||
public static CyclicReferenceChild1 of(int x) { | ||
return CyclicReferenceChild1.of(x); | ||
} | ||
|
||
public int parentMethod() { | ||
return 88; | ||
} | ||
|
||
public int get_x() { | ||
return this.x; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Copyright 2024 jpy-consortium | ||
// | ||
|
||
package org.jpy.fixtures; | ||
|
||
import java.lang.reflect.Array; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Used as a test class for the test cases in jpy_gettype_test.py | ||
* | ||
* @author Jianfeng Mao | ||
*/ | ||
@SuppressWarnings("UnusedDeclaration") | ||
public class GetTypeFailureChild extends GetTypeFailureParent { | ||
private int x; | ||
|
||
private GetTypeFailureChild(int x) { | ||
this.x = x; | ||
} | ||
|
||
public static GetTypeFailureChild of(int x) { | ||
return new GetTypeFailureChild(x); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// Copyright 2024 jpy-consortium | ||
// | ||
|
||
package org.jpy.fixtures; | ||
|
||
import java.lang.reflect.Array; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* Used as a test class for the test cases in jpy_gettype_test.py | ||
* | ||
* @author Jianfeng Mao | ||
*/ | ||
@SuppressWarnings("UnusedDeclaration") | ||
public abstract class GetTypeFailureParent { | ||
static { | ||
toFail(); | ||
} | ||
|
||
static void toFail() { | ||
throw new RuntimeException("Can't be loaded!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters