Skip to content

Commit

Permalink
chore: compile spoon with Java 17 (#5588)
Browse files Browse the repository at this point in the history
Co-authored-by: I-Al-Istannen <[email protected]>
  • Loading branch information
SirYwell and I-Al-Istannen authored Jan 2, 2024
1 parent 0222102 commit faf3675
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
27 changes: 6 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
let
base = rec {
jdk =
if javaVersion < 21 then prev."jdk${toString javaVersion}"
else if javaVersion == 22 then jdk22-ea
else jdk21;
if javaVersion <= 21 then prev."jdk${toString javaVersion}"
else jdk22-ea;
maven = prev.maven.override { inherit jdk; };
};
extra = with base; {
Expand All @@ -31,18 +30,6 @@
(if extraChecks then base // extra else base))
];
};
jdk21 = pkgs.stdenv.mkDerivation rec {
name = "jdk21-oracle";
version = "21+35";
src = builtins.fetchTarball {
url = "https://download.oracle.com/java/21/archive/jdk-21_linux-x64_bin.tar.gz";
sha256 = "sha256:1snj1jxa5175r17nb6l2ldgkcvjbp5mbfflwcc923svgf0604ps4";
};
installPhase = ''
cd ..
mv $sourceRoot $out
'';
};
jdk22-ea = pkgs.stdenv.mkDerivation rec {
name = "jdk22-ea";
version = "22+16";
Expand Down Expand Up @@ -198,18 +185,16 @@
# We have additional options (currently EA jdks) on 64 bit linux systems
blessedSystem = "x86_64-linux";
blessed = rec {
jdk21 = mkShell blessedSystem { javaVersion = 21; };
jdk22-ea = mkShell blessedSystem { javaVersion = 22; };
default = jdk21;
};
common = forAllSystems
(system:
rec {
default = jdk11;
default = jdk17;
jdk17 = mkShell system { javaVersion = 17; };
jdk11 = mkShell system { javaVersion = 11; };
extraChecks = mkShell system { extraChecks = true; javaVersion = 11; };
jReleaser = mkShell system { release = true; javaVersion = 11; };
jdk21 = mkShell system { javaVersion = 21; };
extraChecks = mkShell system { extraChecks = true; javaVersion = 21; };
jReleaser = mkShell system { release = true; javaVersion = 21; };
});
in
common // { "${blessedSystem}" = common."${blessedSystem}" // blessed; };
Expand Down
2 changes: 1 addition & 1 deletion jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project:
homepage: https://spoon.gforge.inria.fr/
java:
groupId: fr.inria.gforge
version: "11"
version: "17"
inceptionYear: "2015"

release:
Expand Down
2 changes: 1 addition & 1 deletion spoon-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</modules>

<properties>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.release>17</maven.compiler.release>
<runtime.log>target/velocity.log</runtime.log>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputTimestamp>1696689792</project.build.outputTimestamp>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/spoon/metamodel/Metamodel.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ private static Factory createFactory(File spoonJavaSourcesDirectory) {
final Launcher launcher = new Launcher();
launcher.getEnvironment().setNoClasspath(true);
launcher.getEnvironment().setCommentEnabled(true);
launcher.getEnvironment().setComplianceLevel(17);
// // Spoon model interfaces
Arrays.asList("spoon/reflect/code",
"spoon/reflect/declaration",
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/spoon/testing/utils/ModelUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ private ModelUtils() {
}

public static Factory createFactory() {
return new FactoryImpl(new DefaultCoreFactory(), new StandardEnvironment());
StandardEnvironment environment = new StandardEnvironment();
environment.setComplianceLevel(17);
return new FactoryImpl(new DefaultCoreFactory(), environment);
}

/** Utility method for testing: creates the model of `packageName` from src/test/java and returns the CtType corresponding to `className` */
Expand Down

0 comments on commit faf3675

Please sign in to comment.