I've added support for the CLASSPATH environment variable in InferCon…
…fig.
This change modifies the InferConfig class to allow the Java language server to determine the project's classpath using the CLASSPATH environment variable.
Key changes:
- The
classPath()method inInferConfig.javanow checks for theCLASSPATHenvironment variable first. If set, its value is parsed and used as the classpath. This allows you to override the default classpath discovery mechanisms (Maven, Bazel). -
InferConfig.javawas refactored to allow injection of environment variables for testing purposes. This involved adding a new constructor that accepts a map of environment variables and updating methods that access environment variables to use this injected map. - A new unit test,
classpathFromEnvironmentVariable, was added toInferConfigTest.javato specifically verify the new functionality. This test uses the new constructor to inject a mockCLASSPATHvariable.
All tests in InferConfigTest.java, including the new test, pass.
Note: During testing, I observed three pre-existing test failures in other classes (CompletionsTest.overloadedOnClassPath, FindSrcZipTest.testFindSrcZip, HoverTest.docString). These failures are believed to be unrelated to the changes in this commit and should be investigated separately.
Tests seem not independent. I mentioned it at https://github.com/georgewfraser/java-language-server/pull/313 In this branch all tests passed for me
[INFO] Results: [INFO] [WARNING] Tests run: 227, Failures: 0, Errors: 0, Skipped: 10