jpype v1.0.0 Release NotesRelease Date: 2020-07-15 // over 1 year ago
JCharis supported as a return type, thus rather than returning a string where a
JCharis expected. For compatibility
strand implements implicit conversion to an
intwhen used in numeric operations. Therefore, it passes the return, argument, and field contracts. But that means it is no longer considered a numerical type to Python and thus
isinstance(c, int)is False. This is consistent with the Java type conversion rules.
👍 Introduced Python operator for Java casting. In Java to cast to a type you would use
(Type) obj, but Python does not support anything similar. Therefore, we are enlisting the rarely used
matmuloperator as to allow an easy way to cast an object to a Java type. When a cast to a Java type is required, use
🛠 Introduced array notation to create Java arrays. In earlier versions, JArray factory was required to make a new array type. But this is tedious to read. In Java the notation would be
Typeto declare a type or
new Type[sz]to make a new array. Python does not directly support this notation, but it does allow for unspecified array sizes using a slice. All Java class types support
Type[sz]to create an array of a fixed size and
Type[:]to create an array type which can be instantiated later. This call be applied to multiple dimensions to create fixed sized arrays
Type[s1][s2][s3]to declare multi-dimension array types
Type[:][:][:]or to create a new multi dimensional array with unspecified dimensions
Type[sz][:][:]. Applying a slice with limits to a class is unsupported.
Java classes annotated with
@FunctionalInterfacecan be converted from any Python object that implements
__call__. This allows functions, lambdas, and class constructors to be used whereever Java accepts a lambda.
0️⃣ Deprecated class and functions were removed.
JIterator, use of
JExceptionas a factory,
0️⃣ Default for starting JVM is now to return Java strings rather than convert.
__int__so implicit conversions between float and integer types will produce a
✅ Use of
JExceptionis discouraged. To catch all exceptions or test if an object is a Java exception type, use
👻 Chained Java exception causes are now reflected in the Python stackframes.
✅ Use of
JStringis discouraged. To create a Java string or test if an object is a Java string type, use
⚡️ Updated the repr methods on Java classes.
java.util.Listcompletes the contract for
java.util.Collectioncompletes the contract for
Java classes are closed and will raise
TypeErrorif extended in Python.
🚦 Handles Control-C gracefully. Previous versions crash whenever Java handles the Control-C signal as they would shutdown Java during a call. Now JPype will produce a
InterruptedExceptionwhen returning from Java. Control-C will not break out of large Java procedures as currently implemented as Java does not have a specific provision for this.