You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encountered some strange scenarios where class methods appear to be executed twice, but only in statements where a new class is instantiated and the method is run.
it seem this condition cause the problem NewObjectNode.getReducedValueAccelerated
it's commented /** * Check to see if the optimizer actually produced the object during optimization. If so, * we return that value now. */
so if called in chain like new Foo().baz(); and baz() return value is null or void type
it will treat as optimizer actually not produced the object during optimization, and call newObjectOptimizer.getValue(ctx, thisValue, factory) later.
as a workaround, we can call foo = new Foo(); and then foo.baz()
or remove the optimizer.getResultOptPass() condition maybe ok?
Sounds good. I've used the workaround approach in a few places, but I feel like the optimizer should be aware of "side effects" from constructors and methods.
I have encountered some strange scenarios where class methods appear to be executed twice, but only in statements where a new class is instantiated and the method is run.
Consider
Foo.java
And a basic
Main.java
I would expect methods
bar
,baz
, andqux
to each be called 2 times, butbaz
andqux
have been called 3 times.These two lines result in their methods being called twice.
The text was updated successfully, but these errors were encountered: