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 — String::indent method - CLI throws "No such field byte coder found in UtString" · Issue #375 · UnitTestBot/UTBotJava

String::indent method - CLI throws "No such field byte coder found in UtString" #375

New issue
Copy link
New issue
Copy link
Closed
#392
Closed
String::indent method - CLI throws "No such field byte coder found in UtString"#375
#392
Copy link
Assignees
dtim
Labels
ctg-bugIssue is a bugIssue is a bugpriority-top-focusTop priority chosen by dev teamTop priority chosen by dev team

Description

@alisevych
alisevych
opened on Jul 1, 2022
Issue body actions

Description

CLI with JDK 13
Class using String::indent method (introduced in Java 12)
CLI throws "No such field byte coder found in org.utbot.engine.overrides.strings.UtString"

To Reproduce

Steps to reproduce the behavior:

  1. Define JDK-13 as primary (Path, JAVA_HOME)
  2. Download one of the latest CLI from master
  3. For simplicity in the folder where utbot-cli*.jar is located :
    Create ExampleString.java using String::indent method (introduced in Java 12)
public class ExampleString {

    public void stringNewMethod() {
        var text = "Hello!\nThis is String used with indent method.";

        text = text.indent(-3);
        System.out.println(text);

        text = text.indent(-5);
        System.out.println(text);
    }
}
  1. Compile your files with JDK-13

javac -version

javac ExampleString.class

  1. Run utbot-cli to generate tests for it, like that:

java -jar utbot-cli-2022.7.jar generate --source ExampleString.java --classpath "D:\Current\Java" -o ExampleStringTest.java ExampleString

Expected behavior

Tests are supposed to be generated.

Actual behavior

There is the following output in console:

var adn String::indent nethod is used (12), compiled and executed with JDK-13


WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
16:03:45.474 | INFO  | AllInMemoryClassProvider | Loaded: 2 path entries, 46 classes, 194922 bytes
16:03:46.718 | INFO  | UtBotTestCaseGenerator | |> Resuming method ExampleString.stringNewMethod()
16:03:47.189 | ERROR | UtBotSymbolicEngine | Test generation failed on stmt $b0 = r0.<java.lang.String: byte coder>, symbolic stack trace:
<java.lang.String: boolean isLatin1()>
<java.lang.String: java.util.stream.Stream lines()>
<java.lang.String: java.lang.String indent(int)>
<ExampleString: void stringNewMethod()>
java.lang.IllegalStateException: No such field byte coder found in org.utbot.engine.overrides.strings.UtString
        at org.utbot.engine.Hierarchy.chunkIdForField(Hierarchy.kt:33) ~[utbot-cli-2022.7.jar:?]
        at org.utbot.engine.UtBotSymbolicEngine.createFieldOrMock(UtBotSymbolicEngine.kt:2217) ~[utbot-cli-2022.7.jar:?]
        at org.utbot.engine.UtBotSymbolicEngine.resolve(UtBotSymbolicEngine.kt:2027) ~[utbot-cli-2022.7.jar:?]
        at org.utbot.engine.UtBotSymbolicEngine.traverseAssignStmt(UtBotSymbolicEngine.kt:1069) ~[utbot-cli-2022.7.jar:?]
        at org.utbot.engine.UtBotSymbolicEngine.traverseStmt(UtBotSymbolicEngine.kt:696) ~[utbot-cli-2022.7.jar:?]
        at org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invokeSuspend(UtBotSymbolicEngine.kt:551) [utbot-cli-2022.7.jar:?]
        at org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invoke(UtBotSymbolicEngine.kt) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:120) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114) [utbot-cli-2022.7.jar:?]
        at org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4$1$1.invokeSuspend(UtBotTestCaseGenerator.kt:447) [utbot-cli-2022.7.jar:?]
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) [utbot-cli-2022.7.jar:?]
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) [utbot-cli-2022.7.jar:?]
        at org.utbot.common.ConcurrencyKt.runBlockingWithCancellationPredicate(Concurrency.kt:38) [utbot-cli-2022.7.jar:?]
        at org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4.invoke(UtBotTestCaseGenerator.kt:279) [utbot-cli-2022.7.jar:?]
        at org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4.invoke(UtBotTestCaseGenerator.kt:56) [utbot-cli-2022.7.jar:?]
        at org.utbot.common.ConcurrencyKt.runIgnoringCancellationException(Concurrency.kt:47) [utbot-cli-2022.7.jar:?]
        at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.generateForSeveralMethods(UtBotTestCaseGenerator.kt:278) [utbot-cli-2022.7.jar:?]
        at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.generateForSeveralMethods$default(UtBotTestCaseGenerator.kt:265) [utbot-cli-2022.7.jar:?]
        at org.utbot.cli.GenerateTestsAbstractCommand.generateTestCases(GenerateTestsAbstractCommand.kt:163) [utbot-cli-2022.7.jar:?]
        at org.utbot.cli.GenerateTestsCommand.run(GenerateTestsCommand.kt:102) [utbot-cli-2022.7.jar:?]
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:204) [utbot-cli-2022.7.jar:?]
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:213) [utbot-cli-2022.7.jar:?]
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:17) [utbot-cli-2022.7.jar:?]
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:396) [utbot-cli-2022.7.jar:?]
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:393) [utbot-cli-2022.7.jar:?]
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:411) [utbot-cli-2022.7.jar:?]
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:436) [utbot-cli-2022.7.jar:?]
        at org.utbot.cli.ApplicationKt.main(Application.kt:31) [utbot-cli-2022.7.jar:?]
16:03:47.236 | INFO  | Summarization | Diversity execution path percentage: 100
16:03:47.236 | INFO  | Summarization | No execution traces found in test case for method ExampleString,     public void stringNewMethod()
    {
        java.io.PrintStream $r0, $r1;
        ExampleString r2;
        java.lang.String r3, r4, r5;

        r2 := @this: ExampleString;

        r3 = "Hello Baeldung!\nThis is Java 12 article.";

        r4 = virtualinvoke r3.<java.lang.String: java.lang.String indent(int)>(-4);

        $r0 = <java.lang.System: java.io.PrintStream out>;

        virtualinvoke $r0.<java.io.PrintStream: void println(java.lang.String)>(r4);

        r5 = virtualinvoke r4.<java.lang.String: java.lang.String indent(int)>(-10);

        $r1 = <java.lang.System: java.io.PrintStream out>;

        virtualinvoke $r1.<java.io.PrintStream: void println(java.lang.String)>(r5);

        return;
    }

Activity

  1. alisevych
    added
    ctg-bugIssue is a bugIssue is a bug
    priority-top-focusTop priority chosen by dev teamTop priority chosen by dev team
    on Jul 1, 2022
  2. alisevych
    assigned
    sergeypospelov
    on Jul 1, 2022
  3. alisevych
    changed the title [-]String::indent (JAVA 12 feature) - CLI throws "No such field byte coder found in UtString"[/-] [+]String::indent method - CLI throws "No such field byte coder found in UtString"[/+] on Jul 1, 2022
  4. dtim
    assigned
    dtim
    and unassigned
    sergeypospelov
    on Jul 2, 2022
  5. alisevych commented on Jul 4, 2022

    @alisevych
    alisevych
    on Jul 4, 2022
    MemberAuthor
    More actions

    Additional context
    IDEA plugin
    JDK 11
    Same error is reproducing for String methods - lines, strip, stripLeading, stripTrailing, repeat, isBlank, ...

  6. dtim
    closed this as completedin #392on Jul 4, 2022
  7. alexeyfridman
    added this to UTBot Javaon Jul 6, 2022
  8. alexeyfridman
    moved this to Todo in UTBot Javaon Jul 6, 2022
  9. JaneEugenia
    moved this from Todo to Done in UTBot Javaon Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dtim
    dtim

Labels

ctg-bugIssue is a bugIssue is a bugpriority-top-focusTop priority chosen by dev teamTop priority chosen by dev team

Type

No type

Projects

  • UTBot Java
    Status
    Done
    Show more project fields

Milestone

No milestone

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.