@@ -484,7 +484,7 @@ class _MockTargetGatherer {
484484 // annotations, on one element or even on different elements in a library.
485485 for (final annotation in element.metadata) {
486486 if (annotation.element is ! ConstructorElement ) continue ;
487- final annotationClass = annotation.element! .enclosingElement ! .name;
487+ final annotationClass = annotation.element! .enclosingElement3 ! .name;
488488 switch (annotationClass) {
489489 case 'GenerateMocks' :
490490 mockTargets
@@ -1734,7 +1734,7 @@ class _MockClassInfo {
17341734 parameter.computeConstantValue ()! , parameter)
17351735 .code;
17361736 } on _ReviveException catch (e) {
1737- final method = parameter.enclosingElement ! ;
1737+ final method = parameter.enclosingElement3 ! ;
17381738 throw InvalidMockitoAnnotationException (
17391739 'Mockito cannot generate a valid override for method '
17401740 "'${mockTarget .interfaceElement .displayName }.${method .displayName }'; "
@@ -1765,8 +1765,8 @@ class _MockClassInfo {
17651765 if (! parameter.isCovariant) {
17661766 return type;
17671767 }
1768- final method = parameter.enclosingElement as MethodElement ;
1769- final class_ = method.enclosingElement as InterfaceElement ;
1768+ final method = parameter.enclosingElement3 as MethodElement ;
1769+ final class_ = method.enclosingElement3 as InterfaceElement ;
17701770 final name = Name (method.librarySource.uri, method.name);
17711771 final overriddenMethods = inheritanceManager.getOverridden2 (class_, name);
17721772 if (overriddenMethods == null ) {
@@ -1776,7 +1776,7 @@ class _MockClassInfo {
17761776 while (allOverriddenMethods.isNotEmpty) {
17771777 final overriddenMethod = allOverriddenMethods.removeFirst ();
17781778 final secondaryOverrides = inheritanceManager.getOverridden2 (
1779- overriddenMethod.enclosingElement as InterfaceElement , name);
1779+ overriddenMethod.enclosingElement3 as InterfaceElement , name);
17801780 if (secondaryOverrides != null ) {
17811781 allOverriddenMethods.addAll (secondaryOverrides);
17821782 }
@@ -2313,12 +2313,12 @@ extension on Element {
23132313 } else if (this is EnumElement ) {
23142314 return "The enum '$name '" ;
23152315 } else if (this is MethodElement ) {
2316- final className = enclosingElement ! .name;
2316+ final className = enclosingElement3 ! .name;
23172317 return "The method '$className .$name '" ;
23182318 } else if (this is MixinElement ) {
23192319 return "The mixin '$name '" ;
23202320 } else if (this is PropertyAccessorElement ) {
2321- final className = enclosingElement ! .name;
2321+ final className = enclosingElement3 ! .name;
23222322 return "The property accessor '$className .$name '" ;
23232323 } else {
23242324 return 'unknown element' ;
0 commit comments