RFR: 8343802: Prevent NULL usage backsliding [v2]

Nizar Benalla nbenalla at openjdk.org
Wed Feb 5 20:16:58 UTC 2025


On Wed, 5 Feb 2025 18:42:51 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   update based on feedback
>
> test/hotspot/jtreg/TEST.groups line 47:
> 
>> 45:   gc
>> 46: 
>> 47: hotspot_null_check = \
> 
> Where is this used?

It was unused, I've fixed it.

> test/hotspot/jtreg/sources/TestNoNULL.java line 47:
> 
>> 45:     private static final Set<String> excludedTestFiles = new HashSet<>();
>> 46:     private static final Set<String> excludedTestExtensions = Set.of(".c", ".java", ".jar");
>> 47:     private static final Pattern NULL_PATTERN = Pattern.compile("\\bNULL\\b");
> 
> I don't think this is the right pattern to use.  See the description in JDK-8343802 for the pattern I think
> should be used.

I remember running into some false positives when using it, but I don't see them anymore so it may have been an issue on my end.

Fixed in [ae3c9eb](https://github.com/openjdk/jdk/pull/23466/commits/ae3c9ebaef6fbbacdebbc1687bd41e1f3ac07df7)

> test/hotspot/jtreg/sources/TestNoNULL.java line 103:
> 
>> 101:             public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
>> 102:                 if (isIncluded(file, excludedFiles, excludeExtensions)) {
>> 103:                     files.add(file);
> 
> Why collect files to be checked, rather than just checking them here?

Simply a matter of preference, I prefer to split programs into smaller bits.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23466#discussion_r1943605306
PR Review Comment: https://git.openjdk.org/jdk/pull/23466#discussion_r1943604757
PR Review Comment: https://git.openjdk.org/jdk/pull/23466#discussion_r1943605848


More information about the hotspot-dev mailing list