Suppress warning for "inferred to have type '()',"#559
Conversation
| printer.print("_ = environment.interface.CallBooleanMethodA(environment, globalFuture, \(completeMethodID), [jvalue(l: nil)])") | ||
| } else { | ||
| printer.print("let swiftResult$ = \(tryAwaitString) \(placeholderWithoutTry)") | ||
| printer.print("environment = try! JavaVirtualMachine.shared().environment()") |
There was a problem hiding this comment.
no need to move the environment initialization?
There was a problem hiding this comment.
The only difference is whether we write the if statement twice or not.
I was okay with a single line of duplication, but we could also write the if statement twice if preferred.
There was a problem hiding this comment.
I mean, you can keep the printer.print("environment = try! JavaVirtualMachine.shared().environment()") before the if entirely so we don't duplicate the string in both branches
There was a problem hiding this comment.
I thought it would be better not to change the timing of fetching environment as it might span across a suspention point (await).
There was a problem hiding this comment.
Hmm... let's go with this, though arguably before might be safer tbh...
This is a minor improvement to silence a compiler warning in the generated code like below.
Since the generator already checks for
.isVoidat this location, I have slightly adjusted the logic to avoid assigning the result.