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

[JENKINS-55575] - Introduce a new JavaSpecificationVersion utility class #11

Merged

Conversation

@oleg-nenashev
Copy link
Member

commented Feb 4, 2019

https://issues.jenkins-ci.org/browse/JENKINS-55575

As a follow-up to jenkins-infra/update-center2#253 , I propose to move the generic class to the library.

CC @jenkinsci/java11-support esp. @batmat

@oleg-nenashev oleg-nenashev requested review from alecharp, MRamonLeon and batmat Feb 4, 2019

@MRamonLeon
Copy link

left a comment

Some comments

* Get the Java Specification version for the current JVM
* @return Java Specification version or {@code null}
* @throws NumberFormatException Version parsing error
* @throws IllegalArgumentException JVM does not specify the mandatory {@link #JAVA_SPEC_VERSION_PROPERTY_NAME} property.

This comment has been minimized.

Copy link
@MRamonLeon

MRamonLeon Feb 5, 2019

It's not the exception raised: throw new IllegalStateException(

This comment has been minimized.

Copy link
@MRamonLeon

MRamonLeon Feb 5, 2019

Is it worth to mention the NumberFormatException as well if the property is bad defined?


@Test
public void shouldRetrieveSpecVersionForTheCurrentJVM() {
System.out.println("Current JVM Specification Version: " + JavaSpecificationVersion.forCurrentJVM());

This comment has been minimized.

Copy link
@MRamonLeon

MRamonLeon Feb 5, 2019

Shouldn't this test have some automatic check (assert)?

This comment has been minimized.

Copy link
@oleg-nenashev

oleg-nenashev Feb 5, 2019

Author Member

It is a smoke test. It will blow up if the retrieval logic is not fine. Hence it is a kind of automatic check

@batmat
Copy link
Member

left a comment

everything looks good but the misleading {@code null} comment that should be removed.

public static final JavaSpecificationVersion JAVA_9 = new JavaSpecificationVersion("9");
public static final JavaSpecificationVersion JAVA_10 = new JavaSpecificationVersion("10");
public static final JavaSpecificationVersion JAVA_11 = new JavaSpecificationVersion("11");
public static final JavaSpecificationVersion JAVA_12 = new JavaSpecificationVersion("12");

This comment has been minimized.

Copy link
@batmat

batmat Feb 5, 2019

Member

NIT: add also JAVA_13 already? Given it's already started and slated for not that far away (Sept 2019) https://openjdk.java.net/projects/jdk/13/spec/

@batmat

This comment has been minimized.

Copy link
Member

commented Feb 5, 2019

Also, I think #9 should be reviewed and merged before this.

@batmat
batmat approved these changes Feb 5, 2019
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>

This comment has been minimized.

Copy link
@batmat

batmat Feb 5, 2019

Member

btw, spotbugs?

This comment has been minimized.

Copy link
@oleg-nenashev

oleg-nenashev Feb 5, 2019

Author Member

There is https://issues.jenkins-ci.org/browse/JENKINS-55973 which would be a foundation work for that. Before that I do not want to switch annotations & Co

@batmat batmat closed this Feb 5, 2019

@batmat batmat reopened this Feb 5, 2019

@oleg-nenashev oleg-nenashev merged commit ab15886 into jenkinsci:master Feb 5, 2019

1 check passed

continuous-integration/jenkins/pr-merge This commit looks good
Details
}

@Nonnull
private static String normalizeVersion(@Nonnull String input)

This comment has been minimized.

Copy link
@jglick

jglick Apr 1, 2019

Member

Seems unnecessary, or at least ought to have been a factory method for people wishing to construct their own instances based on possibly non-JEP-223-compliant input (with the actual constructor private). See jenkinsci/plugin-pom#175 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.