Skip to content

Commit

Permalink
Clarify comments and exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpaljak committed Mar 15, 2024
1 parent cd38b17 commit 1adb58d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion task/src/main/java/pro/javacard/ant/JCCap.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,14 @@ private void compile() {
// See https://github.com/martinpaljak/ant-javacard/issues/79
int jdkver = Misc.getCurrentJDKVersion();
if (jdkver > 17) {
// JDK 21 can't create 1.7 class files, last version supported by JC kit 3.2
throw new HelpingBuildException("JDK 17 is the latest supported JDK.");
} else if (jckit.getVersion().isOneOf(V211, V212, V221, V222) && jdkver > 8) {
// JDK 8 is the last version capable of creating 1.2 class files, latest version supported by all 2.x JC kits
throw new HelpingBuildException("Use JDK 8 with JavaCard kit v2.x");
} else if (jdkver > 11 && !jckit.getVersion().isOneOf(V310, V320)) {
throw new HelpingBuildException("Use JDK 11 with JavaCard kit " + jckit.getVersion());
// JDK 17+ minimal class file target is 1.7, but need 1.6
throw new HelpingBuildException(String.format("Can't use JDK %d with JavaCard kit %s (use JDK 11)", jdkver, jckit.getVersion()));
}

j.setTarget(javaVersion);
Expand Down
12 changes: 12 additions & 0 deletions tests-1.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
<!-- Different SDK-s-->
<target name="test-sdks">
<javacard>
<!-- JC 3.2.0 -->
<cap jckit="${JC320}" sources="src/testapplets/empty">
<applet class="testapplets.empty.Empty" aid="0102030405060708"/>
</cap>
<!-- JC 3.1.0 -->
<cap jckit="${JC310}" sources="src/testapplets/empty">
<applet class="testapplets.empty.Empty" aid="0102030405060708"/>
</cap>
<!-- JC 3.0.5 -->
<cap jckit="${JC305}" sources="src/testapplets/empty">
<applet class="testapplets.empty.Empty" aid="0102030405060708"/>
</cap>
<!-- JC 3.0.4 -->
<cap jckit="${JC304}" sources="src/testapplets/empty">
<applet class="testapplets.empty.Empty" aid="0102030405060708"/>
Expand Down

0 comments on commit 1adb58d

Please sign in to comment.