tascalate-async-await icon indicating copy to clipboard operation
tascalate-async-await copied to clipboard

Object Bug

Open brr53 opened this issue 2 years ago • 3 comments

Dear @vsilaev , thank you again for the great work on Tascalate!

I've noticed a small bug which I have not been able to locate the error in the source for. Here is the code to reproduce the result:

Java version: 11

  public class ObjectTest {
    public ObjectTest() {
  
    }
  
    public static void main(String[] args) {
      new ObjectTest().test2();
    }
  
    @async
    CompletionStage<String> test1() {
      return CallContext.async("hello");
    }
  
    @async
    void test2() {
      var s = await(test1());
      System.out.println(s);
      var tempObject = new ObjectTest(); //breaks
    }
  }

I get the following error when initializing an object of the same class.

Error: Unable to initialize main class asynctest.ObjectTest Caused by: java.lang.VerifyError: Bad operand type when invoking Exception Details: Location: asynctest/ObjectTest.access$0(Lasynctest/ObjectTest;)V @1: invokespecial Reason: Invalid type: 'asynctest/ObjectTest' (current frame, stack[0]) Current Frame: bci: @1 flags: { } locals: { 'asynctest/ObjectTest' } stack: { 'asynctest/ObjectTest' } Bytecode: 0000000: 2ab7 0012 b1

brr53 avatar May 28 '23 11:05 brr53

Confirmed. In next release I will fix the case for PUBLIC/PROTECTED/PACKAGE-PRIVATE constructors. I will address PRIVATE constructors in one of the following releases

vsilaev avatar May 29 '23 11:05 vsilaev

Please check release 1.2.6 - now your case should work except private ObjectTest(...) constructor

vsilaev avatar May 29 '23 19:05 vsilaev

Thank you!

brr53 avatar May 30 '23 14:05 brr53