Skip to content

Commit

Permalink
Allow for compiling with Java 21 (#4161)
Browse files Browse the repository at this point in the history
* Support Java 17 and 21, default compilation to Java 17 class files,
  use maven.compiler.release instead of source and target
* Add profile "j21" to compile to Java 21 class files
* Upgrade SAT to 0.16.0, adapt code which breaks build with new SAT
  checks
* Use model-specific-profile to pin xtend to Java 17

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
  • Loading branch information
holgerfriedrich authored Apr 1, 2024
1 parent be9cbf2 commit 9f5a60d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void removeSchedule(CronJob s) {
for (Iterator<Cron> cron = crons.iterator(); cron.hasNext();) {
final Cron c = cron.next();

if (c.target == s) {
if (c.target.equals(s)) {
cron.remove();
c.schedule.cancel(true);
}
Expand Down
4 changes: 4 additions & 0 deletions bundles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@
<exists>model.profile-marker</exists>
</file>
</activation>
<properties>
<!-- workaround for Java 21 build, necessary until xtend supports Java 21 -->
<maven.compiler.release>17</maven.compiler.release>
</properties>
<dependencies>
<dependency>
<groupId>org.openhab.core.bom</groupId>
Expand Down
15 changes: 9 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,14 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<oh.java.version>17</oh.java.version>
<maven.compiler.source>${oh.java.version}</maven.compiler.source>
<maven.compiler.target>${oh.java.version}</maven.compiler.target>
<maven.compiler.compilerVersion>${oh.java.version}</maven.compiler.compilerVersion>
<maven.compiler.release>17</maven.compiler.release>

<bnd.version>7.0.0</bnd.version>
<commons.net.version>3.7.2</commons.net.version>
<eea.version>2.3.0</eea.version>
<karaf.compile.version>4.4.5</karaf.compile.version>
<karaf.tooling.version>4.4.5</karaf.tooling.version>
<sat.version>0.15.0</sat.version>
<sat.version>0.16.0</sat.version>
<slf4j.version>2.0.7</slf4j.version>
<xtext.version>2.34.0</xtext.version>
<spotless.version>2.38.0</spotless.version>
Expand Down Expand Up @@ -670,7 +667,7 @@ Import-Package: \\
<configuration>
<rules>
<requireJavaVersion>
<version>[17.0,18.0)</version>
<version>[17.0,18.0),[21.0,22.0)</version>
</requireJavaVersion>
</rules>
</configuration>
Expand Down Expand Up @@ -845,5 +842,11 @@ Import-Package: \\
</pluginManagement>
</build>
</profile>
<profile>
<id>j21</id>
<properties>
<maven.compiler.release>21</maven.compiler.release>
</properties>
</profile>
</profiles>
</project>

0 comments on commit 9f5a60d

Please sign in to comment.