jpype v1.0.0 Release Notes

Release Date: 2020-07-15 // over 1 year ago

    ๐Ÿ‘ JChar is supported as a return type, thus rather than returning a string where a JChar is expected. For compatibility JChar is
    derived from str and implements implicit conversion to an int when 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 matmul operator as to allow an easy way to cast an object to a Java type. When a cast to a Java type is required, use [email protected] or (Type)@obj.

    ๐Ÿ›  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 Type[] to 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 @FunctionalInterface can 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 JException as a factory, get_default_jvm_path, jpype.reflect module.

    0๏ธโƒฃ Default for starting JVM is now to return Java strings rather than convert.

    Python deprecated __int__ so implicit conversions between float and integer types will produce a TypeError.

    โœ… Use of JException is discouraged. To catch all exceptions or test if an object is a Java exception type, use java.lang.Throwable.

    ๐Ÿ‘ป Chained Java exception causes are now reflected in the Python stackframes.

    โœ… Use of JString is discouraged. To create a Java string or test if an object is a Java string type, use java.lang.String.

    โšก๏ธ Updated the repr methods on Java classes.

    java.util.List completes the contract for and

    java.util.Collection completes the contract for

    Java classes are closed and will raise TypeError if 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 InterruptedException when 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.