This repository was archived by the owner on Sep 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +14
-21
lines changed
src/java.base/share/classes/java/lang Expand file tree Collapse file tree 4 files changed +14
-21
lines changed Original file line number Diff line number Diff line change 122
122
* in this class causes a {@link NullPointerException NullPointerException} to
123
123
* be thrown. </p>
124
124
*
125
- * <h2> Example usage: </h2>
125
+ * <h2> Example </h2>
126
126
*
127
127
* <p> This example creates a configuration by resolving a module named
128
128
* "{@code myapp}" with the configuration for the boot layer as the parent. It
129
129
* then creates a new layer with the modules in this configuration. All modules
130
130
* are defined to the same class loader. </p>
131
131
*
132
- * <pre>{@code
132
+ * {@snippet :
133
133
* ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
134
- *
135
134
* ModuleLayer parent = ModuleLayer.boot();
136
- *
137
- * Configuration cf = parent.configuration().resolve(finder, ModuleFinder.of(), Set.of("myapp"));
138
- *
135
+ * Configuration cf = parent.configuration()
136
+ * .resolve(finder, ModuleFinder.of(), Set.of("myapp"));
139
137
* ClassLoader scl = ClassLoader.getSystemClassLoader();
140
- *
141
138
* ModuleLayer layer = parent.defineModulesWithOneLoader(cf, scl);
142
- *
143
139
* Class<?> c = layer.findLoader("myapp").loadClass("app.Main");
144
- * }</pre>
140
+ * }
145
141
*
146
142
* @since 9
147
143
* @see Module#getLayer()
Original file line number Diff line number Diff line change 83
83
* parent configuration. It prints the name of each resolved module and the
84
84
* names of the modules that each module reads. </p>
85
85
*
86
- * <pre>{@code
86
+ * {@snippet :
87
+ * Path dir1 = ..., dir2 = ..., dir3 = ...;
87
88
* ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
88
- *
89
89
* Configuration parent = ModuleLayer.boot().configuration();
90
- *
91
90
* Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("myapp"));
92
91
* cf.modules().forEach(m -> {
93
92
* System.out.format("%s -> %s%n",
96
95
* .map(ResolvedModule::name)
97
96
* .collect(Collectors.joining(", ")));
98
97
* });
99
- * }</pre>
98
+ * }
100
99
*
101
100
* @since 9
102
101
* @see java.lang.ModuleLayer
Original file line number Diff line number Diff line change @@ -1467,13 +1467,14 @@ public Set<String> packages() {
1467
1467
* <cite>The Java Language Specification</cite>. </p>
1468
1468
*
1469
1469
* <p> Example usage: </p>
1470
- * <pre>{@code ModuleDescriptor descriptor = ModuleDescriptor.newModule("stats.core")
1470
+ * {@snippet :
1471
+ * ModuleDescriptor descriptor = ModuleDescriptor.newModule("stats.core")
1471
1472
* .requires("java.base")
1472
1473
* .exports("org.acme.stats.core.clustering")
1473
1474
* .exports("org.acme.stats.core.regression")
1474
1475
* .packages(Set.of("org.acme.stats.core.internal"))
1475
1476
* .build();
1476
- * }</pre>
1477
+ * }
1477
1478
*
1478
1479
* @apiNote A {@code Builder} checks the components and invariants as
1479
1480
* components are added to the builder. The rationale for this is to detect
Original file line number Diff line number Diff line change 54
54
*
55
55
* <p> Example usage: </p>
56
56
*
57
- * <pre>{@code
58
- * Path dir1, dir2, dir3;
59
- *
57
+ * {@snippet :
58
+ * Path dir1 = ..., dir2 = ..., dir3 = ...;
60
59
* ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3);
61
- *
62
60
* Optional<ModuleReference> omref = finder.find("jdk.foo");
63
61
* omref.ifPresent(mref -> ... );
64
- *
65
- * }</pre>
62
+ * }
66
63
*
67
64
* <p> The {@link #find(String) find} and {@link #findAll() findAll} methods
68
65
* defined here can fail for several reasons. These include I/O errors, errors
You can’t perform that action at this time.
0 commit comments