GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Concrete execution fails for a static method using a static field · Issue #711 · UnitTestBot/UTBotJava

Concrete execution fails for a static method using a static field #711

New issue
Copy link
New issue
Copy link
Closed
#1143
Closed
Concrete execution fails for a static method using a static field#711
#1143
Copy link
Assignees
Markouttetyuldashev
Labels
comp-fuzzingIssue is related to the fuzzingIssue is related to the fuzzingctg-bugIssue is a bugIssue is a bug
Milestone
2022.10.1 Release

Description

@alisevych
alisevych
opened on Aug 11, 2022
Issue body actions

Description

Static method without input parameters is using a static field inside.
Concrete execution fails with "java.lang.IllegalArgumentException: wrong number of arguments"

To Reproduce

Steps to reproduce the behavior:

  1. IntelliJ IDEA with UTBot installed is running.
  2. Turn fuzzing on // File -> Settings -> Tools -> UTbot -> select some middle Code Analysis slider position
  3. Run test generation for the following class:
public class CheckStatic {

    public final static Integer keyValue = 420;

    public static int check() {
        if (keyValue == 0) {
            return keyValue;
        } else {
            return -keyValue;
        }
    }

}

Expected behavior

Tests are supposed to be generated without errors.

Actual behavior

An error test is generated with information about an error in the concrete executor.

Visual proofs (screenshots, logs, images)

Error report:

    public void testCheck_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 4 occurrences of:
        // Default concrete execution failed

    }

Child process error:

Transforming: org/example/CheckStatic
java.lang.IllegalArgumentException: wrong number of arguments
signature=check()I
this=null: org.example.CheckStatic
arguments={
org.example.CheckStatic@1ad9c76c: org.example.CheckStatic
}

	at org.utbot.instrumentation.instrumentation.InvokeInstrumentation.invoke-d1pmJ48(InvokeInstrumentation.kt:77)
	at org.utbot.instrumentation.instrumentation.InvokeInstrumentation.invoke(InvokeInstrumentation.kt:17)
	at org.utbot.instrumentation.instrumentation.Instrumentation$DefaultImpls.invoke$default(Instrumentation.kt:25)
	at org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$$inlined$withReflection$lambda$1$1.invoke(UtExecutionInstrumentation.kt:163)
	at org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$2.invoke(ThreadUtil.kt:56)
	at org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$1.invoke(ThreadUtil.kt:47)
	at org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$1.invoke(ThreadUtil.kt:22)
	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Environment

Windows 10 Pro
Gradle 6.8
JDK 8

Additional context

The example was taken from utbot-sample/src/main/java/org/utbot/examples/mock/CommonMocksExample.java - just added "static" to the clinitMockExample() definition.

Activity

  1. alisevych
    added
    ctg-bugIssue is a bugIssue is a bug
    comp-fuzzingIssue is related to the fuzzingIssue is related to the fuzzing
    on Aug 11, 2022
  2. alisevych
    assigned
    Markoutte
    on Aug 11, 2022
  3. korifey
    added this to UTBot Javaon Aug 11, 2022
  4. korifey
    moved this to Todo in UTBot Javaon Aug 11, 2022
  5. alisevych
    assigned
    SBOne-Kenobi
    and unassigned
    Markoutte
    on Sep 7, 2022
  6. tyuldashev commented on Oct 7, 2022

    @tyuldashev
    tyuldashev
    on Oct 7, 2022
    Collaborator
    More actions

    Currently in main (build 411)
    Empty test is generated and concrete executor log contains exception:

    public class CheckStaticTest {
    }
    Failed to instantiate SLF4J LoggerFactory
    Reported exception:
    java.lang.NoClassDefFoundError: org/utbot/framework/concrete/InstrumentationContext$MockGetter
    	at org.slf4j.LoggerFactory.findPossibleStaticLoggerBinderPathSet(LoggerFactory.java:296)
    	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:146)
    	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
    	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
    	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
    	at mu.KotlinLogging.logger(KotlinLogging.kt:43)
    	at org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$1$1$concreteExecutionResult$1$concreteResult$1.invoke(UtExecutionInstrumentation.kt:342)
    	at org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$2.invoke(ThreadUtil.kt:56)
    	at org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$1.invoke(ThreadUtil.kt:47)
    	at org.utbot.common.ThreadBasedExecutor$invokeWithTimeout$1.invoke(ThreadUtil.kt:43)
    	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)
    Caused by: java.lang.ClassNotFoundException: org.utbot.framework.concrete.InstrumentationContext$MockGetter
    	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    	... 11 more
    
  7. alisevych
    added this to the 2022.10.1 Release milestone on Oct 11, 2022
  8. alisevych commented on Oct 11, 2022

    @alisevych
    alisevych
    on Oct 11, 2022
    MemberAuthor
    More actions

    Reproducing with RC-build: build 417

  9. SBOne-Kenobi
    assigned
    Markoutte
    and unassigned
    SBOne-Kenobi
    on Oct 12, 2022
  10. SBOne-Kenobi commented on Oct 12, 2022

    @SBOne-Kenobi
    SBOne-Kenobi
    on Oct 12, 2022
    Contributor
    More actions

    When our fuzzer meets methods without any parameters, it tries to generate this instance and call static method from this instance as a usual method. @Markoutte, can you fix it?

    Reacted by Maksim Pelevin
  11. Markoutte
    added a commit that references this issue on Oct 12, 2022

    Concrete execution fails for a static method using a static field #711

    950ca32
  12. Markoutte
    closed this as completedin #1143on Oct 12, 2022
  13. Markoutte
    added a commit that references this issue on Oct 12, 2022

    Concrete execution fails for a static method using a static field #711 (

    2551385
  14. Repository owner moved this from Todo to Done in UTBot Javaon Oct 12, 2022
  15. AbdullinAM
    added 2 commits that reference this issue on Oct 17, 2022

    Concrete execution fails for a static method using a static field Uni…

    3c02b0b

    Concrete execution fails for a static method using a static field Uni…

    d36b988
  16. tyuldashev
    self-assigned this
    on Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Markoutte
    Markoutte
  • @tyuldashev
    tyuldashev

Labels

comp-fuzzingIssue is related to the fuzzingIssue is related to the fuzzingctg-bugIssue is a bugIssue is a bug

Type

No type

Projects

  • UTBot Java
    Status
    Done
    Show more project fields

Milestone

  • 2022.10.1 Release

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.