eclipse-aspectj / aspectj

Other
272 stars 82 forks source link

Syntax error on token "RestrictedIdentifierWhen" #263

Closed kriegaex closed 8 months ago

kriegaex commented 8 months ago

This issue was first raised at https://github.com/mojohaus/aspectj-maven-plugin/issues/186, but it is a JDT Core problem:

When using a method name when, as is e.g. common in Mockito, ACJ throws an error like:

[ERROR] Syntax error on token "RestrictedIdentifierWhen", delete this token
(...)
when((Boolean) model.iterator.hasNext()).thenReturn(true).thenReturn(false);
^^^^
[ERROR] The method thenReturn(boolean) is undefined for the type Boolean

Token RestrictedIdentifierWhen is related to guard clauses in switch pattern matching. This problem is said to have been fixed already, compare e.g. https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1518. the to-do for AJC is to merge from upstream JDT Core into our fork and then to test if the problem goes away.

kriegaex commented 8 months ago

Retested and closed by 3bca8528f33a3648f3646aeeb2f0b55576b0fc64.