Object Bug
brr53 opened this issue · 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
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
Please check release 1.2.6 - now your case should work except private ObjectTest(...)
constructor
Thank you!