In order to prevent a ClassCastException when the child is a Name and the parent is not a ProvidesDirective, this should be || instead of &&.
There is likely no way to reproduce this in Eclipse, since if the error is reported correctly the child should always be a Name and the parent should always be a ProvidesDirective.
See https://github.com/eclipse-jdt/eclipse.jdt.ui/blob/1c68e46548bf6e38f541275ac6197bb4011f56e4/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java#L2653
In order to prevent a
ClassCastException
when the child is aName
and the parent is not aProvidesDirective
, this should be||
instead of&&
.There is likely no way to reproduce this in Eclipse, since if the error is reported correctly the child should always be a
Name
and the parent should always be aProvidesDirective
.I was able to find this bug since I was using https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator, which still has some bugs in the error and AST translation that we are working on fixing.