Skip to content

Absent class name in static constant usage #300

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

Closed
CaelmBleidd opened this issue Jun 24, 2022 · 1 comment · Fixed by #611
Closed

Absent class name in static constant usage #300

CaelmBleidd opened this issue Jun 24, 2022 · 1 comment · Fixed by #611
Assignees
Labels
comp-codegen Issue is related to code generator ctg-bug Issue is a bug

Comments

@CaelmBleidd
Copy link
Member

Description

If we generate tests using the contest estimator for com.google.common.base.CaseFormat, we will see that the resulting file does not compile because of absent class name in static constant usage: expectedFinalCaseFormat = .UPPER_CAMEL.

To Reproduce

Steps to reproduce the behavior:

  1. Run the contest estimator for com.google.common.base.CaseFormat with 300s time limit
  2. Open generated file

Expected behaviour

Compilable file.

Actual behaviour

Generated file does not compile.

Visual proofs (screenshots, logs, images)
image

Environment

The default environment for the contest estimator.

Additional context

There is no additional context.

@CaelmBleidd CaelmBleidd added ctg-bug Issue is a bug comp-codegen Issue is related to code generator labels Jun 24, 2022
@CaelmBleidd CaelmBleidd moved this to Todo in UTBot Java Jun 24, 2022
@EgorkaKulikov
Copy link
Collaborator

EgorkaKulikov commented Jul 8, 2022

This issue is now blocked by
#457
and
#459

dtim added a commit that referenced this issue Jul 29, 2022
Historically `UtEnumConstModel` and `UtClassRefModel` have been
processed not as other reference models but in a special way,
more like to primitive types. This approach leads to several
problems, especially to class cast errors when processing generic
collections with enums or class references as elements.

This commit makes `UtEnumConstModel` and `UtClassRefModel` subtypes of
`UtReferenceModel`.

  * Concrete executor is modified to respect the identity of static
    fields to avoid rewriting enum values and `Class<?>` instances.

  * Special processing for enums is implemented.
    When a new enum value is created, or an `Object` is being cast
    to the enum type, static values for the enum class are initialized,
    and the set of hard constraint is added to require that the new
    instance has the same address and ordinal as any one of enum
    constants to implement reference equality for enums.

Fixes #414, #230, #300
@dtim dtim closed this as completed in #611 Aug 4, 2022
Repository owner moved this from Todo to Done in UTBot Java Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-codegen Issue is related to code generator ctg-bug Issue is a bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants