You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"
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);
}
}
Compile your files with JDK-13
javac -version
javac ExampleString.class
Run utbot-cli to generate tests for it, like that:
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;
}
The text was updated successfully, but these errors were encountered:
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"
Jul 1, 2022
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:
Create ExampleString.java using String::indent method (introduced in Java 12)
javac -version
javac ExampleString.class
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:
The text was updated successfully, but these errors were encountered: