Compatibility Issues with Java SE 11 and Later

We’ve performed an analysis on Aspose.Words for Java 22.4 (both JDK1.6 and 1.7) for any potential incompatibilities with Oracle Java SE 11 or later (17). The following issues were identified based on Java bytecode scanning and reviewing the decompiled Java source code.

Summary

  1. Removed API in Java 11 - java.util.zip.CRC32: public void update(byte[]);
  2. Removed API in Java 11 - java.security.spec.ECGenParameterSpec: public java.lang.String getName();
  3. Unsupported Internal API - sun.security.provider.Sun
  4. Unsupported Internal API - sun.security.internal.spec.TlsPrfParameterSpec
  5. Unsupported Internal API - sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec
  6. Unsupported Internal API - sun.security.provider.SecureRandom

Analysis

Issue 1: Removed API in Java 11 - java.util.zip.CRC32: public void update(byte[]);

D:\Projects\Aspose\Aspose.Words for Java 22.4\decomp>grep -iR crc32 *
com/aspose/words/internal/zzGc.java:import java.util.zip.CRC32;
com/aspose/words/internal/zzGc.java:    private CRC32 zzWkY;
com/aspose/words/internal/zzGc.java:        this.zzWkY = new CRC32();
com/aspose/words/internal/zzIU.java:import java.util.zip.CRC32;
com/aspose/words/internal/zzIU.java:                    final CRC32 crc32;
com/aspose/words/internal/zzIU.java:                    (crc32 = new CRC32()).update(zzXVB.zzZ65());
com/aspose/words/internal/zzIU.java:                    zz9B.zzYX0((int)crc32.getValue());
com/aspose/words/internal/zzYZY.java:import java.util.zip.CRC32;
com/aspose/words/internal/zzYZY.java:        final CRC32 crc32;
com/aspose/words/internal/zzYZY.java:        (crc32 = new CRC32()).update(array);
com/aspose/words/internal/zzYZY.java:        zipEntry.setCrc(crc32.getValue());
  • zzGc.java --> ByteArrayOutputStream --> byte array
  • zzIU.java --> zzXVB.zzZ65() --> byte[] zzZ65() --> byte array
  • zzYZY.java --> final byte[] array --> byte array

Java 8 doc - https://docs.oracle.com/javase/8/docs/api/java/util/zip/CRC32.html
–> Java 8 introduced: void update(ByteBuffer buffer)
Java 11 doc - https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/zip/CRC32.html
–> Java 11 removed: void update(Byte[] b)

Issue 2: Removed API in Java 11 - java.security.spec.ECGenParameterSpec: public java.lang.String getName();

D:\Projects\Aspose\Aspose.Words for Java 22.4\decomp>grep -iR ECGenParameterSpec * | grep -i getName
com/aspose/words/internal/zzX0Q.java:        String s = ecGenParameterSpec.getName();
com/aspose/words/internal/zzX0Q.java:                    throw new InvalidParameterSpecException("EC AlgorithmParameters cannot recognize curve " + ecGenParameterSpec.getName());
com/aspose/words/internal/zzX0Q.java:                    throw new InvalidAlgorithmParameterException("unknown curve ID: " + ((ECGenParameterSpec)params).getName());
com/aspose/words/internal/zzZ5q.java:                this.zzNn = this.zzMq(((ECGenParameterSpec)params).getName());
com/aspose/words/internal/zzZfN.java:                zzW8B = new zzW8B(new zzXEV(zzt7.zzmQ(((ECGenParameterSpec)params).getName())));

Java 8 doc - https://docs.oracle.com/javase/8/docs/api/java/security/spec/ECGenParameterSpec.html
Java 11 doc - https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/security/spec/ECGenParameterSpec.html
–> Methods declared in class java.security.spec.NamedParameterSpec

Issue 3: Unsupported Internal API - sun.security.provider.Sun

D:\Projects\Aspose\Aspose.Words for Java 22.4\decomp>grep -iR sun.security.provider.Sun *
com/aspose/words/internal/zz1S.java:import sun.security.provider.Sun;

Suggested replacement is java.security.Security.getProvider.
https://bugs.openjdk.java.net/browse/JDK-8062515
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8062515

“In general, you should avoid depending on a specific provider as it may not be available on other Java implementations. See Oracle security providers documentation for more rationale.”

Issue 4: Unsupported Internal API - sun.security.internal.spec.TlsPrfParameterSpec

D:\Projects\Aspose\Aspose.Words for Java 22.4\decomp>grep -R TlsPrfParameterSpec *
com/aspose/words/internal/zz1S.java:                    if (zzZI1("sun.security.internal.spec.TlsKeyMaterialParameterSpec") && zzZI1("sun.security.internal.spec.TlsKeyMaterialSpec") && zzZI1("sun.security.internal.spec.TlsMasterSecretParameterSpec") && zzZI1("sun.security.internal.spec.TlsPrfParameterSpec") && zzZI1("sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec")) {
com/aspose/words/internal/zzYwR.java:import sun.security.internal.spec.TlsPrfParameterSpec;
com/aspose/words/internal/zzYwR.java:    private static TlsPrfParameterSpec zzXWJ(final SecretKey secretKey, final String s, final byte[] array, final int n, final String s2, final int n2, final int n3) {
com/aspose/words/internal/zzYwR.java:            return (TlsPrfParameterSpec)zzYwR.zzZEW.newInstance(array2);
com/aspose/words/internal/zzYwR.java:            throw new IllegalStateException("Unable to construct TlsPrfParameterSpec: " + ex.getMessage(), ex);
com/aspose/words/internal/zzYwR.java:                    return zz1S.class.getClassLoader().loadClass("sun.security.internal.spec.TlsPrfParameterSpec").getMethod("getPRFHashAlg", (Class<?>[])new Class[0]) != null;
com/aspose/words/internal/zzYwR.java:                    return zz1S.class.getClassLoader().loadClass("sun.security.internal.spec.TlsPrfParameterSpec").getConstructors()[0];
com/aspose/words/internal/zzYwR.java:        protected static SecretKey zzXWJ(final TlsPrfParameterSpec tlsPrfParameterSpec, final String s) {
com/aspose/words/internal/zzYwR.java:                    TlsPrfParameterSpec tlsPrfParameterSpec;
com/aspose/words/internal/zzYwR.java:                    TlsPrfParameterSpec tlsPrfParameterSpec;
com/aspose/words/internal/zzYwR.java:                    TlsPrfParameterSpec tlsPrfParameterSpec;
com/aspose/words/internal/zzYwR.java:        private TlsPrfParameterSpec zzXiC;
com/aspose/words/internal/zzYwR.java:                    zzWOu.this.zzXiC = (TlsPrfParameterSpec)algorithmParameterSpec;

The sun.security.internal.spec.TlsPrfParameterSpec is considered an Unsupported Internal API.

Issue 5: Unsupported Internal API - sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec

D:\Projects\Aspose\Aspose.Words for Java 22.4\decomp>grep -iR TlsRsaPremasterSecretParameterSpec *
com/aspose/words/internal/zz1S.java:                    if (zzZI1("sun.security.internal.spec.TlsKeyMaterialParameterSpec") && zzZI1("sun.security.internal.spec.TlsKeyMaterialSpec") && zzZI1("sun.security.internal.spec.TlsMasterSecretParameterSpec") && zzZI1("sun.security.internal.spec.TlsPrfParameterSpec") && zzZI1("sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec")) {
com/aspose/words/internal/zzYwR.java:import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
com/aspose/words/internal/zzYwR.java:                    return zz1S.class.getClassLoader().loadClass("sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec").getMethod("getEncodedSecret", (Class<?>[])new Class[0]) != null;
com/aspose/words/internal/zzYwR.java:        private TlsRsaPremasterSecretParameterSpec zzZu8;
com/aspose/words/internal/zzYwR.java:                    zzqi.this.zzZu8 = (TlsRsaPremasterSecretParameterSpec)algorithmParameterSpec;
com/aspose/words/internal/zzYwR.java:                            if ((array = (byte[])zz1S.class.getClassLoader().loadClass("sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec").getMethod("getEncodedSecret", (Class<?>[])new Class[0]).invoke(zzqi.this.zzZu8, new Object[0])) == null) {
com/aspose/words/internal/zzYwR.java:                            throw new IllegalStateException("internal error, profile of TlsRSAPremasterSecretParameterSpec has changed: " + ex.getMessage(), ex);

The sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec is considered an Unsupported Internal API.

Issue 6: Unsupported Internal API - sun.security.provider.SecureRandom

D:\Projects\Aspose\Aspose.Words for Java 22.4\decomp>grep -iR 'sun.security.provider.SecureRandom' *
com/aspose/words/internal/zz1S.java:            super(new sun.security.provider.SecureRandom(), zz2H());

The sun.security.provider.SecureRandom is considered an Unsupported Internal API.

Closing Comments
Kindly requesting for your review of these issues and implement the necessary code changes to Aspose.Words for Java code base to ensure compatibility with later Java releases.

@PieterB,

Thanks for this observation. It has been logged as WORDSJAVA-2723. We will further look into the details of this problem and will keep you updated on the status of linked issue.

1 Like

@alexey.maslov Thanks for acknowledging this case. If any further information is needed, then just let me know.

1 Like

@alexey.maslov Can you clarify what’s the current status of WORDSJAVA-2723 ? :slightly_smiling_face:

@PieterB,

This issue is currently queued for analysis. We will keep you posted and will let you know as soon as the issue is resolved. Please accept our apologies for the inconvenience.

1 Like

Kindly checking in to ask if the Aspose development team has had a change to review the potential incompatibilities I have listed above. Note that this will become important to us on the short term to be able to use Aspose.Words for Java with Oracle Java SE 11 or later (17), as technology component of our large enterprise application.

@PieterB,

This problem has not yet been analyzed. We will increase the priority of this task and keep you updated. Please accept our apologies for the inconvenience.

@alexey.maslov Just a quick check-in on this issue that we brought to your attention. Can you advise that this is still on the dev’s todo list?

Note that any of your Aspose.Words for Java consumers may by impacted by one or more of the incompatibilities described when using Oracle Java SE 11 or later.

@PieterB,

this problem is queued for analysis. I have informed the development team about your re-request. Thank you for your comment and please accept our apologies for the inconvenience, we will notify you when the issue status changes.

1 Like

Hi @PieterB

I worked on WORDSJAVA-2723

  • I tried to fix Compatibility Issues and some of them work with JDK1.7 but not work with JDK1.6
    Most of our customers still uses JDK1.6 version of Aspose.Words for Java and it is important to us to save compatibility with this version of Java.
  • All sun.security.* packages is ussed by Bouncy Castle library.
    I created task WORDSJAVA-2787 to update Bouncy Castle library to latest version,

For adding compatibility with Java SE 11 we should rewrite a lot of our code and create new version of Aspose.Words for Java to publication.

Now this task is postponed until we prepare new version of Aspose.Words for JDK11 or find new librarys for JDK1.6 without problem with compatibility.

Hereby updating this thread with specific to issue #1: Removed API in Java 11 - java.util.zip.CRC32: public void update(byte[]);

A small testcase has shown that current Java code compiled with Java 7 works even with Java 17 runtime.

Conclusion: the usage of java.util.zip.CRC32 by Aspose.Words for Java is compatible with newer Java releases and no code changes are required.

1 Like

Hi @PieterB

Thanks for additional information

  • For java.util.zip.CRC32 you find that no code changes are required
  • For java.security.spec.ECGenParameterSpec and sun.security.provider.* I updated Bouncy Castle library

Now I decided to close WORDSJAVA-2723 and include it to the next Aspose Words for Java release

1 Like

The issues you have found earlier (filed as WORDSJAVA-2723) have been fixed in this Aspose.Words for Java 23.5 update.