Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executors: add support for Java 17 #914

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]