** Description changed:

- [Impact] 
+ [Impact]
  gradle cannot be run with openjdk-8 after the update to 4.4.1-5~18.04 
(bionic-proposed) or 4.4.1-5~18.10 (cosmic-proposed).
  
  When running it with openjdk-8 gradle fails with
  $ gradle -g /tmp --debug --stacktrace --foreground
  <snip>
-   Caused by: java.lang.NoSuchMethodError:
+   Caused by: java.lang.NoSuchMethodError:
  
java.lang.invoke.MethodHandles.privateLookupIn(Ljava/lang/Class;Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/invoke/MethodHandles$Lookup;
  <snip>
  
  This is caused by the java11-compatibility patch in debian/patches,
  which was a incomplete backport of the upstream changes [1]. Applying
  the raw upstream change actually fixes the issue.
  
  With the upstream fix applied another issue related to the ByteBuffer
  shows up and can be fixed by updating the java8-compatibility patch to
  include a cast in org.gradle.internal.hash.Hashing.update().
  
  [Test Case]
  All tests assume that bionic-proposed and cosmic-proposed are enabled.
  
  NOTE: It is important to clear gradle files between runs as it can cache some 
data that will prevent or hide some issues.
- $ rm -rf .gradle/ /tmp/native /tmp/daemon /tmp/caches/
- 
+ $ rm -rf /tmp/native /tmp/daemon /tmp/caches/
+ the directories above are due to the usage of the "-g /tmp" flag.
  
  Install gradle, openjdk-8, and openjdk-11.
  $ apt install gradle openjdk-8-jdk openjdk-11-jdk default-jdk
  By default gradle will use the default java (ie. java-11), check this:
  $ gradle -version
  <snip>
  Groovy:       2.4.16
  Ant:          Apache Ant(TM) version 1.10.5 compiled on March 5 2019
  JVM:          11.0.2 (Oracle Corporation 11.0.2+9-Ubuntu-3ubuntu118.04.1)
  OS:           Linux 4.19.0-13-generic amd64
  
  Now run gradle with openjdk-11
  $ gradle -g /tmp --debug --stacktrace --foreground
  
  Use openjdk-8 by default
  $ sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
  
  Check gradle version again
  $ gradle -version
  <snip>
  Groovy:       2.4.16
  Ant:          Apache Ant(TM) version 1.10.5 compiled on March 5 2019
  JVM:          1.8.0_191 (Oracle Corporation 25.191-b12)
  OS:           Linux 4.19.0-13-generic amd64
  
- 
  Clear gradle files
- $ rm -rf .gradle/ /tmp/native /tmp/daemon /tmp/caches/
+ $ rm -rf /tmp/native /tmp/daemon /tmp/caches/
  
  $ gradle -g /tmp --debug --stacktrace --foreground
  <snip>
-   Caused by: java.lang.NoSuchMethodError:
+   Caused by: java.lang.NoSuchMethodError:
  
java.lang.invoke.MethodHandles.privateLookupIn(Ljava/lang/Class;Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/invoke/MethodHandles$Lookup;
  <snip>
  
  With the above fixed the following error is show and required a patch for 
java8-compatibility
  $ gradle -g /tmp --debug --stacktrace
  <snip>
  01:53:01.821 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
  01:53:01.822 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
        at 
org.gradle.internal.hash.Hashing$MessageDigestHasher.update(Hashing.java:161)
  <snip>
  
- 
- [Regression Potential] 
+ [Regression Potential]
  The upstream fix actually enables openjdk-8 to be used again with gradle, no 
other regressions are expected due to that patch.
  
  The ByteBuffer to Buffer cast is also a known fix for openjdk-8
  compatibility and no regressions is expected.
  
- 
  [Other Info]
  References:
  [1] 
https://github.com/gradle/gradle/commit/028548460bd929fd034a552704798ad7f689493a
- 
  
  [Original bug report]
  Just tried the proposed Gradle package on Ubuntu 18.04 LTS. As I cannot yet 
use OpenJDK 11, I switched all Java alternatives back to OpenJDK 8 using
  
  sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
  
  Now, when I try to build my project I get the above generic error. Full
  console output:
  
  $ gradle --no-daemon clean installDebug
  To honour the JVM settings for this build a new JVM will be forked. Please 
consider using the daemon: 
https://docs.gradle.org/4.4.1/userguide/gradle_daemon.html.
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Unable to start the daemon process.
  This problem might be caused by incorrect configuration of the daemon.
  For example, an unrecognized jvm option is used.
  Please refer to the user guide chapter on the daemon at 
https://docs.gradle.org/4.4.1/userguide/gradle_daemon.html
  Please read the following process output to find out more:
  -----------------------
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  java.lang.ExceptionInInitializerError (no error message)
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or 
--debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or 
--debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: gradle 4.4.1-5~18.04
  ProcVersionSignature: Ubuntu 4.18.0-16.17~18.04.1-generic 4.18.20
  Uname: Linux 4.18.0-16-generic x86_64
  ApportVersion: 2.20.9-0ubuntu7.5
  Architecture: amd64
  CurrentDesktop: ubuntu:GNOME
  Date: Sat Mar 16 11:56:15 2019
  EcryptfsInUse: Yes
  InstallationDate: Installed on 2016-04-21 (1058 days ago)
  InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 
(20160420.1)
  PackageArchitecture: all
  SourcePackage: gradle
  UpgradeStatus: Upgraded to bionic on 2018-04-26 (323 days ago)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1820389

Title:
  Gradle on OpenJDK 8: java.lang.NoSuchMethodError:
  java.lang.invoke.MethodHandles.privateLookupIn()

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gradle/+bug/1820389/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to