eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
164 stars 130 forks source link

[Patterns] Suspect classification of when as a modifier #3091

Closed srikanth-sankaran closed 2 weeks ago

srikanth-sankaran commented 3 weeks ago

The definitions of org.eclipse.jdt.core.dom.Modifier.WHEN and org.eclipse.jdt.core.dom.Modifier.ModifierKeyword.WHEN_KEYWORD look suspect. It seems DOM APIs treat when as a modifier.

This block of code in org.eclipse.jdt.core.dom.ASTConverter.setModifiers(List, Annotation[], int):

                    case TerminalTokens.TokenNameRestrictedIdentifierWhen:
                        modifier = createModifier(Modifier.ModifierKeyword.WHEN_KEYWORD);
                        break;

looks unreachable.

Are we stuck with these since these are APIs - @jarthana ??

jarthana commented 3 weeks ago

I see them when @noreference. So, they were out of bounds for clients. We can still remove or modify them, I suppose with api filters.