https://github.com/parttimenerd/check-language-version
Check which Java language level files in your project need
https://github.com/parttimenerd/check-language-version
java
Last synced: 5 months ago
JSON representation
Check which Java language level files in your project need
- Host: GitHub
- URL: https://github.com/parttimenerd/check-language-version
- Owner: parttimenerd
- Created: 2026-01-23T14:38:37.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-03-04T01:00:23.000Z (5 months ago)
- Last Synced: 2026-03-04T05:35:44.769Z (5 months ago)
- Topics: java
- Language: Java
- Homepage: https://mostlynerdless.de/java-game/
- Size: 1.15 MB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Check-Language-Version
======================
A tiny program to check which Java language versions
the files in a directory are using.
This is truely approximate and ignores most used standard library APIs,
it just focuses on syntax.
This is also the base for a [game](./game/README.md).
Usage
-----
```bash
java -jar target/check-language-version.jar --help
Usage: check-language-version [-hjsvV] [...] [COMMAND]
Check the minimum Java language version required for Java source files
[...] Java source files or directories to check
-h, --help Show this help message and exit.
-j, --json Output results in JSON format
-s, --summary Show summary of all files
-v, --verbose Show verbose output
-V, --version Print version information and exit.
Commands:
summary Show a summary table of Java versions from JSON output files
```
Known Limitations
-----------------
JavaParser fails to parse some valid Java files.
It's all just an approximation.
The matching of library features is limited, as we can only
do type based checking, as we're not doing any semantic analysis.
An example is the detection of Loom features like virtual threads,
as they are used via methods and not via extra classes.
Building
--------
```shell
mvn package
```
Or with GraalVM native image support:
```shell
./build-native-image.sh
```
Testing
-------
```shell
mvn test
```
To test also test that the test Java files compile, run:
```shell
mvn test -Dtest=FeatureDetectionTest -Dtest.compilation=true
```
To run the network-dependent link-check test (skipped by default):
```shell
mvn test -Dtest=FeatureMarkdownLinksTest -DrunLinkChecks=true
```
Visualization
-------------
```bash
python3 visualize.py output.json bla.json --output-dir test_split_bars --open
```
License
-------
Apache License 2.0