Skip to content

Commit 6bbe8e8

Browse files
committed
Fix comment
1 parent 176ab80 commit 6bbe8e8

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,5 +660,11 @@ public final class Constants {
660660
*/
661661
public static final String MAVEN_LOGGER_LOG_PREFIX = MAVEN_LOGGER_PREFIX + "log.";
662662

663+
/**
664+
* System property to keep temp material for diagnostics.
665+
*
666+
*/
667+
public static final String KEEP_PROP = "maven.tempfile.keep";
668+
663669
private Constants() {}
664670
}

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,49 @@
2121
import java.io.IOException;
2222
import java.nio.file.Path;
2323

24+
import org.apache.maven.api.Service;
2425
import org.apache.maven.api.Session;
26+
import org.apache.maven.api.annotations.Nonnull;
2527

2628
/**
2729
* Service to create and track temporary files/directories for a Maven build.
2830
* All created paths are deleted automatically when the session ends.
2931
*/
30-
public interface TempFileService {
32+
public interface TempFileService extends Service {
3133

3234
/**
3335
* Creates a temp file in the default temp directory.
3436
*/
37+
@Nonnull
3538
Path createTempFile(Session session, String prefix, String suffix) throws IOException;
3639

3740
/**
3841
* Creates a temp file in the given directory.
3942
*/
43+
@Nonnull
4044
Path createTempFile(Session session, String prefix, String suffix, Path directory) throws IOException;
4145

4246
/**
4347
* Creates a temp directory in the default temp directory.
4448
*/
49+
@Nonnull
4550
Path createTempDirectory(Session session, String prefix) throws IOException;
4651

4752
/**
4853
* Creates a temp directory in the given directory.
4954
*/
55+
@Nonnull
5056
Path createTempDirectory(Session session, String prefix, Path directory) throws IOException;
5157

5258
/**
5359
* Registers an externally created path for cleanup at session end.
5460
*/
61+
@Nonnull
5562
void register(Session session, Path path);
5663

5764
/**
5865
* Forces cleanup for the given session (normally called by lifecycle).
5966
*/
67+
@Nonnull
6068
void cleanup(Session session) throws IOException;
6169
}

impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultTempFileService.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.apache.maven.internal.impl;
2020

21+
import static org.apache.maven.api.Constants.KEEP_PROP;
22+
2123
import javax.inject.Inject;
2224
import javax.inject.Named;
2325
import javax.inject.Singleton;
@@ -52,8 +54,7 @@ public final class DefaultTempFileService implements TempFileService {
5254

5355
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultTempFileService.class);
5456

55-
// System property to keep temp material for diagnostics.
56-
private static final String KEEP_PROP = "maven.tempfile.keep";
57+
5758

5859
// unique, typed session key (uses factory; one narrow unchecked cast)
5960
@SuppressWarnings({"unchecked", "rawtypes"})
@@ -64,11 +65,6 @@ public final class DefaultTempFileService implements TempFileService {
6465
private static final Supplier<Set<Path>> TMP_SUPPLIER =
6566
() -> Collections.newSetFromMap(new ConcurrentHashMap<Path, Boolean>());
6667

67-
@Inject
68-
public DefaultTempFileService() {
69-
// default
70-
}
71-
7268
@Override
7369
public Path createTempFile(final Session session, final String prefix, final String suffix) throws IOException {
7470
Objects.requireNonNull(session, "session");

0 commit comments

Comments
 (0)