On Thu, 3 Nov 2022 14:45:23 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:

>> make/jdk/src/classes/build/tools/taglet/SealedGraph.java line 106:
>> 
>>> 104:         } catch (FileNotFoundException e) {
>>> 105:             throw new RuntimeException(e);
>>> 106:         }
>> 
>> It's certainly unusual for a taglet `.toString` call to have this sort of 
>> side effect.   It would not the a showstopper, but have you checked whether 
>> this code is just executed once or multiple times?
>
> This is Per's code; I didn't look in detail in it. It does seem to be the 
> correct place, though; it's more like the name of the method is bad, since it 
> overloads the `toString` from `Object`, and gives the wrong impressions of 
> its meaning and usage.
> 
> However, it seems we need change some code to be guaranteed by called only 
> once. Looking into it...

Actually, no, it's fine. According to `toString` documentation:


     * If this taglet supports {@link #isBlockTag block} tags, it will be 
called once
     * for each comment containing instances of block tags, with a list of all 
the instances
     * of the block tag in that comment.


and I just presume we can trust the JDK authors to only add the tag once per 
class.

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

PR: https://git.openjdk.org/jdk/pull/10761

Reply via email to