Skip to content

Commit bc353f4

Browse files
committed
avoid calling getClass().getSimpleName() repeatedly
Surprisingly when I tested this locally, the JVM did not optimize it and lost some performance just for this statement. The value of using `getSimpleName()` here is not that great, so I simply hard-coded the value (I thought about making it a constant, but then went for simplicity, since the probability that this class will change and we overlook this renaming and it will actually cause a real problem / confusion is IMHO not that great). Signed-off-by: Peter Gafert <[email protected]>
1 parent e6d9d35 commit bc353f4

File tree

1 file changed

+3
-3
lines changed
  • archunit/src/main/java/com/tngtech/archunit/core/importer

1 file changed

+3
-3
lines changed

archunit/src/main/java/com/tngtech/archunit/core/importer/Location.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ private String encodeIllegalCharacters(String relativeURI) {
140140
}
141141

142142
void checkScheme(String scheme, NormalizedUri uri) {
143-
checkArgument(scheme.equals(uri.getScheme()),
144-
"URI %s of %s must have scheme %s, but has %s",
145-
uri, getClass().getSimpleName(), scheme, uri.getScheme());
143+
String actualScheme = uri.getScheme();
144+
checkArgument(scheme.equals(actualScheme),
145+
"URI %s of Location must have scheme %s, but has %s", uri, scheme, actualScheme);
146146
}
147147

148148
/**

0 commit comments

Comments
 (0)