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.
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: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.