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

Class Instrumentation breaks when local variable set to null #4

Closed paulseawa closed 8 years ago

paulseawa commented 8 years ago

If you initialize a local variable to null, then call an await() within a try catch block, you get ClassNotFoundException on the class in which you did that, during that classes initialization.

Simply by removing the null initialization works around the issue.

  @Async
  public Task<Void> doStuff(Task<Void> otherStuff) {

    String x = null;        //bad
    //String x;             //ok

    try {
      await(otherStuff);
    } catch (Exception e) {
      throw e;
    }
    return Task.done();

  }
JoeHegarty commented 8 years ago

Thanks for the report. @DanielSperry is going to take a look at this shortly.

DanielSperry commented 8 years ago

I'm on it now.

DanielSperry commented 8 years ago

Fixed. Thanks for reporting this @paulseawa

https://github.com/electronicarts/ea-async/commit/538968cb9fd0b0001ebc4664758ff024c6370ae9

The problem would also occur with:

String x = null;
await(task);

and

String x = null;
someMethod(x, await(task));

and

someMethod(null, await(task));

this fix will be in version 1.0.2

JoeHegarty commented 8 years ago

This is resolved in the 1.0.2 release - https://github.com/electronicarts/ea-async/releases/tag/v1.0.2