@@ -13,17 +13,11 @@ public class ResourceLocation {
1313 final private @ NotNull Class <?> resourceClass ;
1414 final private @ NotNull String resourcePath ;
1515 final private @ NotNull String fileUrl ;
16- final private @ NotNull String resolvedResourcePath ;
1716
1817 public ResourceLocation (@ NotNull Class <?> resourceClass , @ NotNull String resourcePath , @ NotNull String fileUrl ) {
19- this (resourceClass , resourcePath , fileUrl , TestUtils .getResolvedSpecResourcePath (resourceClass .getName (), resourcePath ));
20- }
21-
22- private ResourceLocation (@ NotNull Class <?> resourceClass , @ NotNull String resourcePath , @ NotNull String fileUrl , @ NotNull String resolvedResourcePath ) {
2318 this .resourceClass = resourceClass ;
2419 this .resourcePath = resourcePath ;
2520 this .fileUrl = fileUrl ;
26- this .resolvedResourcePath = resolvedResourcePath ;
2721 }
2822
2923 @ NotNull
@@ -55,11 +49,6 @@ public String getFileUrl(int lineNumber) {
5549 return TestUtils .getUrlWithLineNumber (getFileUrl (), lineNumber );
5650 }
5751
58- @ NotNull
59- public String getResolvedResourcePath () {
60- return resolvedResourcePath ;
61- }
62-
6352 public boolean isNull () {
6453 return this == NULL ;
6554 }
@@ -83,23 +72,21 @@ public boolean equals(Object o) {
8372
8473 if (!resourceClass .equals (location .resourceClass )) return false ;
8574 if (!resourcePath .equals (location .resourcePath )) return false ;
86- if (!fileUrl .equals (location .fileUrl )) return false ;
87- return resolvedResourcePath .equals (location .resolvedResourcePath );
75+ return fileUrl .equals (location .fileUrl );
8876 }
8977
9078 // @formatter:off
91- @ NotNull public ResourceLocation withResourceClass (@ NotNull Class <?> resourceClass ) { return new ResourceLocation (resourceClass , resourcePath , fileUrl , resolvedResourcePath ); };
92- @ NotNull public ResourceLocation withResourcePath (@ NotNull String resourcePath ) { return new ResourceLocation (resourceClass , resourcePath , fileUrl , resolvedResourcePath ); };
93- @ NotNull public ResourceLocation withFileUrl (@ NotNull String fileUrl ) { return new ResourceLocation (resourceClass , resourcePath , fileUrl , resolvedResourcePath ); };
94- @ NotNull public ResourceLocation withResolvedResourcePath (@ NotNull String resolvedResourcePath ) { return new ResourceLocation (resourceClass , resourcePath , fileUrl , resolvedResourcePath ); };
79+ @ NotNull public ResourceLocation withResourceClass (@ NotNull Class <?> resourceClass ) { return new ResourceLocation (resourceClass , resourcePath , fileUrl ); };
80+ @ NotNull public ResourceLocation withResourcePath (@ NotNull String resourcePath ) { return new ResourceLocation (resourceClass , resourcePath , fileUrl ); };
81+ @ NotNull public ResourceLocation withFileUrl (@ NotNull String fileUrl ) { return new ResourceLocation (resourceClass , resourcePath , fileUrl ); };
82+ @ NotNull public ResourceLocation withResolvedResourcePath (@ NotNull String resolvedResourcePath ) { return new ResourceLocation (resourceClass , resourcePath , fileUrl ); };
9583 // @formatter:on
9684
9785 @ Override
9886 public int hashCode () {
9987 int result = resourceClass .hashCode ();
10088 result = 31 * result + resourcePath .hashCode ();
10189 result = 31 * result + fileUrl .hashCode ();
102- result = 31 * result + resolvedResourcePath .hashCode ();
10390 return result ;
10491 }
10592
@@ -113,15 +100,13 @@ public String toString() {
113100
114101 public static @ NotNull ResourceLocation of (@ NotNull String resourcePath ) {
115102 return new ResourceLocation (ComboSpecTestCase .class , resourcePath ,
116- TestUtils .getSpecResourceFileUrl (ComboSpecTestCase .class , resourcePath ),
117- TestUtils .getResolvedSpecResourcePath (ComboSpecTestCase .class .getName (), resourcePath )
103+ TestUtils .getSpecResourceFileUrl (ComboSpecTestCase .class , resourcePath )
118104 );
119105 }
120106
121107 public static @ NotNull ResourceLocation of (@ NotNull Class <?> resourceClass , @ NotNull String resourcePath ) {
122108 return new ResourceLocation (resourceClass , resourcePath ,
123- TestUtils .getSpecResourceFileUrl (resourceClass , resourcePath ),
124- TestUtils .getResolvedSpecResourcePath (resourceClass .getName (), resourcePath )
109+ TestUtils .getSpecResourceFileUrl (resourceClass , resourcePath )
125110 );
126111 }
127112
@@ -152,8 +137,7 @@ public static String getResourceText(@NotNull ResourceLocation location) {
152137
153138 @ NotNull
154139 public static InputStream getResourceInputStream (@ NotNull ResourceLocation location ) {
155- String useSpecResource = location .getResolvedResourcePath ();
156- InputStream stream = location .getResourceClass ().getResourceAsStream (useSpecResource );
140+ InputStream stream = location .getResourceClass ().getResourceAsStream (location .getResourcePath ());
157141 if (stream == null ) {
158142 throw new IllegalStateException ("Could not load " + location );
159143 }
0 commit comments