JDK 11 RFR of JDK-8196627: Update MultiReleaseJarAwareSJFM.java to be version agnostic

Vicente Romero vicente.romero at oracle.com
Fri Feb 2 13:15:46 UTC 2018


looks good,
Vicente

On 02/01/2018 08:47 PM, joe darcy wrote:
> Hello,
>
> This really should be the last review related to updating langtools 
> tests before the JDK 10 -> 11 version update. A multi-release jar file 
> test had a mismatch of a fixed version of version and querying the 
> current version from the runtime. Please review the patch below to 
> reconcile this difference and thereby address:
>
>         JDK-8196627: Update MultiReleaseJarAwareSJFM.java to be 
> version agnostic
>
> Thanks,
>
> -Joe
>
> --- 
> a/test/langtools/tools/javac/file/MultiReleaseJar/MultiReleaseJarAwareSJFM.java 
> Thu Feb 01 09:16:03 2018 -0800
> +++ 
> b/test/langtools/tools/javac/file/MultiReleaseJar/MultiReleaseJarAwareSJFM.java 
> Thu Feb 01 17:46:16 2018 -0800
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2016, Oracle and/or its affiliates. All rights 
> reserved.
> + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights 
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -23,7 +23,7 @@
>
>  /*
>   * @test
> - * @bug 8149757 8144062
> + * @bug 8149757 8144062 8196627
>   * @summary Test that StandardJavaFileManager uses the correct 
> version of a
>   * class from a multi-release jar on classpath
>   * @library /tools/lib
> @@ -56,6 +56,7 @@
>  import toolbox.ToolBox;
>
>  public class MultiReleaseJarAwareSJFM {
> +    private static final int CURRENT_VERSION = 
> Runtime.version().major();
>
>      private final String version8 =
>              "package version;\n" +
> @@ -86,12 +87,12 @@
>              "    }\n" +
>              "}\n";
>
> -    private final String version10 =
> +    private final String versionCurrent =
>              "package version;\n" +
>              "\n" +
>              "public class Version {\n" +
>              "    public int getVersion() {\n" +
> -            "        return 10;\n" +
> +            "        return " + CURRENT_VERSION +";\n" +
>              "    }\n" +
>              "}\n";
>
> @@ -116,7 +117,7 @@
>      public void setup() throws Exception {
>          tb.createDirectories("classes",
>                  "classes/META-INF/versions/9",
> -                "classes/META-INF/versions/10");
> +                "classes/META-INF/versions/" + CURRENT_VERSION);
>          new JavacTask(tb)
>                  .outdir("classes")
>                  .sources(version8)
> @@ -126,8 +127,8 @@
>                  .sources(version9, packagePrivate)
>                  .run();
>          new JavacTask(tb)
> -                .outdir("classes/META-INF/versions/10")
> -                .sources(version10)
> +                .outdir("classes/META-INF/versions/" + CURRENT_VERSION)
> +                .sources(versionCurrent)
>                  .run();
>          new JarTask(tb, "multi-release.jar")
>                  .manifest(manifest)
> @@ -135,16 +136,16 @@
>                  .files("version/Version.class",
> "META-INF/versions/9/version/Version.class",
> "META-INF/versions/9/version/PackagePrivate.class",
> - "META-INF/versions/10/version/Version.class")
> +                        "META-INF/versions/" + CURRENT_VERSION + 
> "/version/Version.class")
>                  .run();
>      }
>
>      @AfterClass
>      public void teardown() throws Exception {
>          tb.deleteFiles(
> - "classes/META-INF/versions/10/version/Version.class",
> -                "classes/META-INF/versions/10/version",
> -                "classes/META-INF/versions/10/",
> +                "classes/META-INF/versions/" + CURRENT_VERSION + 
> "/version/Version.class",
> +                "classes/META-INF/versions/" + CURRENT_VERSION + 
> "/version",
> +                "classes/META-INF/versions/" + CURRENT_VERSION,
> "classes/META-INF/versions/9/version/Version.class",
> "classes/META-INF/versions/9/version/PackagePrivate.class",
>                  "classes/META-INF/versions/9/version",
>



More information about the compiler-dev mailing list