Lucene - Core
  1. Lucene - Core
  2. LUCENE-6070

forbidden-apis fails on Java 9 while parsing deprecated signatures

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: 5.0, 6.0
    • Component/s: general/build
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      -check-forbidden-all:
      [forbidden-apis] Reading bundled API signatures: jdk-unsafe-1.8
      [forbidden-apis] Reading bundled API signatures: jdk-deprecated-1.8
      
      BUILD FAILED
      /mnt/ssd/jenkins/workspace/Lucene-Solr-trunk-Linux/build.xml:515: The following error occurred while executing this line:
      /mnt/ssd/jenkins/workspace/Lucene-Solr-trunk-Linux/build.xml:86: The following error occurred while executing this line:
      /mnt/ssd/jenkins/workspace/Lucene-Solr-trunk-Linux/lucene/build.xml:101: The following error occurred while executing this line:
      /mnt/ssd/jenkins/workspace/Lucene-Solr-trunk-Linux/lucene/common-build.xml:2293: Parsing signatures failed: No method found with following signature: java.util.jar.Pack200$Packer#addPropertyChangeListener(java.beans.PropertyChangeListener)
      

      This is a really new thing:

      The method java.util.jar.Pack200$Packer#addPropertyChangeListener(java.beans.PropertyChangeListener) part of the JDK 8 deprecation list. But this method was actually removed in Java 9 completely (the first deprecation ever that was actually removed!). This method was deprecated in Java 8 for the first time, with the following text:

      "Deprecated. The dependency on PropertyChangeListener creates a significant impediment to future modularization of the Java platform. This method will be removed in a future release. Applications that need to monitor progress of the packer can poll the value of the PROGRESS property instead."

      So I am not sure how to handle that, it seems that in JDK9, Oracle may need to remove more deprecated stuff to make modularization possible. In branch_5x builds this is not a problem, because it was not deprecated in Java 8, so the java 7 signatures file does not have that method listed. A workaround would be to enable the forbidden feature to not fail on missing signatures.

      1. LUCENE-6070.patch
        2 kB
        Uwe Schindler

        Activity

        Hide
        Uwe Schindler added a comment -

        As a quick fix I will commit a chage to not fail hard on parsing deprecated signatures. The long-term fix is to make forbidden-apis internally handle that correctly (deprecations is somehow special: those signatures are likely to disappear in newer Java versions - this just never happened).

        Show
        Uwe Schindler added a comment - As a quick fix I will commit a chage to not fail hard on parsing deprecated signatures. The long-term fix is to make forbidden-apis internally handle that correctly (deprecations is somehow special: those signatures are likely to disappear in newer Java versions - this just never happened).
        Hide
        Uwe Schindler added a comment -

        Oh, in the current version I cannot disable unresolveable signatures. I have to wait for a release of bugfix version of forbidden-apis. Unresolveable signatures can only be disabled in Maven (to allow multi-project builds).

        Show
        Uwe Schindler added a comment - Oh, in the current version I cannot disable unresolveable signatures. I have to wait for a release of bugfix version of forbidden-apis. Unresolveable signatures can only be disabled in Maven (to allow multi-project builds).
        Hide
        Uwe Schindler added a comment -

        I opened https://code.google.com/p/forbidden-apis/issues/detail?id=41

        I will try to release a bugfix release of forbidden the next days (version 1.6.2).

        Show
        Uwe Schindler added a comment - I opened https://code.google.com/p/forbidden-apis/issues/detail?id=41 I will try to release a bugfix release of forbidden the next days (version 1.6.2).
        Hide
        Uwe Schindler added a comment -

        Attached is a patch that updates forbidden-apis to the snapshot version 1.7. I am working on releasing that one this evening, I just have to solve some documentation issues.

        With the attached patch using the snapshot version, forbidden-apis passes with Java 9, showing just those warnings:

        -check-forbidden-all:
        [forbidden-apis] Reading bundled API signatures: jdk-unsafe-1.8
        [forbidden-apis] Reading bundled API signatures: jdk-deprecated-1.8
        [forbidden-apis] WARNING: Method not found while parsing signature: java.util.jar.Pack200$Packer#addPropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored]
        [forbidden-apis] WARNING: Method not found while parsing signature: java.util.jar.Pack200$Packer#removePropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored]
        [forbidden-apis] WARNING: Method not found while parsing signature: java.util.jar.Pack200$Unpacker#addPropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored]
        [forbidden-apis] WARNING: Method not found while parsing signature: java.util.jar.Pack200$Unpacker#removePropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored]
        [forbidden-apis] WARNING: Method not found while parsing signature: java.util.logging.LogManager#addPropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored]
        [forbidden-apis] WARNING: Method not found while parsing signature: java.util.logging.LogManager#removePropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored]
        [forbidden-apis] Reading API signatures: C:\Users\Uwe Schindler\Projects\lucene\trunk-lusolr1\lucene\tools\forbiddenApis\base.txt
        [forbidden-apis] Reading API signatures: C:\Users\Uwe Schindler\Projects\lucene\trunk-lusolr1\lucene\tools\forbiddenApis\lucene.txt
        [forbidden-apis] Loading classes to check...
        [forbidden-apis] Scanning for API signatures and dependencies...
        [forbidden-apis] Scanned 2463 (and 555 related) class file(s) for forbidden API invocations (in 2.54s), 0 error(s).
        

        As you see, Oracle already removed 6 deprecated methods of Java 8 in coming Java 9.

        Show
        Uwe Schindler added a comment - Attached is a patch that updates forbidden-apis to the snapshot version 1.7. I am working on releasing that one this evening, I just have to solve some documentation issues. With the attached patch using the snapshot version, forbidden-apis passes with Java 9, showing just those warnings: -check-forbidden-all: [forbidden-apis] Reading bundled API signatures: jdk-unsafe-1.8 [forbidden-apis] Reading bundled API signatures: jdk-deprecated-1.8 [forbidden-apis] WARNING: Method not found while parsing signature: java.util.jar.Pack200$Packer#addPropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored] [forbidden-apis] WARNING: Method not found while parsing signature: java.util.jar.Pack200$Packer#removePropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored] [forbidden-apis] WARNING: Method not found while parsing signature: java.util.jar.Pack200$Unpacker#addPropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored] [forbidden-apis] WARNING: Method not found while parsing signature: java.util.jar.Pack200$Unpacker#removePropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored] [forbidden-apis] WARNING: Method not found while parsing signature: java.util.logging.LogManager#addPropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored] [forbidden-apis] WARNING: Method not found while parsing signature: java.util.logging.LogManager#removePropertyChangeListener(java.beans.PropertyChangeListener) [signature ignored] [forbidden-apis] Reading API signatures: C:\Users\Uwe Schindler\Projects\lucene\trunk-lusolr1\lucene\tools\forbiddenApis\base.txt [forbidden-apis] Reading API signatures: C:\Users\Uwe Schindler\Projects\lucene\trunk-lusolr1\lucene\tools\forbiddenApis\lucene.txt [forbidden-apis] Loading classes to check... [forbidden-apis] Scanning for API signatures and dependencies... [forbidden-apis] Scanned 2463 (and 555 related) class file(s) for forbidden API invocations (in 2.54s), 0 error(s). As you see, Oracle already removed 6 deprecated methods of Java 8 in coming Java 9.
        Hide
        ASF subversion and git services added a comment -

        Commit 1641302 from Uwe Schindler in branch 'dev/trunk'
        [ https://svn.apache.org/r1641302 ]

        LUCENE-6070: Fix forbidden-apis and deprecations of Java 8 when used with Java 9

        Show
        ASF subversion and git services added a comment - Commit 1641302 from Uwe Schindler in branch 'dev/trunk' [ https://svn.apache.org/r1641302 ] LUCENE-6070 : Fix forbidden-apis and deprecations of Java 8 when used with Java 9
        Hide
        ASF subversion and git services added a comment -

        Commit 1641303 from Uwe Schindler in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1641303 ]

        Merged revision(s) 1641302 from lucene/dev/trunk:
        LUCENE-6070: Fix forbidden-apis and deprecations of Java 8 when used with Java 9

        Show
        ASF subversion and git services added a comment - Commit 1641303 from Uwe Schindler in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1641303 ] Merged revision(s) 1641302 from lucene/dev/trunk: LUCENE-6070 : Fix forbidden-apis and deprecations of Java 8 when used with Java 9
        Hide
        Anshum Gupta added a comment -

        Bulk close after 5.0 release.

        Show
        Anshum Gupta added a comment - Bulk close after 5.0 release.

          People

          • Assignee:
            Uwe Schindler
            Reporter:
            Uwe Schindler
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development