Re: ant-ivy git commit: IVY-1569 Avoid reflection warnings (or worse) in Java 9+

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: ant-ivy git commit: IVY-1569 Avoid reflection warnings (or worse) in Java 9+

Jaikiran Pai


On 02/02/18 11:49 PM, [hidden email] wrote:

> Repository: ant-ivy
> Updated Branches:
>    refs/heads/master 1d3567f30 -> 7ebc8107a
>
>
> IVY-1569 Avoid reflection warnings (or worse) in Java 9+
>
>
> +    private static int getJavaVersion() {
> +        // See https://docs.oracle.com/javase/8/docs/technotes/guides/versioning/spec/versioning2.html#wp90002
> +        final String[] version = System.getProperty("java.version").split("\\.");
> +        final int major = Integer.parseInt(version[0]);
> +        return major == 1 ? Integer.parseInt(version[1]) : major;
> +    }
>   }
>
I think we should use java.specification.version system property instead
which is the recommended one as per the JEP
http://openjdk.java.net/jeps/223. We use this property in Ant too to
determine the Java version.

-Jaikiran

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: ant-ivy git commit: IVY-1569 Avoid reflection warnings (or worse) in Java 9+

Stefan Bodewig
On 2018-02-05, Jaikiran Pai wrote:

> On 02/02/18 11:49 PM, [hidden email] wrote:
>> Repository: ant-ivy
>> Updated Branches:
>>    refs/heads/master 1d3567f30 -> 7ebc8107a


>> IVY-1569 Avoid reflection warnings (or worse) in Java 9+


>>>    private static int getJavaVersion() {
>>>        // See https://docs.oracle.com/javase/8/docs/technotes/guides/versioning/spec/versioning2.html#wp90002
>>>        final String[] version = System.getProperty("java.version").split("\\.");
>>>        final int major = Integer.parseInt(version[0]);
>>>        return major == 1 ? Integer.parseInt(version[1]) : major;
>>>    }
>>   }

> I think we should use java.specification.version system property
> instead which is the recommended one as per the JEP
> http://openjdk.java.net/jeps/223. We use this property in Ant too to
> determine the Java version.

Or org.apache.tools.ant.util.JavaEnvUtils#getParsedJavaVersion

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: ant-ivy git commit: IVY-1569 Avoid reflection warnings (or worse) in Java 9+

Gintautas Grigelionis
Ivy should be used standalone, so I'd rather implement Jaikiran's
suggestion.
Any comments about moving a public method TestHelper.getCurrentAuthenticator()
over to IvyAuthenticator()?

Gintas

2018-02-05 6:12 GMT+01:00 Stefan Bodewig <[hidden email]>:

> On 2018-02-05, Jaikiran Pai wrote:
>
> > On 02/02/18 11:49 PM, [hidden email] wrote:
> >> Repository: ant-ivy
> >> Updated Branches:
> >>    refs/heads/master 1d3567f30 -> 7ebc8107a
>
>
> >> IVY-1569 Avoid reflection warnings (or worse) in Java 9+
>
>
> >>>    private static int getJavaVersion() {
> >>>        // See https://docs.oracle.com/javase/8/docs/technotes/
> guides/versioning/spec/versioning2.html#wp90002
> >>>        final String[] version = System.getProperty("java.
> version").split("\\.");
> >>>        final int major = Integer.parseInt(version[0]);
> >>>        return major == 1 ? Integer.parseInt(version[1]) : major;
> >>>    }
> >>   }
>
> > I think we should use java.specification.version system property
> > instead which is the recommended one as per the JEP
> > http://openjdk.java.net/jeps/223. We use this property in Ant too to
> > determine the Java version.
>
> Or org.apache.tools.ant.util.JavaEnvUtils#getParsedJavaVersion
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>