Skip to content

Commit 4f7325e

Browse files
author
Vincent Potucek
committed
unused code check
1 parent d65c375 commit 4f7325e

File tree

3 files changed

+1
-61
lines changed

3 files changed

+1
-61
lines changed

api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyResolverResult.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -103,44 +103,4 @@ public interface DependencyResolverResult extends Result<DependencyResolverReque
103103
@Nonnull
104104
Map<Dependency, Path> getDependencies();
105105

106-
/**
107-
* Returns the Java module name of the dependency at the given path.
108-
* The given dependency should be one of the paths returned by {@link #getDependencies()}.
109-
* The module name is extracted from the {@code module-info.class} file if present, otherwise from
110-
* the {@code "Automatic-Module-Name"} attribute of the {@code META-INF/MANIFEST.MF} file if present.
111-
*
112-
* <p>A typical usage is to invoke this method for all dependencies having a
113-
* {@link DependencyScope#TEST TEST} or {@link DependencyScope#TEST_ONLY TEST_ONLY}
114-
* {@linkplain Dependency#getScope() scope}. An {@code --add-reads} option may need
115-
* to be generated for compiling and running the test classes that use such dependencies.</p>
116-
*
117-
* @param dependency path to the dependency for which to get the module name
118-
* @return module name of the dependency at the given path, or empty if the dependency is not modular
119-
* @throws IOException if the module information of the specified dependency cannot be read
120-
*/
121-
Optional<String> getModuleName(@Nonnull Path dependency) throws IOException;
122-
123-
/**
124-
* Returns the Java module descriptor of the dependency at the given path.
125-
* The given dependency should be one of the paths returned by {@link #getDependencies()}.
126-
* The module descriptor is extracted from the {@code module-info.class} file if present.
127-
*
128-
* <p>{@link #getModuleName(Path)} is preferred when only the module name is desired,
129-
* because a name may be present even if the descriptor is absent. This method is for
130-
* cases when more information is desired, such as the set of exported packages.</p>
131-
*
132-
* @param dependency path to the dependency for which to get the module name
133-
* @return module name of the dependency at the given path, or empty if the dependency is not modular
134-
* @throws IOException if the module information of the specified dependency cannot be read
135-
*/
136-
Optional<ModuleDescriptor> getModuleDescriptor(@Nonnull Path dependency) throws IOException;
137-
138-
/**
139-
* If the module path contains at least one filename-based auto-module, prepares a warning message.
140-
* The module path is the collection of dependencies associated with {@link JavaPathType#MODULES}.
141-
* It is caller's responsibility to send the message to a logger.
142-
*
143-
* @return warning message if at least one filename-based auto-module was found
144-
*/
145-
Optional<String> warningForFilenameBasedAutomodules();
146106
}

impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolverResult.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -378,18 +378,6 @@ public Map<Dependency, Path> getDependencies() {
378378
return dependencies;
379379
}
380380

381-
@Override
382-
public Optional<ModuleDescriptor> getModuleDescriptor(Path dependency) throws IOException {
383-
Object value = cache.getModuleInfo(dependency).descriptors.get(dependency);
384-
return (value instanceof ModuleDescriptor moduleDescriptor) ? Optional.of(moduleDescriptor) : Optional.empty();
385-
}
386-
387-
@Override
388-
public Optional<String> getModuleName(Path dependency) throws IOException {
389-
return Optional.ofNullable(
390-
name(cache.getModuleInfo(dependency).descriptors.get(dependency)));
391-
}
392-
393381
/**
394382
* Returns the module name for the given value of the {@link PathModularization#descriptors} map.
395383
*/
@@ -403,12 +391,4 @@ private static String name(final Object value) {
403391
}
404392
}
405393

406-
@Override
407-
public Optional<String> warningForFilenameBasedAutomodules() {
408-
try {
409-
return cache.warningForFilenameBasedAutomodules(dispatchedPaths.get(JavaPathType.MODULES));
410-
} catch (IOException e) {
411-
throw new DependencyResolverException("Cannot read module information.", e);
412-
}
413-
}
414394
}

impl/maven-impl/src/main/java/org/apache/maven/impl/PathModularizationCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Optional<PathType> selectPathType(Set<PathType> types, Predicate<PathType> filte
167167
* @return warning message if at least one filename-based auto-module was found
168168
* @throws IOException if an error occurred while reading module information
169169
*/
170-
Optional<String> warningForFilenameBasedAutomodules(Collection<Path> modulePaths) throws IOException {
170+
Optional<String> _warningForFilenameBasedAutomodules(Collection<Path> modulePaths) throws IOException {
171171
if (modulePaths == null) {
172172
return Optional.empty();
173173
}

0 commit comments

Comments
 (0)