Skip to content

Commit

Permalink
executors: add support for Java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyene committed Sep 15, 2021
1 parent 0879113 commit 6dd3f95
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The DMOJ judge does **not** need a root user to run on Linux machines: it will r
Supported languages include:
* C++ 11/14/17/20 (GCC and Clang)
* C 99/11
* Java 8/9/10/11/15
* Java 8/9/10/11/15/17
* Python 2/3
* PyPy 2/3
* Pascal
Expand Down
37 changes: 37 additions & 0 deletions dmoj/executors/JAVA17.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from dmoj.executors.java_executor import JavacExecutor


class Executor(JavacExecutor):
compiler = 'javac17'
vm = 'java17'
name = 'JAVA17'
jvm_regex = r'java-17-|openjdk17'

test_program = '''\
import java.io.IOException;
sealed interface IORunnableInterface permits IORunnable {
public void run() throws IOException;
}
final class IORunnable implements IORunnableInterface {
public void run() throws IOException {
System.out.print("""
""".strip());
var buffer = new byte[4096];
int read;
while ((read = System.in.read(buffer)) >= 0)
System.out.write(buffer, 0, read);
}
}
public class self_test {
public static void main(String[] args) throws IOException {
new IORunnable().run();
}
}'''

def get_compile_args(self):
return [self.get_compiler(), '-encoding', 'UTF-8', self._code]

0 comments on commit 6dd3f95

Please sign in to comment.