Skip to content

Commit

Permalink
avoid calling getClass().getSimpleName() repeatedly
Browse files Browse the repository at this point in the history
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 <peter.gafert@tngtech.com>
  • Loading branch information
codecholeric committed May 23, 2020
1 parent e6d9d35 commit bc353f4
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -140,9 +140,9 @@ private String encodeIllegalCharacters(String relativeURI) {
}

void checkScheme(String scheme, NormalizedUri uri) {
checkArgument(scheme.equals(uri.getScheme()),
"URI %s of %s must have scheme %s, but has %s",
uri, getClass().getSimpleName(), scheme, uri.getScheme());
String actualScheme = uri.getScheme();
checkArgument(scheme.equals(actualScheme),
"URI %s of Location must have scheme %s, but has %s", uri, scheme, actualScheme);
}

/**
Expand Down

0 comments on commit bc353f4

Please sign in to comment.