RFR: 8298875: A module requiring "java.base" with flags ACC_SYNTHETIC should be rejected

Jaikiran Pai jpai at openjdk.org
Tue Dec 20 15:21:49 UTC 2022


On Fri, 16 Dec 2022 19:30:24 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> A small oversight with ModuleDescriptor.read when checking the requires table of a Module attribute. The requires entry for java.base should not have ACC_SYNTHETIC set.
> 
> A new test is added. Some of the existing tests used `@Test(expectedExceptions=...)`. I've changed some of these to use assertThrows to narrow it down to method that is expected to throw.

test/jdk/java/lang/module/ModuleDescriptorTest.java line 1364:

> 1362:      * complete set of packages.
> 1363:      */
> 1364:     @Test(expectedExceptions = InvalidModuleDescriptorException.class)

At first I thought you accidentally removed the entire `@Test` annotation instead of just the `expectedExceptions` property. But then this class is annotated with a `@Test` and this method name starts with the `test...`, just like some other existing methods in this class which too don't have a `@Test` annotation. I checked a local run of this test and those other non-annotated methods are currently executed as test methods, which is a good thing. So this change to completely remove the `@Test` is fine.

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

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


More information about the core-libs-dev mailing list