jsweet icon indicating copy to clipboard operation
jsweet copied to clipboard

AsyncAwaitPropagation - java.lang.NoSuchFieldException: sym

Open HeithoffM opened this issue 1 year ago • 0 comments

I am trying to use the async await auto propagation feature and sometimes face the following error:
Caused by: java.lang.NoSuchFieldException: sym in the Util class

I narrowed it down to the test case below and the lines in the AsyncAwaitPropagationScanner Link. It seems like the scanner checks if the invocation is the Lang.await method and calls the Util.getElement method. Here, the MethodInvocationTree does not have a field sym, which is searched for, and so when a method invocation is propagated, the Util class just returns an error. I am not sure what the intention is with these lines.

package test;

import jsweet.lang.Async;

public class A {
  public static int a1() {
    return A.a2(A.a3());
  }

  public static int a2(int i) {
    return i;
  }

  @Async
  public static int a3() {
    return 6;
  }
}

HeithoffM avatar Feb 05 '23 17:02 HeithoffM