Skip to content

Commit 93d23eb

Browse files
committed
Remove unneeded Scheme#supportsFilename feature
We always infer schemes from file content, not filename.
1 parent 1df4a5e commit 93d23eb

File tree

7 files changed

+1
-47
lines changed

7 files changed

+1
-47
lines changed

CLAUDE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ mvn clean package
7575
- Implementations discovered via ServiceLoader and managed by `Builders` utility class
7676
- **Scheme**: Interface for configuration file format detection and parsing
7777
- Implementations: `PixiTomlScheme`, `EnvironmentYmlScheme`, `PyProjectTomlScheme`, `RequirementsTxtScheme`
78-
- Methods: `name()`, `supportsFilename(filename)`, `supportsContent(content)`, `priority()`
78+
- Methods: `name()`, `supportsContent(content)`, `priority()`
7979
- Implementations discovered via ServiceLoader and managed by `Schemes` utility class
8080
- **SharedMemory**: Platform-agnostic shared memory interface
8181
- Platform implementations: `ShmLinux`, `ShmMacOS`, `ShmWindows`
@@ -100,7 +100,6 @@ The project uses Java's ServiceLoader mechanism for extensibility, with utility
100100
- Factories cached and sorted by priority
101101

102102
- **Schemes** (`org.apposed.appose.scheme.Schemes`) - Configuration file format detection
103-
- `fromFilename(filename)` - Detect scheme from filename (e.g., "pixi.toml" → PixiTomlScheme)
104103
- `fromContent(content)` - Detect scheme from file contents
105104
- `fromName(name)` - Get scheme by name (e.g., "pixi-toml")
106105
- Schemes sorted by priority for correct detection order

src/main/java/org/apposed/appose/Scheme.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,4 @@ public interface Scheme {
8787
* @return {@code true} if this scheme supports the content format
8888
*/
8989
boolean supportsContent(String content);
90-
91-
/**
92-
* Tests whether this scheme can handle a file with the given filename.
93-
* <p>
94-
* Implementations should check file extensions or exact names.
95-
* </p>
96-
*
97-
* @param filename The filename to test
98-
* @return {@code true} if this scheme supports files with this name
99-
*/
100-
boolean supportsFilename(String filename);
10190
}

src/main/java/org/apposed/appose/scheme/EnvironmentYmlScheme.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,4 @@ public boolean supportsContent(String content) {
7979
trimmed.startsWith("dependencies:") ||
8080
trimmed.matches("(?s)^[a-z_]+:\\s*.*");
8181
}
82-
83-
@Override
84-
public boolean supportsFilename(String filename) {
85-
// TODO
86-
return false;
87-
}
8882
}

src/main/java/org/apposed/appose/scheme/PixiTomlScheme.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,4 @@ public boolean supportsContent(String content) {
8686
return trimmed.contains("[dependencies]") ||
8787
trimmed.contains("[pypi-dependencies]");
8888
}
89-
90-
@Override
91-
public boolean supportsFilename(String filename) {
92-
return filename.endsWith("pixi.toml");
93-
}
9489
}

src/main/java/org/apposed/appose/scheme/PyProjectTomlScheme.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,4 @@ public boolean supportsContent(String content) {
102102
trimmed.contains("[project.dependencies]") ||
103103
trimmed.matches("(?s).*\\[project\\].*dependencies\\s*=.*");
104104
}
105-
106-
@Override
107-
public boolean supportsFilename(String filename) {
108-
return filename.endsWith("pyproject.toml");
109-
}
110105
}

src/main/java/org/apposed/appose/scheme/RequirementsTxtScheme.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,4 @@ public boolean supportsContent(String content) {
6969
// Optionally followed by version specifiers.
7070
return trimmed.matches("(?s)^[a-zA-Z0-9_-]+(==|>=|<=|~=|!=)?.*");
7171
}
72-
73-
@Override
74-
public boolean supportsFilename(String filename) {
75-
return filename.endsWith("requirements.txt");
76-
}
7772
}

src/main/java/org/apposed/appose/scheme/Schemes.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,4 @@ public static Scheme fromName(String name) {
8383
if (result != null) return result;
8484
throw new IllegalArgumentException("Unknown scheme: " + name);
8585
}
86-
87-
/**
88-
* Infers the scheme from a filename.
89-
*
90-
* @param filename The filename
91-
* @return The matching scheme
92-
* @throws IllegalArgumentException If scheme cannot be inferred from filename
93-
*/
94-
public static Scheme fromFilename(String filename) {
95-
Scheme result = Plugins.find(ALL, scheme -> scheme.supportsFilename(filename));
96-
if (result != null) return result;
97-
throw new IllegalArgumentException("Cannot infer scheme from filename: " + filename);
98-
}
9986
}

0 commit comments

Comments
 (0)