Java: Fix incorrect CSV models; add validation predicate #7034
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a proof of concept query predicate for validating the data of CSV models, detecting incorrect or improvable CSV rows.
For example:
java.net;URI;false;toASCIIString
row)I have marked this pull request as draft for now to get some feedback; maybe there is already an effort to add such validation (or it already exists elsewhere?).
Usage (VS Code extension):
CsvDataValidation::checkRowData
and run "CodeQL: Quick Evaluation"In the following unchecked checkboxes represent not yet implemented checks.
Reported errors:
subtypes
value)subtypes=true
for Annotated()
but usingArgument[0]
Argument[-1]
as input or output when signature only matches static methodsReturnValue
as output for constructor (should useArgument[-1]
instead?) or method without return valueReported warnings:
subtypes=true
for non-subclassable typesubtypes=true
for non-overridable membersubtypes=false
for interfacesubtypes=false
for method which has an overridesubtypes=false
for type which has publicly visible subtypesubtypes=true
already existsArgument[>=0]
make sure parameter types are non-primitive or wrapper (since they are usually not modelled))Collection<E>
), then should consider all publicly visible 'factory methods' which have a type variable, use that for a parameter (directly or in parameterized type, array, ...) and return (subtype of) generic type mentioned above (e.g.Collections.singletonList(E) -> List<E>
)MyList<X> implements List<X>
should track methods usingX
)Reported notes:
subtypes=true
for type without public subtypessubtypes=false
for abstract type which can be overridden