Loosening requirements for super() invocation

Archie Cobbs archie.cobbs at gmail.com
Wed Dec 28 22:31:28 UTC 2022


Following up on the discussion below with some more concrete data...

On Thu, Dec 15, 2022 at 11:00 AM Archie Cobbs <archie.cobbs at gmail.com>
wrote:

> On Wed, Nov 9, 2022 at 12:06 PM Archie Cobbs <archie.cobbs at gmail.com>
> wrote:
>
>> I'll try to come up with a concrete but simple starting point.
>>
>
> It's taken me a little while, but I finally have a prototype for 'this'
> escape warnings ready to play with.
>

Here are some more precise stats on what happens when you enable the 'this'
escape warning for the openjdk build.

The table below shows the number of new 'this' escape warnings generated,
and the total number of Java files, in each module:

#WARNINGS #FILES    MODULE
161       3168      java.base
0         127       java.compiler
0         18        java.datatransfer
62        1848      java.xml
0         18        java.prefs
160       2740      java.desktop
0         10        java.instrument
0         35        java.logging
25        330       java.management
0         30        java.security.sasl
14        106       java.rmi
5         199       java.naming
0         16        java.management.rmi
21        142       java.net.http
0         15        java.scripting
0         5         java.transaction.xa
0         212       java.security.jgss
0         271       java.xml.crypto
0         77        java.sql
7         56        java.sql.rowset
0         1         java.se
0         22        java.smartcardio
3         18        jdk.accessibility
0         60        jdk.internal.jvmstat
0         15        jdk.attach
0         147       jdk.charsets
2         14        jdk.zipfs
55        355       jdk.compiler
0         35        jdk.crypto.ec
0         76        jdk.crypto.cryptoki
4         68        jdk.dynalink
0         3         jdk.internal.ed
0         3         jdk.editpad
19        940       jdk.hotspot.agent
7         59        jdk.httpserver
0         5         jdk.incubator.concurrent
0         50        jdk.incubator.vector
3         104       jdk.internal.le
0         52        jdk.internal.opt
11        209       jdk.internal.vm.ci
0         1         jdk.internal.vm.compiler
0         1         jdk.internal.vm.compiler.management
0         30        jdk.jartool
5         245       jdk.javadoc
0         40        jdk.jcmd
0         24        jdk.management
0         30        jdk.management.agent
30        64        jdk.jconsole
10        139       jdk.jdeps
0         1         jdk.jdwp.agent
24        254       jdk.jdi
0         263       jdk.jfr
0         89        jdk.jlink
0         56        jdk.jpackage
6         97        jdk.jshell
0         4         jdk.jsobject
3         11        jdk.jstatd
0         1873      jdk.localedata
0         15        jdk.management.jfr
0         16        jdk.naming.dns
0         8         jdk.naming.rmi
0         9         jdk.net
0         2         jdk.nio.mapmode
0         11        jdk.random
0         26        jdk.sctp
0         30        jdk.security.auth
0         16        jdk.security.jgss
0         9         jdk.unsupported
0         8         jdk.unsupported.desktop
0         94        jdk.xml.dom

So fortunately it looks feasible to address these with
@SuppressWarnings("this-escape") annotations.

Adding them is probably a good thing in its own right, because they would
serve as new "Heads up for possible 'this' escape" markers in the code
where there were none before, especially because this gotcha can be pretty
hard to spot.

I'll work on refining the 'this' escape patch to use @SuppressWarnings
instead of build flags, and then update this thread when that's done.

-Archie

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20221228/4dfca9fc/attachment-0001.htm>


More information about the amber-dev mailing list