Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303220

Javac hangs when attempting to compile "Hello, world!" with a Java 17 library

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      OpenJDK 11.0.2, I'm running it on Debian through WSL on Windows

      A DESCRIPTION OF THE PROBLEM :
      When attempting to run this command:
          javac -d target -classpath lib/httpclient-1.0.3.jar -sourcepath src src/Main.java

      Using a library from here:
          https://repo1.maven.org/maven2/com/github/codemonstur/httpclient/1.0.3/httpclient-1.0.3.jar

      Javac hangs what looks like forever.

      I wanted to check with Oracle JDK 11.0.18 but downloading requires an account and I don't want to do it. The OpenJDK wiki (https://wiki.openjdk.org/display/OpenJFX/Submitting+a+Bug+Report) points me here, I also don't have an account for the openjdk bug tracker.
      The error doesn't occur on my version of Java 19. I didn't check with anything else. I made an SSCCE which can be found here: https://github.com/codemonstur/javac-bug.

      Since the jar contains code built with Java 17 I expected to get some sort of error.

      REGRESSION : Last worked in version 19.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Checkout code from https://github.com/codemonstur/javac-bug. Then run this:

      $ make download
      $ make bug


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      An error.
      ACTUAL -
      Javac hangs indefinitely.

      ---------- BEGIN SOURCE ----------
      Any source will do. I added a single file with a psvm and sout "Hello, world!".
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don't use a library built for Java 17 with Java 11. Or just don't use Java 11.

      FREQUENCY : always


            adev Anupam Dev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: