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

Support for Java Shell scripts? #1412

Open
mrcalvin opened this issue Dec 4, 2023 · 3 comments
Open

Support for Java Shell scripts? #1412

mrcalvin opened this issue Dec 4, 2023 · 3 comments
Labels
enhancement Issue/PR that involves features, improvements and other changes language PR / Issue deals (partly) with new and/or existing languages for JPlag major Major issue/feature/contribution/change

Comments

@mrcalvin
Copy link

mrcalvin commented Dec 4, 2023

Hi!

Thank you for your great work!

I have the need for running JPlag on Java Shell scripts (JEP 222). Right now, Java processing fails with numerous:

Parser - Assignment1.jshell:106: error: class, interface, enum, or record expected

How can I make these artifacts processed correctly? Wrapping into some class/... harness won't work (e.g., because of freestanding methods). Can JavaC be instructed?

Thank you!
Stefan

@tsaglam
Copy link
Member

tsaglam commented Dec 6, 2023

Good question. We do not exclude Java Shell scripts by design. It is probably an underlying issue of the JavaC API, and I am unsure if it supports them. Wrapping would have been my first suggestion as a hotfix. We will take a look at it, but I cannot promise that there will be a fast solution. If you could send us example files for reproduction, that would help (e.g. via [email protected]).

@tsaglam tsaglam added enhancement Issue/PR that involves features, improvements and other changes major Major issue/feature/contribution/change language PR / Issue deals (partly) with new and/or existing languages for JPlag labels Dec 6, 2023
@mrcalvin
Copy link
Author

mrcalvin commented Dec 6, 2023

Hi! Thx for your reply. In fact, one would have use the parser specific to Java Shell (ReplParser), which packs a shell snippet into a complete compilation unit (JCCompilationUnit) to be further processed by JavaC API. I suspect it would be fine to integrate with ReplParser, in one way or the other, in the JavacAdapter. I'd prefer an integration with the existing java language module, rather spinning another off. This is because I need to check mixed code bases (student assignments, some JShell, some pure).

One option could be to provide an alternative parsing route in response to catching the above JavaC exception, e.g., by calling out to ReplParser in executeCompilationTask?

If you provided some guidance (design-wise), I could offer my take on it? I'd build test cases using the JShell collection of test data.

@tsaglam
Copy link
Member

tsaglam commented Mar 27, 2024

Sorry for the late reply, it seems like I overlooked your answer. An integration in the Java module would indeed be preferable. Catching this particular exception would be okay, iff we can ensure that we only act on the specific exceptions.
If you want you can provide a PR and we can guide you on JPlag-specific design decisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue/PR that involves features, improvements and other changes language PR / Issue deals (partly) with new and/or existing languages for JPlag major Major issue/feature/contribution/change
Projects
None yet
Development

No branches or pull requests

2 participants