Skip to content

String concatenation: dynamicinvoke is not implemented - JDK 11 #388

@alisevych

Description

@alisevych

Description

Concatenation of Strings - with "+" operator - with JDK 11. Test generation reports an error in test file:
dynamicinvoke is not implemented "makeConcatWithConstants"

To Reproduce

Steps to reproduce the behavior:

  1. Open IntelliJ IDEA
  2. Plugin is installed
  3. A Maven/Gradle/Idea project with JDK 11 is opened
  4. Add a class using concatenation of Strings (with one stored in a variable) like:
public class StringExample {
    public void output() {
        String example = "Some text";
        System.out.println("Plus " + example);
    }
}

Expected behavior

Tests are supposed to be generated.

Actual behavior

The following test class is generated:

public class StringExampleTest {
    ///region Test suites for executable org.example.StringExample.output


    ///region Errors report for output

    public void testOutput_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 1 occurrences of:
        /* An operation is not implemented: dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String)>("Some text")
        <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("Plus \u0001") */

    }
    ///endregion

    ///endregion

}

Environment

Windows 10 Pro
IntelliJ IDEA 2022.1.3
JDK 11
UTBotJava plugin version

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions