- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6
feat: java 8 compatibility #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit b608bfd.
| 
 | 
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 21914599 | Triggered | Generic High Entropy Secret | b608bfd | src/test/java/com/infisical/sdk/InfisicalSdkTest.java | View secret | 
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Successfully adds Java 8 compatibility by replacing modern Java syntax with legacy equivalents. The PR systematically addresses Java 8 compatibility across the entire codebase.
Key changes:
- Replaced varkeyword with explicit type declarations throughout all source and test files
- Replaced Java 9+ Map.of()andMap.ofEntries()withHashMapandCollectionsAPIs
- Changed List.getFirst()toList.get(0)for Java 8 compatibility
- Updated URLEncoder.encode()andURLDecoder.decode()to use charset name strings instead ofCharsetobjects
- Downgraded logback dependencies from 1.5.19 to 1.3.14 and slf4j from 2.1.0 to 2.0.9 for Java 8 support
- Changed Maven compiler configuration from Java 21 to Java 8
The author reports successful testing on both Java 21 and Java 8.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- All changes are straightforward syntax replacements for Java 8 compatibility with no logic modifications. The transformations follow standard patterns for backporting modern Java code, and the author has tested functionality on both Java 8 and Java 21.
- No files require special attention - all changes are mechanical syntax replacements
Important Files Changed
File Analysis
| Filename | Score | Overview | 
|---|---|---|
| pom.xml | 4/5 | Changed compiler target from Java 21 to Java 8, downgraded logging dependencies to Java 8-compatible versions. Potential concern: java.versionproperty still set to 21 while compiler targets 8. | 
| src/main/java/com/infisical/sdk/auth/AwsAuthProvider.java | 5/5 | Replaced Java 9+ features: Map.of()withHashMap,.getFirst()with.get(0),URLEncoder.encode(String, Charset)with charset name string. Proper Java 8 compatible implementations. | 
| src/test/java/com/infisical/sdk/auth/AwsAuthProviderTest.java | 5/5 | Replaced Java 9+ features in tests: Map.of()withHashMap, diamond operator with explicit types,URLDecoder.decode(String, Charset)with charset name string. All replacements maintain test correctness. | 
Sequence Diagram
sequenceDiagram
    participant D as Developer
    participant S as InfisicalSdk
    participant A as AuthClient
    participant H as ApiClient
    
    D->>S: new InfisicalSdk(config)
    S->>A: new AuthClient(apiClient)
    S->>H: new ApiClient(baseUrl)
    
    D->>A: UniversalAuthLogin(id, pass)
    A->>H: post(url, params, Class)
    H->>H: Build HTTP request
    H-->>A: Return credential
    A-->>D: Authentication complete
    
    D->>S: Secrets().ListSecrets(projectId, env)
    S->>H: get(url, queryParams, Class)
    H->>H: Build HTTP GET request
    H-->>S: Return response
    S-->>D: Return list
    8 files reviewed, 1 comment
This PR aims to add support for all Java versions all the way down to Java 8. I've moved us to use legacy Java syntax and legacy Java features in order for our code to be compatible with older Java versions. I've tested all the auth and secret methods against a real Infisical instance, everything works well. Tested on Java 21 and Java 8 respectively.