-
Notifications
You must be signed in to change notification settings - Fork 869
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 JEP 330 "shebang" headers #1214
Comments
FYI both Visual Studio Code and IntelliJ IDEA don't really like this syntax either (VSC, which uses JDT, just says "Syntax error on tokens, delete these tokens", and IJ says "Shebang mechanism in .java files is not permitted" (which surprised me given that this jetbrains.com post says it should work; but possibly I just couldn't figure out the right language level support Settings). But be that (current Editor support) as it may, per JEP 330 it's still valid Java syntax, so (in a perfect world... 🍭 ) google-java-format should not choke on it. |
FTR This is on v1.25.1, which is the 2nd most recent release today; looking at the 1.25.2 Release Notes, I have no reason to believe that this (just) got fixed. |
I'm not sure that's right, as I understand it JEP 330 is exclusively a Java launcher (
|
Huh, wait... what - really? So @maxandersen just to double check, are we understanding this correctly, or missing anything here? (If we are, then I'll close this issue, but also send you a PR to make this a bit more explicit and clear on the JBang FAQ §6. related to this; because it seems to me that this basically means you would really want to think twice before adopting to use shebang headers... if this is the case, then how can JBang even compile such files?) |
@vorburger correct - java's shebang support is IMO fundementally broken. its why jbang uses /// trick in header to be something that IDE's and tools like google-java-format trips won't trip over as #! at start goes against the Java Language Spec. |
@maxandersen thanks for the clarification. I've sent you jbangdev/jbang#1903. @cushon I'm closing this FYI, as the conversation in this issue have successfully convinced me this is not a good idea. |
I'm toying (more "for fun") with https://openjdk.org/jeps/330 in enola-dev/enola#971:
I am using https://www.jbang.dev, but this issue doesn't really have anything to do with that (JBang) per se:
For the following content of
learnenola.java
which (at least as I understand it) is technically "valid standard Java syntax" per JEP 330:google-java-format
currently fails like this:See also https://www.jbang.dev/documentation/guide/latest/faq.html for some further background if needed.
PS: I've opened another issue #1215 for something that's a separate problem related to "special" (non-shebang)
///
comments.The text was updated successfully, but these errors were encountered: