Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Improve UselessTypeTest.ql #5711

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Marcono1234
Copy link
Contributor

@Marcono1234 Marcono1234 commented Apr 19, 2021

Notable changes:

  • Matches same type being used for expression and type test
  • Improves handling for raw types

Uses options file for tests because parameterized types (e.g. List<String>) are apparently not permitted as tested type in Java 8 but are allowed in later Java versions (maybe when instanceof pattern matching was added?).


Currently the added test has non-source types in the expected test results (e.g. Object.class). CodeQL CLI warns about this and it does not work well for all operating systems (see #5712). While this could in parts be solved by declaring own classes in source and using them instead, it cannot be solved for the array checks.
Should I simply omit those?

@Marcono1234 Marcono1234 requested a review from a team as a code owner April 19, 2021 00:47
@github-actions github-actions bot added the Java label Apr 19, 2021
@Marcono1234 Marcono1234 marked this pull request as draft April 19, 2021 01:48
@Marcono1234 Marcono1234 force-pushed the marcono1234/useless-type-test branch 3 times, most recently from 7b24846 to 8ef64a8 Compare April 19, 2021 02:21
@Marcono1234 Marcono1234 force-pushed the marcono1234/useless-type-test branch from 8ef64a8 to eee4f33 Compare April 19, 2021 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant