@@ -24,10 +24,11 @@ public static void throwOnRootContextAccess() {
24
24
public static <T > T getLocal (ContextInternal context , Object key ) {
25
25
if (VertxContext .isDuplicatedContext (context )) {
26
26
// We are on a duplicated context, allow accessing the locals
27
- if (key instanceof ContextLocalImpl <?> || key instanceof ContextLocal <?> ) {
27
+ if (key instanceof ContextLocalImpl <?>) {
28
28
var localKey = (ContextLocal <T >) key ;
29
29
return (T ) context .getLocal (localKey , QuarkusAccessModes .ACQUIRE_RELEASE );
30
30
}
31
+ assert !(key instanceof ContextLocal <?>);
31
32
return (T ) context .localContextData ().get (key );
32
33
} else {
33
34
throw new UnsupportedOperationException (ILLEGAL_ACCESS_TO_LOCAL_CONTEXT );
@@ -37,10 +38,11 @@ public static <T> T getLocal(ContextInternal context, Object key) {
37
38
public static void putLocal (ContextInternal context , Object key , Object value ) {
38
39
if (VertxContext .isDuplicatedContext (context )) {
39
40
// We are on a duplicated context, allow accessing the locals
40
- if (key instanceof ContextLocalImpl <?> || key instanceof ContextLocal <?> ) {
41
+ if (key instanceof ContextLocalImpl <?>) {
41
42
var localKey = (ContextLocal <Object >) key ;
42
43
context .putLocal (localKey , QuarkusAccessModes .ACQUIRE_RELEASE , value );
43
44
} else {
45
+ assert !(key instanceof ContextLocal <?>);
44
46
context .localContextData ().put (key , value );
45
47
}
46
48
} else {
@@ -51,14 +53,15 @@ public static void putLocal(ContextInternal context, Object key, Object value) {
51
53
public static boolean removeLocal (ContextInternal context , Object key ) {
52
54
if (VertxContext .isDuplicatedContext (context )) {
53
55
// We are on a duplicated context, allow accessing the locals
54
- if (key instanceof ContextLocalImpl <?> || key instanceof ContextLocal <?> ) {
56
+ if (key instanceof ContextLocalImpl <?>) {
55
57
var localKey = (ContextLocal <Object >) key ;
56
58
if (localKey == null ) {
57
59
return false ;
58
60
}
59
61
context .removeLocal (localKey , QuarkusAccessModes .ACQUIRE_RELEASE );
60
62
return true ;
61
63
}
64
+ assert !(key instanceof ContextLocal <?>);
62
65
return context .localContextData ().remove (key ) != null ;
63
66
} else {
64
67
throw new UnsupportedOperationException (ILLEGAL_ACCESS_TO_LOCAL_CONTEXT );
0 commit comments