Access Javac API from a standalone javac jar instead of the default JDK runtime#924
Access Javac API from a standalone javac jar instead of the default JDK runtime#924testforstephen wants to merge 715 commits into
Conversation
|
Does the launch configuration or the java command still set the |
|
I removed the |
|
Found this on ClearlyDefined with a score that makes it usable, Update: It is Approved ✔️ |
|
In recent commits, I addressed two issues:
In the latest commit, the DOM resolver already works with the embedded Javac. But for the build support, it still has some problems because the apt plugin is not loaded well. Here are some potential issues to look further.
|
I attempted to convert the I guess this dependency issue is why the javac plugin is set up as a fragment of jdt.core, allowing it to share the same classloader. |
| Fragment-Host: org.eclipse.jdt.core | ||
| Automatic-Module-Name: org.eclipse.jdt.core.javac | ||
| Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=23))" | ||
| Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=17))" |
There was a problem hiding this comment.
See https://ci.eclipse.org/ls/job/jdt-core-incubator/job/PR-924/3/console , this breaks current compilation since some Java 21 features are already adopted in the code. Would 21 be fine?
There was a problem hiding this comment.
yes, it breaks Java 21 usage (e.g. some utility of String and pattern matching). We need to rewrite them with Java 17 compatible way. The purpose here is to make the minimum JDK requirement same as other JDT plugins.
There was a problem hiding this comment.
IMO, at this stage, we should minimize the changes in the code and stick to Java 21 to facilitate progress. When we've adopted nb-javac, then we'll be more easily able to move code back to Java 17. Moreover, m2e already requires Java 21, so JDT-LS already requires Java 21, so trying to go below that won't produce any benefit for JDT-LS nor vscode-java.
There was a problem hiding this comment.
I see redhat.java extension still requires a minimum Java 17 because it stays at m2e@2.6.0. Good to know we're going to upgrade to Java 21.
- This also fixes the quickfix as a result
eg.
```java
Function<Integer, Integer> func = x -> {
System.out.println(x);
};
```
becomes
```java
Function<Integer, Integer> func = x -> {
System.out.println(x);
return x;
};
```
Signed-off-by: David Thompson <davthomp@redhat.com>
Different versions of Java allow different modifiers on interface methods, so ECJ generates slightly different problem ids for each of these cases. Use the compiler settings to determine which to use. This affects the logic of the quick fixes, so it should fix some jdt-ls test cases. Signed-off-by: David Thompson <davthomp@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
hashcode/equals
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com> Fix regression Signed-off-by: Rob Stryker <stryker@redhat.com> Fix regressions Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
…compilation unit Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
Signed-off-by: Rob Stryker <stryker@redhat.com>
43ddedd to
6545d02
Compare
1a69e37 to
786a635
Compare
73d28b4 to
aa8f401
Compare
4082278 to
ebc593c
Compare
11c94f4 to
99440ba
Compare
6dc0d95 to
25a5a08
Compare
b1b4e0e to
309f390
Compare
685330d to
959d707
Compare
2dbfcc7 to
6e1fd32
Compare
0b01689 to
87ead9e
Compare
6d23874 to
c8f8d92
Compare
055e846 to
18452eb
Compare
411dfec to
ac3eb19
Compare
5738537 to
9962d57
Compare
284e150 to
4bae1aa
Compare
4bae1aa to
c00ff74
Compare
dd7aa18 to
fbe5e1a
Compare
2fcc4f8 to
b7970ce
Compare
86c88a2 to
4ccbd95
Compare


This PR tries to introduce a standalone Javac jar from the repository https://github.com/JaroslavTulach/nb-javac for Javac API access within our project. The benefit is that it allows the language server to support latest language features without requiring user to run the language server with the latest JDK.
This PR is an experiment PR, not full ready yet. It faces some issues with new approach, and I open the PR first for suggestions and feedback.