Skip to content

Commit 82bdf0b

Browse files
committed
Java 25 support
1 parent 8d37dd9 commit 82bdf0b

File tree

4 files changed

+96
-2
lines changed

4 files changed

+96
-2
lines changed

src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
*/
4545
public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
4646

47+
/**
48+
* Groovy 5.0.0-alpha-13 version.
49+
*/
50+
protected static final Version GROOVY_5_0_0_ALPHA13 = new Version(5, 0, 0, "alpha-13");
51+
4752
/**
4853
* Groovy 5.0.0-alpha-11 version.
4954
*/
@@ -64,6 +69,11 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
6469
*/
6570
protected static final Version GROOVY_5_0_0_ALPHA1 = new Version(5, 0, 0, "alpha-1");
6671

72+
/**
73+
* Groovy 4.0.27 version.
74+
*/
75+
protected static final Version GROOVY_4_0_27 = new Version(4, 0, 27);
76+
6777
/**
6878
* Groovy 4.0.24 version.
6979
*/
@@ -234,6 +244,7 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
234244
* <li>22</li>
235245
* <li>23</li>
236246
* <li>24</li>
247+
* <li>25</li>
237248
* </ul>
238249
* Using 1.6 (or 6) or 1.7 (or 7) requires Groovy &gt;= 2.1.3.
239250
* Using 1.8 (or 8) requires Groovy &gt;= 2.3.3.
@@ -252,6 +263,7 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
252263
* Using 22 requires Groovy &gt; 4.0.16 or Groovy &gt; 5.0.0-alpha-3.
253264
* Using 23 requires Groovy &gt; 4.0.21 or Groovy &gt; 5.0.0-alpha-8.
254265
* Using 24 requires Groovy &gt; 4.0.24 or Groovy &gt; 5.0.0-alpha-11.
266+
* Using 25 requires Groovy &gt; 4.0.27 or Groovy &gt; 5.0.0-alpha-13.
255267
*/
256268
@Parameter(property = "maven.compiler.target", defaultValue = "1.8")
257269
protected String targetBytecode;
@@ -548,7 +560,14 @@ protected void verifyGroovyVersionSupportsTargetBytecode() {
548560
}
549561
}
550562

551-
if ("24".equals(targetBytecode)) {
563+
if ("25".equals(targetBytecode)) {
564+
if (groovyOlderThan(GROOVY_4_0_27)) {
565+
throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_24 + " or newer.");
566+
}
567+
if (groovyNewerThan(GROOVY_5_0_0_ALPHA1) && groovyOlderThan(GROOVY_5_0_0_ALPHA13)) {
568+
throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_5_0_0_ALPHA13 + " or newer.");
569+
}
570+
} else if ("24".equals(targetBytecode)) {
552571
if (groovyOlderThan(GROOVY_4_0_24)) {
553572
throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_24 + " or newer.");
554573
}

src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
*/
4747
public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSourcesMojo {
4848

49+
/**
50+
* Groovy 5.0.0-alpha-13 version.
51+
*/
52+
protected static final Version GROOVY_5_0_0_ALPHA13 = new Version(5, 0, 0, "alpha-13");
53+
4954
/**
5055
* Groovy 5.0.0-alpha-11 version.
5156
*/
@@ -66,6 +71,11 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
6671
*/
6772
protected static final Version GROOVY_5_0_0_ALPHA1 = new Version(5, 0, 0, "alpha-1");
6873

74+
/**
75+
* Groovy 4.0.27 version.
76+
*/
77+
protected static final Version GROOVY_4_0_27 = new Version(4, 0, 27);
78+
6979
/**
7080
* Groovy 4.0.24 version.
7181
*/
@@ -231,6 +241,7 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
231241
* <li>22</li>
232242
* <li>23</li>
233243
* <li>24</li>
244+
* <li>25</li>
234245
* </ul>
235246
* Using 1.6 (or 6) or 1.7 (or 7) requires Groovy &gt;= 2.1.3.
236247
* Using 1.8 (or 8) requires Groovy &gt;= 2.3.3.
@@ -249,6 +260,7 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
249260
* Using 22 requires Groovy &gt; 4.0.16 or Groovy &gt; 5.0.0-alpha-3.
250261
* Using 23 requires Groovy &gt; 4.0.21 or Groovy &gt; 5.0.0-alpha-8.
251262
* Using 24 requires Groovy &gt; 4.0.24 or Groovy &gt; 5.0.0-alpha-11.
263+
* Using 25 requires Groovy &gt; 4.0.27 or Groovy &gt; 5.0.0-alpha-13.
252264
*
253265
* @since 1.0-beta-3
254266
*/
@@ -469,7 +481,14 @@ protected void verifyGroovyVersionSupportsTargetBytecode() {
469481
}
470482
}
471483

472-
if ("24".equals(targetBytecode)) {
484+
if ("25".equals(targetBytecode)) {
485+
if (groovyOlderThan(GROOVY_4_0_27)) {
486+
throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_24 + " or newer.");
487+
}
488+
if (groovyNewerThan(GROOVY_5_0_0_ALPHA1) && groovyOlderThan(GROOVY_5_0_0_ALPHA13)) {
489+
throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_5_0_0_ALPHA13 + " or newer.");
490+
}
491+
} else if ("24".equals(targetBytecode)) {
473492
if (groovyOlderThan(GROOVY_4_0_24)) {
474493
throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_24 + " or newer.");
475494
}

src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,34 @@ public void testJava24WithSupportedGroovy5() {
500500
testMojo.verifyGroovyVersionSupportsTargetBytecode();
501501
}
502502

503+
@Test(expected = IllegalArgumentException.class)
504+
public void testJava25WithUnsupportedGroovy() {
505+
testMojo = new TestMojo("4.0.26");
506+
testMojo.targetBytecode = "25";
507+
testMojo.verifyGroovyVersionSupportsTargetBytecode();
508+
}
509+
510+
@Test
511+
public void testJava25WithSupportedGroovy() {
512+
testMojo = new TestMojo("4.0.27");
513+
testMojo.targetBytecode = "25";
514+
testMojo.verifyGroovyVersionSupportsTargetBytecode();
515+
}
516+
517+
@Test(expected = IllegalArgumentException.class)
518+
public void testJava25WithUnsupportedGroovy5() {
519+
testMojo = new TestMojo("5.0.0-alpha-12");
520+
testMojo.targetBytecode = "25";
521+
testMojo.verifyGroovyVersionSupportsTargetBytecode();
522+
}
523+
524+
@Test
525+
public void testJava25WithSupportedGroovy5() {
526+
testMojo = new TestMojo("5.0.0-alpha-13");
527+
testMojo.targetBytecode = "25";
528+
testMojo.verifyGroovyVersionSupportsTargetBytecode();
529+
}
530+
503531
@Test(expected = IllegalArgumentException.class)
504532
public void testUnrecognizedJava() {
505533
testMojo = new TestMojo("2.1.2");

src/test/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojoTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,34 @@ public void testJava24WithSupportedGroovy5() {
530530
testMojo.verifyGroovyVersionSupportsTargetBytecode();
531531
}
532532

533+
@Test(expected = IllegalArgumentException.class)
534+
public void testJava25WithUnsupportedGroovy() {
535+
testMojo = new TestMojo("4.0.26");
536+
testMojo.targetBytecode = "25";
537+
testMojo.verifyGroovyVersionSupportsTargetBytecode();
538+
}
539+
540+
@Test
541+
public void testJava25WithSupportedGroovy() {
542+
testMojo = new TestMojo("4.0.27");
543+
testMojo.targetBytecode = "25";
544+
testMojo.verifyGroovyVersionSupportsTargetBytecode();
545+
}
546+
547+
@Test(expected = IllegalArgumentException.class)
548+
public void testJava25WithUnsupportedGroovy5() {
549+
testMojo = new TestMojo("5.0.0-alpha-12");
550+
testMojo.targetBytecode = "25";
551+
testMojo.verifyGroovyVersionSupportsTargetBytecode();
552+
}
553+
554+
@Test
555+
public void testJava25WithSupportedGroovy5() {
556+
testMojo = new TestMojo("5.0.0-alpha-13");
557+
testMojo.targetBytecode = "25";
558+
testMojo.verifyGroovyVersionSupportsTargetBytecode();
559+
}
560+
533561
@Test(expected = IllegalArgumentException.class)
534562
public void testUnrecognizedJava() {
535563
testMojo = new TestMojo("2.1.2");

0 commit comments

Comments
 (0)