@@ -53,18 +53,14 @@ class NullabilityIntrospector implements Nullability.Introspector {
53
53
private static final List <NullabilityProvider > providers ;
54
54
55
55
static {
56
- providers = new ArrayList <>(5 );
56
+ providers = new ArrayList <>(4 );
57
57
58
58
providers .add (new PrimitiveProvider ());
59
59
60
60
if (Jsr305Provider .isAvailable ()) {
61
61
providers .add (new Jsr305Provider ());
62
62
}
63
63
64
- if (JakartaAnnotationProvider .isAvailable ()) {
65
- providers .add (new JakartaAnnotationProvider ());
66
- }
67
-
68
64
if (JSpecifyAnnotationProvider .isAvailable ()) {
69
65
providers .add (new JSpecifyAnnotationProvider ());
70
66
}
@@ -369,24 +365,6 @@ static boolean isNullable(Annotation annotation) {
369
365
}
370
366
}
371
367
372
- /**
373
- * Simplified variant of {@link Jsr305Provider} without {@code when} and {@code @TypeQualifierDefault} support.
374
- */
375
- @ SuppressWarnings ("DataFlowIssue" )
376
- static class JakartaAnnotationProvider extends SimpleAnnotationNullabilityProvider {
377
-
378
- private static final Class <Annotation > NON_NULL = findClass ("jakarta.annotation.Nonnull" );
379
- private static final Class <Annotation > NULLABLE = findClass ("jakarta.annotation.Nullable" );
380
-
381
- JakartaAnnotationProvider () {
382
- super (NON_NULL , NULLABLE );
383
- }
384
-
385
- public static boolean isAvailable () {
386
- return NON_NULL != null && NULLABLE != null ;
387
- }
388
- }
389
-
390
368
/**
391
369
* Provider for JSpecify annotations.
392
370
*/
@@ -431,49 +409,15 @@ Spec evaluate(AnnotatedElement element, ElementType elementType) {
431
409
private static Spec evaluate (Annotation [] annotations ) {
432
410
for (Annotation annotation : annotations ) {
433
411
434
- if (SimpleAnnotationNullabilityProvider . test (NULL_UNMARKED , annotation )) {
412
+ if (test (NULL_UNMARKED , annotation )) {
435
413
return Spec .UNSPECIFIED ;
436
414
}
437
415
438
- if (SimpleAnnotationNullabilityProvider .test (NULL_MARKED , annotation )
439
- || SimpleAnnotationNullabilityProvider .test (NON_NULL , annotation )) {
416
+ if (test (NULL_MARKED , annotation ) || test (NON_NULL , annotation )) {
440
417
return Spec .NON_NULL ;
441
418
}
442
419
443
- if (SimpleAnnotationNullabilityProvider .test (NULLABLE , annotation )) {
444
- return Spec .NULLABLE ;
445
- }
446
- }
447
-
448
- return Spec .UNSPECIFIED ;
449
- }
450
- }
451
-
452
- /**
453
- * Annotation-based {@link NullabilityProvider} leveraging simple or meta-annotations.
454
- */
455
- static class SimpleAnnotationNullabilityProvider extends NullabilityProvider {
456
-
457
- private final Class <Annotation > nonNull ;
458
- private final Class <Annotation > nullable ;
459
-
460
- SimpleAnnotationNullabilityProvider (Class <Annotation > nonNull , Class <Annotation > nullable ) {
461
- this .nonNull = nonNull ;
462
- this .nullable = nullable ;
463
- }
464
-
465
- @ Override
466
- Spec evaluate (AnnotatedElement element , ElementType elementType ) {
467
-
468
- Annotation [] annotations = element .getAnnotations ();
469
-
470
- for (Annotation annotation : annotations ) {
471
-
472
- if (test (nonNull , annotation )) {
473
- return Spec .NON_NULL ;
474
- }
475
-
476
- if (test (nullable , annotation )) {
420
+ if (test (NULLABLE , annotation )) {
477
421
return Spec .NULLABLE ;
478
422
}
479
423
}
@@ -490,7 +434,6 @@ static boolean test(Class<Annotation> annotationClass, Annotation annotation) {
490
434
MergedAnnotations annotations = MergedAnnotations .from (annotation .annotationType ());
491
435
return annotations .isPresent (annotationClass );
492
436
}
493
-
494
437
}
495
438
496
439
@ Nullable
0 commit comments