Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Restricted Identifier Error in Eclipse when using Mockitos when(Eclipse Error Java 21 with Mockitos 'when' method)
Restricted Identifier Error in Eclipse when using Mockitos when [message #1861681] Fri, 27 October 2023 07:49 Go to next message
Volker Gollücke is currently offline Volker GollückeFriend
Messages: 3
Registered: October 2023
Junior Member

Eclipse shows an Error (Syntax error on token "RestrictedIdentifierWhen", delete this token) when using the Mockito when method which is a static import.

Often the error is just shown for the first occurence of a 'when' in a test Method.

If i see it correctly 'when' is only restricted for identifiers in a 'switch case' statement.

Workarround is to use the fully qualified name org.mockito.Mockito.when.

I use the following version:

Eclipse JDT (Java Development Tools) Patch with Java 21 support for 2023-09 development stream 1.2.300.v20230920-0334_BETA_JAVA21 org.eclipse.jdt.java21patch.feature.group Eclipse.org
Re: Restricted Identifier Error in Eclipse when using Mockitos when [message #1861686 is a reply to message #1861681] Fri, 27 October 2023 14:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33264
Registered: July 2009
Senior Member
If you think there is a problem, best to report it here:

https://github.com/eclipse-jdt/eclipse.jdt.core

Please provide sufficient detail (i.e., test case) for someone else to reproduce the problem.

You might want to check that https://www.eclipse.org/downloads/packages/release/2023-12/m2 hasn't already fixed the problem...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Restricted Identifier Error in Eclipse when using Mockitos when [message #1861704 is a reply to message #1861686] Mon, 30 October 2023 08:40 Go to previous messageGo to next message
Volker Gollücke is currently offline Volker GollückeFriend
Messages: 3
Registered: October 2023
Junior Member
Thanks for the info. I followed your advice and filed an issue:
https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1536
Re: Restricted Identifier Error in Eclipse when using Mockitos when [message #1861741 is a reply to message #1861704] Wed, 01 November 2023 07:35 Go to previous message
Volker Gollücke is currently offline Volker GollückeFriend
Messages: 3
Registered: October 2023
Junior Member
Just to inform here:
It is fixed in the actual 2023-12 m2 Version.
Previous Topic:Eclipse Gradle JUnit Test Issue?
Next Topic:Java 21 guarded patterns in switch
Goto Forum:
  


Current Time: Thu Jan 23 08:19:53 GMT 2025

Powered by FUDForum. Page generated in 0.04024 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top