-
Notifications
You must be signed in to change notification settings - Fork 433
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
'Type Pattern' being reported as an error even though Java source level is above 16 #3721
'Type Pattern' being reported as an error even though Java source level is above 16 #3721
Comments
This might be related to eclipse-jdt/eclipse.jdt.core#2741 . It was fixed about 7 hours ago so maybe we can update and see if this fixes the issue. |
I'm not seeing this behaviour on If you click on the curly brace tooltip on the bottom right corner of the editor, and then hover over the "Configure Java Runtime" link, do you see something like : Specifically that the compliance is JavaSE-17 and that a JRE 1.8 JDK is used for it ? |
I updated to My Java Runtime settings currently look like this: "java.configuration.runtimes": [
{
"name": "JavaSE-17",
"path": "D:/Tools/jdk/jdk-17.0.11+9",
"default": false
},
{
"name": "JavaSE-21",
"path": "D:/Tools/jdk/jdk-21.0.3+9",
"default": false
},
{
"name": "JavaSE-22",
"path": "D:/Tools/jdk/jdk-22.0.1+8",
"default": true
}
], |
@rgrunber I can't reproduce the issue. I have tried Java LS 1.32.0 and pre-release.
|
I don't know if it's a bug or a feature, but the error will be resolved by doing the following: build.gradle // options.compilerArgs.addAll(['--release', '8'])
options.compilerArgs.addAll(['--release', '17']) |
@cypher256 Could you try to add
to your settings.json? |
As far as I know the Java 8 backwards compatibility is required for it to work on Android. I will ask about it to have clear answers. Update: The developer did confirm it's to support 32bits and Android. |
The error is gone! |
@jdneo , could this be some incompatibility between how the gradle build server performs the build and buildship ? |
It has been 2 weeks so far since the last comment, is there any news/idea on the problem? So far the settings (that was previously suggested) to disable the gradle build server does work on removing the error, I wonder does it impact anything important/useful if it's disabled? |
You can read more about the Gradle build server at https://devblogs.microsoft.com/java/announcing-the-build-server-for-gradle-open-source-repository/ . It should play nicely with the vscode-java extension. If |
TBH, I don't know who should be blamed for this issue. I think the behavior that gradle build server sets the source & target level to 1.8 is correct. Due to that
This is the reason why both source and target level is set to 1.8 from gradle build server. What's more, the source level should not be higher than the target level, which is a javac limitation: gradle/gradle#8009 (comment) I don't know why gradle can compile the java code successfully 🤔 |
I can bring this question to our sync meeting with Gradle. Instead of disabling gradle build server, another workaround is that you can change the language level via the project setting page. |
Ok, I understand why the project can compile the new java language features with Yes, it's due to the annotation processor That makes me thinking that whether we should take the |
While modding for the game Mindustry, I noticed that I get the error
The Java feature 'Type Patterns' is only available with source level 16 and above - Java(4195411)
while doing 'Type Pattern' even though thesourceLevel
is set to 17 (see linked mod template repository down below).The explanation for this error might be because
targetLevel
is set to 8 and the--release 8
argument is also added. If you are wondering why it is like that... I do not know but one of the dependecy,jabel
(https://github.com/Anuken/jabel), is supposed to make the Java 17 features be retro compatible with Java 8.Environment
Steps To Reproduce
gradle jar
or./grawled jar
, it should be succesful.Current Result
The 'Type Pattern' are being reported as an error, even though it builds fine (and run fine in-game too, but I don't expect you to bother trying.)
Expected Result
The 'Type Pattern' to not be reported as an error, or at least be able to ignore the error.
Additional Informations
Due to the specific situation, it might not be possible to fix this, so maybe adding the option to ignore error is a possible way if it's possible for you to do.
The text was updated successfully, but these errors were encountered: