Skip to content

Commit

Permalink
Avoid triggering type cache pollution on VertxContext.isDuplicatedCon…
Browse files Browse the repository at this point in the history
…text
  • Loading branch information
Sanne committed Oct 17, 2022
1 parent 89fbaf2 commit 339b172
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ public static Context getOrCreateDuplicatedContext(Vertx vertx) {
* @return {@code true} if the given context is a duplicated context, {@code false} otherwise.
*/
public static boolean isDuplicatedContext(Context context) {
Context actual = Assert.checkNotNullParam("context", context);
return ((ContextInternal) actual).isDuplicate();
//Do not use Assert.checkNotNullParam with type io.vertx.core.Context as it is likely
//to trigger a performance issue via JDK-8180450.
//Identified via https://github.com/franz1981/type-pollution-agent
//So we cast to ContextInternal first:
ContextInternal actual = Assert.checkNotNullParam("context", (ContextInternal) context);
return actual.isDuplicate();
}

/**
Expand Down

0 comments on commit 339b172

Please sign in to comment.