Skip to content
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

java 21 gives wrong error: Syntax error on token "RestrictedIdentifierWhen" #1573

Closed
mwensveen-ebpi opened this issue Nov 8, 2023 · 2 comments

Comments

@mwensveen-ebpi
Copy link

When using org.mockito.Mockito.when as static import and on the first line of a method Eclipse will show an error:
Syntax error on token "RestrictedIdentifierWhen"

for example (part of the code):

import static org.mockito.Mockito.when;

    public String methodWithBug() {
        when(bug.methodWithBug()).thenReturn("bug");
        return "";
    }

When the when is not the first line of the method no error .
When using the fqn of the when method is used also no error.

When changing to java version 20 there are no compile errors.
bug.zip

See the small attached maven project.

Environment:
new install of eclipse-java-2023-09-R-linux-gtk-x86_64 with the Java 21 Support for Eclipse 2023-09 (4.29) plugin installed from the market place

@iloveeclipse
Copy link
Member

Please check latest 4.30 nightly, it should be fixed.

Closing as duplicate of #456

@mwensveen-ebpi
Copy link
Author

I can confirm that it is fixed in the 4.30 nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants