Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 9 deprecation #137

Open
osallou opened this issue May 3, 2018 · 7 comments
Open

Java 9 deprecation #137

osallou opened this issue May 3, 2018 · 7 comments

Comments

@osallou
Copy link

osallou commented May 3, 2018

While compiling with JDK 9, I got some deprecation warning that turned to errors.

Here is patch to fix issue

--- a/src/main/java/org/broadinstitute/barclay/argparser/CommandLineArgumentParser.java
+++ b/src/main/java/org/broadinstitute/barclay/argparser/CommandLineArgumentParser.java
@@ -1066,7 +1066,7 @@
     private void createCollection(final Field field, final Object callerArguments, final String annotationType)
             throws IllegalAccessException {
         try {
-            field.set(callerArguments, field.getType().newInstance());
+            field.set(callerArguments, field.getType().getConstructor().newInstance());
         } catch (final Exception ex) {
             try {
                 field.set(callerArguments, new ArrayList<>());
--- a/src/main/java/org/broadinstitute/barclay/argparser/LegacyCommandLineArgumentParser.java
+++ b/src/main/java/org/broadinstitute/barclay/argparser/LegacyCommandLineArgumentParser.java
@@ -879,7 +879,7 @@
      private void createCollection(final Field field, final Object callerOptions, final String annotationType)
             throws IllegalAccessException {
         try {
-            field.set(callerOptions, field.getType().newInstance());
+            field.set(callerOptions, field.getType().getConstructor().newInstance());
         } catch (final Exception ex) {
             try {
                 field.set(callerOptions, new ArrayList<>());
@magicDGS
Copy link
Contributor

magicDGS commented May 3, 2018

Does your fix compiles with Java8? If I am correct, the target compatibility is 1.8

@magicDGS
Copy link
Contributor

magicDGS commented May 3, 2018

In addition, java9 is a short-term release and java10 is released. Oracle recommends to transition to java10: http://www.oracle.com/technetwork/java/eol-135779.html

@osallou
Copy link
Author

osallou commented May 3, 2018 via email

@mr-c
Copy link

mr-c commented Jan 6, 2019

Barclay is now failing to build in Debian as Java 11 is now the default version: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906973

@mr-c
Copy link

mr-c commented Jan 16, 2019

Without Java 11 support in barclay then barclay, picard-tools, IGV, paleomix, and Artemis will be removed from the upcoming stable release of Debian "buster" :-(

@cmnbroad
Copy link
Collaborator

cmnbroad commented Jan 18, 2019

@osallou @mr-c I'm trying to untangle what/how many issues there here are. Is the original issue reported in this ticket (which looks like a runtime issue, presumably from running a test) the only issue you're aware of, or is there a build-time issue as well ? Also, I see how this affects Picard, but am unclear on how it impacts, say, IGV, which AFAIK doesn't have any Barclay dependency.

@osallou
Copy link
Author

osallou commented Jan 18, 2019

those are build issues.
I talked about are warnings going to errors with "newer" JDKs. The patch fixed the issue in Debian with JDK 11 (current JDK in Debian)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants