objectionary / objectionary/lints
Defect.version() throws when the Lints-Version manifest attribute is absent
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 14
- Forks
- 39
- Avg merge
- 22h 54m
- Merged PRs (30d)
- 90
Description
Problem
Defect.version() throws an unhandled IllegalArgumentException when the Lints-Version manifest attribute is missing from the classpath — which happens when the library is used as a dependency, repackaged (shaded), or run from an IDE.
Root cause
src/main/java/org/eolang/lints/Defect.java:190-192:
public String version() {
return new Manifests().read("Lints-Version");
}
jcabi-manifests Manifests.read(...) throws IllegalArgumentException ("Attribute 'Lints-Version' not found in MANIFEST.MF") when the attribute is absent. version() is delegated from DfContext.version() (src/main/java/org/eolang/lints/DfContext.java:54-56), so the risk is on the default path — the test DefectTest.returnsVersion passes only because Maven puts the manifest on the classpath.
Minimal example
// run with target/classes (no META-INF/MANIFEST.MF) or a shaded jar
new Defect.Default("x", Severity.ERROR, 1, "text").version(); // throws IllegalArgumentException
Expected behavior
version() should never throw: fall back to an empty string / "unknown" when the attribute is absent, and ideally cache the read once per JVM.
Related
src/main/java/org/eolang/lints/DfContext.java:54-56— the delegation path.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/main/java/org/eolang/lints/Defect.java around version() and review the delegation in src/main/java/org/eolang/lints/DfContext.java. Reproduce the missing-manifest case using target/classes or a shaded jar, then update the relevant test around DefectTest.returnsVersion. Done means Defect.version() returns the documented fallback instead of throwing when Lints-Version is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100