Skip to content

Check if superclass or interfaces contain applicable types #2451

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

Merged
merged 2 commits into from
Jul 26, 2023

Conversation

Markoutte
Copy link
Collaborator

Description

Fixes #2450

How to test

Automated tests

Run org.utbot.fuzzing.JavaTypesTest

Manual tests

  1. Try run an example from a bug-report. It should work as expected.
  2. Run modified example below. It should generate 3 tests: with null and other with only BImpl type:
public class Implementations {

    public interface A<T> {
        T getValue();
    }

    public static class AImpl implements A<String> {

        private final String value;

        public AImpl(String value) {
            this.value = value;
        }

        @Override
        public String getValue() {
            return value;
        }
    }

    public static class BImpl implements A<Integer> {

        private final Integer value;

        public BImpl(Integer value) {
            this.value = value;
        }

        @Override
        public Integer getValue() {
            return value;
        }
    }

    public static int test(A<Integer> value) {
        if (value.getValue() < 0) {
            return 0;
        }
        return value.getValue();
    }
}

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@Markoutte Markoutte added comp-fuzzing Issue is related to the fuzzing ctg-bug-fix PR is fixing a bug labels Jul 26, 2023
@Markoutte Markoutte requested a review from IlyaMuravjov July 26, 2023 07:38
@Markoutte Markoutte merged commit 339ef49 into main Jul 26, 2023
@Markoutte Markoutte deleted the pelevin/2450-fix_wrong_implenentation_gathering branch July 26, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-fuzzing Issue is related to the fuzzing ctg-bug-fix PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad test is produced when use concrete classes for implementing interface with generic
2 participants