RFR: 8271254: javac generates unreachable code when using empty semicolon statement [v2]

Guoxiong Li gli at openjdk.java.net
Tue Sep 14 05:36:39 UTC 2021


On Mon, 13 Sep 2021 17:18:12 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove the new parameter
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java line 1517:
> 
>> 1515:          *  @param actualTry Identify try or synchronized statement, true for try and false for synchronized.
>> 1516:          */
>> 1517:         void genTry(JCTree body, List<JCCatch> catchers, Env<GenContext> env, boolean actualTry) {
> 
> I don't think you really need an additional argument, I think that you can check for the tree at the `env` argument and you should be able to find out if this method is being invoked from a `try` or not. Kind of:
> 
> boolean actualTry = env.tree.hasTag(TRY);

@vicente-romero-oracle you are right. I updated the code just now by using the `env` instead of the new parameter.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5495


More information about the compiler-dev mailing list