35 import java.lang.module.ModuleDescriptor;
36 import java.lang.module.ModuleFinder;
37 import java.net.URL;
38 import java.net.URLClassLoader;
39 import java.nio.file.Files;
40 import java.nio.file.Path;
41 import java.util.ArrayList;
42 import java.util.List;
43 import java.util.Set;
44
45 import jdk.test.lib.util.ModuleInfoWriter;
46
47 import org.testng.annotations.Test;
48 import static org.testng.Assert.*;
49
50 /**
51 * @test
52 * @enablePreview
53 * @modules java.base/jdk.internal.module
54 * @library /test/lib
55 * @build jdk.test.lib.util.ModuleInfoWriter
56 * @run testng AnnotationsTest
57 * @summary Basic test of annotations on modules
58 */
59
60 public class AnnotationsTest {
61
62 /**
63 * Test that there are no annotations on an unnamed module.
64 */
65 @Test
66 public void testUnnamedModule() {
67 Module module = this.getClass().getModule();
68 assertTrue(module.getAnnotations().length == 0);
69 assertTrue(module.getDeclaredAnnotations().length == 0);
70 }
71
72 /**
73 * Test reflectively reading the annotations on a named module.
74 */
75 @Test
|
35 import java.lang.module.ModuleDescriptor;
36 import java.lang.module.ModuleFinder;
37 import java.net.URL;
38 import java.net.URLClassLoader;
39 import java.nio.file.Files;
40 import java.nio.file.Path;
41 import java.util.ArrayList;
42 import java.util.List;
43 import java.util.Set;
44
45 import jdk.test.lib.util.ModuleInfoWriter;
46
47 import org.testng.annotations.Test;
48 import static org.testng.Assert.*;
49
50 /**
51 * @test
52 * @enablePreview
53 * @modules java.base/jdk.internal.module
54 * @library /test/lib
55 * @run testng AnnotationsTest
56 * @summary Basic test of annotations on modules
57 */
58
59 public class AnnotationsTest {
60
61 /**
62 * Test that there are no annotations on an unnamed module.
63 */
64 @Test
65 public void testUnnamedModule() {
66 Module module = this.getClass().getModule();
67 assertTrue(module.getAnnotations().length == 0);
68 assertTrue(module.getDeclaredAnnotations().length == 0);
69 }
70
71 /**
72 * Test reflectively reading the annotations on a named module.
73 */
74 @Test
|