electronicarts / ea-async

EA Async implements async-await methods in the JVM.
https://go.ea.com/ea-async
Other
1.38k stars 129 forks source link

Error with Arrays #29

Open vasapower opened 6 years ago

vasapower commented 6 years ago

The instrumented code:

public final CompletableFuture<Boolean> call(String longString) {
    String[] split = longString.split(" ");
    String name = split[0];
    String surname = split[1];

    //again...
    name = split[0];
    //...
}

Raises me the following exception:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at it.mvi.core.functionalities.FunctionalitiesHelper.getFunctionality(FunctionalitiesHelper.java:36)
    at it.mvi.core.functionalities.FunctionalitiesManager.executeWork(FunctionalitiesManager.java:128)
    at it.mvi.core.functionalities.FunctionalitiesManager.executeWork(FunctionalitiesManager.java:34)
    at it.mvi.core.functionalities.FunctionalitiesManager.call(FunctionalitiesManager.java:21)
    at com.metaring.homepagecontactformbackend.HomepagecontactformbackendFunctionalitiesManager.contact(HomepagecontactformbackendFunctionalitiesManager.java:16)
    at com.metaring.homepagecontactformbackend.Main.start(Main.java:20)
    at com.metaring.homepagecontactformbackend.Main.main(Main.java:14)
Caused by: java.lang.VerifyError: Inconsistent stackmap frames at branch target 494
Exception Details:
  Location:
    com/metaring/homepagecontactformbackend/ContactFunctionalityImpl.call(Lcom/metaring/homepagecontactformbackend/ContactForm;)Ljava/util/concurrent/CompletableFuture; @494: new
  Reason:
    Type 'java/lang/Object' (current frame, locals[8]) is not assignable to 'java/lang/String' (stack map, locals[8])
  Current Frame:
    bci: @465
    flags: { }
    locals: { 'com/metaring/homepagecontactformbackend/ContactFunctionalityImpl', 'com/metaring/homepagecontactformbackend/ContactForm', 'it/mvi/core/type/factory/DataRepresentationFactory', 'java/lang/String', '[Ljava/lang/String;', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/Object', 'java/lang/String', 'java/lang/String', 'it/mvi/core/type/DataRepresentation', 'java/lang/String', 'it/mvi/core/type/DataRepresentation', 'it/mvi/core/type/DataRepresentation' }
    stack: { 'it/mvi/core/type/DataRepresentation' }
  Stackmap Frame:
    bci: @494
    flags: { }
    locals: { 'com/metaring/homepagecontactformbackend/ContactFunctionalityImpl', 'com/metaring/homepagecontactformbackend/ContactForm', 'it/mvi/core/type/factory/DataRepresentationFactory', 'java/lang/String', '[Ljava/lang/String;', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'it/mvi/core/type/DataRepresentation', 'java/lang/String', 'it/mvi/core/type/DataRepresentation', 'it/mvi/core/type/DataRepresentation' }
    stack: { }
  Bytecode:
  ...

It is raised when the class is loaded into ClassLoader for the first time in application. I am sure that the problem is in that piece of code because I tried a lot of alternatives, and solved using:

List<String> split = Arrays.asList(longString.split(" "));
String name = split.get(0);

//again...
name = split.get(0);

But I want my customers enjoy development experience through my SDK... Can you help, please?