You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After putting further thought into the semantics for getPath() in ClassPathResource, I realized the following.
Several tests were previously misusing getPath(), and I rectified that in commit 1688bec.
My updates to the Javadoc for getPath() make it clear that the semantics are very inconsistent. See current Javadoc.
If we switch getPath() to return this.absolutePath, the entire test suite passes except ClassPathResourceTests.preserveLeadingSlashForClassRelativeAccess(). Yet, I would argue that's not a valid use case.
In light of the above, I'm wondering if we should:
Switch getPath() to return the absolute path consistently without a leading slash.
After putting further thought into the semantics for
getPath()inClassPathResource, I realized the following.getPath(), and I rectified that in commit 1688bec.getPath()make it clear that the semantics are very inconsistent. See current Javadoc.getPath()to returnthis.absolutePath, the entire test suite passes exceptClassPathResourceTests.preserveLeadingSlashForClassRelativeAccess(). Yet, I would argue that's not a valid use case.In light of the above, I'm wondering if we should:
getPath()to return the absolute path consistently without a leading slash.getPath()to its previous state (prior to Introduce getAbsolutePath() in ClassPathResource #29094).getAbsolutePath()method (i.e., revert Introduce getAbsolutePath() in ClassPathResource #29094).