Skip to content
Closed
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
3 changes: 3 additions & 0 deletions src/main/resources/init-hello.java.qute
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
//DEPS {dep}
{/for}
{#if dependencies.isEmpty()}// //DEPS <dependency1> <dependency2>{/if}
{#if compactSourceFiles}
//JAVA 25+
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not symmetric fix - what if user chose a different java version?

the logic here is that if you run init with Java 25+ wehter available or chosen we generate for that - if anything it should generate //JAVA but its not something we can do reliably.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But isn't it true that it should be at least Java 25? Otherwise it just won't work, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without //JAVA 25+ the generated code does not run on a system with a default JVM of version 24 or less.

If a JVM of version for example 26 is installed, then it will be used to run the script because it matches the JAVA specification of 25+.

Maybe not a perfect solution, but it is better than not having //JAVA 25+.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also works on java22 with preview flags.

I'm just saying we also don't add java 17 when deps require java 17... Should we ?

I'm not super against it but just saying until now we haven't explicitly added //JAVA unless explicitly user asking for it.

Copy link
Copy Markdown
Contributor Author

@wfouche wfouche Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to abide by what you decide.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also works on java22 with preview flags.

The compactSourceFiles is only true for Java 25+

I'm just saying we also don't add java 17 when deps require java 17... Should we ?

Do we have templates that use deps that require Java 17? Then I would say yes we should. But only if we have templates where we have explicitly added those deps. I'm not suggesting we should do any detection or anything. Only straightforward things like have templates or examples where we know the minimum version required.

until now we haven't explicitly added //JAVA

Until now we haven't used any special Java features in our templates, haven't we? In some of our examples we do, but AFAIK those have //JAVA lines.

{/if}

{#if magiccontent}
{magiccontent}
Expand Down
Loading