Closed mebigfatguy closed 5 months ago
Hi! Thank you for reporting this problem so quickly. I looked at OpenClover's Java grammar file and I think it fails on the 'final' keyword before the type definition. Could you please rewrite the expression to:
...&& value instanceof List ids
and tell me if it worked?
PR: #238
The problem is fixed now. It will wait until 4.6.0 release, unfortunately. ETA end of March. As a workaround, you can remove the 'final' keyword.
yes it was the final attribute. good call. i can live with that. :)
found another one. Assuming this is caused by the wildcard?
if (binding instanceof FilterableBinding<?> filterBinding) {
From java.g:
|
(INSTANCEOF FINAL type=typeSpec IDENT) =>
INSTANCEOF FINAL type=typeSpec IDENT
|
(INSTANCEOF type=typeSpec IDENT) =>
INSTANCEOF type=typeSpec IDENT
|
INSTANCEOF type=typeSpec
)
;
where typeSpec is:
(
spec = classTypeSpec
|
spec = builtInTypeSpec
)
where classTypeSpec has:
typeSpec = classOrInterfaceType
arrayOpt = arraySpecOpt
and finally classOrInterfaceType has:
(ann=annotation)*
IDENT
(typeArguments)?
Deciphering this :), the pattern matching should allow generic type arguments. Do you have instrumentation error, like previously (e.g. "unexpected token" or similar) or rather a compilation error?
I suspect the latter one. Possibly related with the InstanceOfState detector I just enhanced to handle the 'final' keyword.
I believe the problem is that OpenClover added branch instrumentation to this expression, which caused that the 'filterBinding' from your example lost it's scope (not visible inside { } block).
And yes, removing the <?> is a workaround.
PR #240
Fixed again.
Using the new 4.5.2 version of open-clover, using jdk17, i get errors hitting
i get the error
but i'm assuming it's the instanceof pattern matching at the end of the line