Skip to content

Commit

Permalink
Reduce the use of reflection in some rare circumstances (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Aug 2, 2024
1 parent ce94373 commit 009aa10
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ private Field getModifiers() throws NoSuchMethodException, InvocationTargetExcep

@Override
public Void call() throws EnvInjectException {
if (EnvVars.masterEnvVars.equals(enVars)) {
// Nothing to update
return null;
} else if (EnvVars.masterEnvVars.keySet().equals(enVars.keySet())) {
/*
* Per the Javadoc, merely changing the value associated with an existing key is not a structural
* modification and thus does not require synchronization.
*/
EnvVars.masterEnvVars.putAll(enVars);
return null;
}

try {
Field platformField = EnvVars.class.getDeclaredField("platform");
platformField.setAccessible(true);
Expand Down

0 comments on commit 009aa10

Please sign in to comment.