-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Issue Description
The getPath method in Utils.java has a visibility mismatch where it uses JsonValueImpl (package-private class) in its public method signature, making the method unusable outside its visibility scope.
Location
- File: json-java21/src/main/java/jdk/sandbox/internal/util/json/Utils.java
- Method:
public static String getPath(JsonValueImpl jvi)
Problem
The method signature uses JsonValueImpl which is a package-private class:
public static String getPath(JsonValueImpl jvi) {
return JsonPath.getPath(jvi);
}This creates a visibility issue because:
- The method is
public(accessible from anywhere) - But the parameter type
JsonValueImplis package-private (only accessible within the same package) - This makes the method effectively unusable from outside the package
- While legal Java, it's a design smell that indicates improper API design
Expected Fix
Either:
- Change the method visibility to package-private to match the parameter type
- Change the parameter type to a public interface/class if cross-package usage is intended
- Move the method to a more appropriate location if it should remain public
Impact
- Severity: Low (code quality issue)
- Type: API design / Visibility mismatch
- Module: json-java21
Additional Context
This issue was identified by static analysis tools that detect visibility mismatches between method signatures and their referenced types. The fix should align with proper encapsulation principles and intended API design.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels