-
Notifications
You must be signed in to change notification settings - Fork 132
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
[JEP 238] Multirelease support #265
Comments
Let's briefly check whether or not there is a connection to #614. I see a bit of contention between your statements:
vs.
So, if we have different source folders with different requirements, wouldn't that bring us back to multiple builds even in the IDE, where each build uses a specific classpath filter a la #614 ? To me this sounds like a situation, where calls to the |
I think I falsely though #614 can be used here but thinking a bit further this won't work out well... so this is probably not related. When I develop a MR jar, I usually have the same Class (CompileUnit?) with different content, you can take a look here for a live example https://github.com/ClickHouse/clickhouse-jdbc/tree/master/clickhouse-http-client/src/main but of course it is not feasible to edit all of them in parallel. Yes,
So what JDT needs to do would be (this is only hypothetical because I'm not familiar enough with JDT internals, I can only tell from Tycho side where we call the batch-compiler for a folder and pass a configured target level):
As mentioned above, there is currently no IDE that support such thing out-of-the-box, so this could be something unique to Eclipse/JDT so it might require some effort, but also very valuable from users point of view. |
I wouldn't call it the "same" class then, but variants of the same class, where each variant sits in a dedicated source folder, right? So source folders seem to be a factor in this (like src/main/java9 and src/main/java11) Everything else you describe looks very similar to my multi-build proposal in #614. Please help me see the difference you are seeing. To extend my pseudo-code sketch:
At (1) I have extended the configuration memento to enable different compiler options per build. At (2) we'd get the configurations for java8, java9, java11 to loop over. At (3) we'd select the source folders to compile in this iteration. At (4) we'd set the correct release version With source folders configured to compile into different target folders we'd compile all versions in one regular IDE build, where the build loop over configurations is generically implemented. In this case I guess the "extension" would be implemented by JDT itself, but it would use the same strategy as we're discussing in #614 , where item (3) above is the key connection. |
Correct, of course such a source folder can also contain classes only for this version, so not each folder must contain a variant, in this example
Yes seems very similar; I just wanted to mention that my idea to solve this issue by enable/disable single items won't work because here we have really different build configs and not a simple on/off...
Probably that's possible as well, you previously said it would be very complex and requires a lot of refactoring and probably can't be done, does this still apply here or do you think it would be manageable even it is some larger task?
Maybe one could even extend this a bit more like this:
WDYT? |
@stephan-herrmann I just noticed that the feature "compile different source folders with different target releases" could be useful here as well: actually the source folder https://github.com/eclipse-jdt/eclipse.jdt.debug/tree/master/org.eclipse.jdt.debug.ui/Snippet%20Support/org/eclipse/jdt/internal/debug/ui/snippeteditor should be compiled with 1.7 even in the IDE, curently this is "enforced" by a javadoc comment: but of course the IDE will happily suggest and compile any Java 17 features... |
JEP 238: Multi-Release JAR Files describes the structure of Multirelease jars and when I add such a jar to my classpath it shows the corresponding selected classes so this looks fine.
Nerveless I have not found yet a way to produce such jar with JDT and maven indicates
We recently have a similar request at m2e where it would be useful to specify different target release.
Because of this I'd like to propose preliminary support for JEP 238 in JDT in the following way:
classpathentry
entry, allow beside a different output folder (what would be required in such a case), to specify the release like this<classpathentry kind="src" output="bin17" path="src17" release="17">
The advantage of this would be, that there is no need to duplicate all settings (so I'm not aiming for different compiler settings for each folder) and map 1:1 for a setup you could use in maven with different executions defined for each release used and thus m2e could also leverage this later on.
The text was updated successfully, but these errors were encountered: