Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 550196851
  • Loading branch information
Googler authored and copybara-github committed Jul 22, 2023
1 parent afa20a8 commit b421775
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/src/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@ class _MockTargetGatherer {

static Iterable<_MockTarget> _mockTargetsFromGenerateMocks(
ElementAnnotation annotation, LibraryElement entryLib) {
final generateMocksValue = annotation.computeConstantValue()!;
final classesField = generateMocksValue.getField('classes')!;
if (classesField.isNull) {
final generateMocksValue = annotation.computeConstantValue();
final classesField = generateMocksValue?.getField('classes');
if (classesField == null || classesField.isNull) {
throw InvalidMockitoAnnotationException(
'The GenerateMocks "classes" argument is missing, includes an '
'unknown type, or includes an extension');
Expand Down Expand Up @@ -548,7 +548,7 @@ class _MockTargetGatherer {
fallbackGenerators: {},
));
}
final customMocksField = generateMocksValue.getField('customMocks');
final customMocksField = generateMocksValue?.getField('customMocks');
if (customMocksField != null && !customMocksField.isNull) {
final customMocksAsts =
_customMocksAst(annotation.annotationAst)?.elements ??
Expand Down
6 changes: 3 additions & 3 deletions test/builder/auto_mocks_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class GenerateMocks {
final List<Type> classes;
final List<MockSpec> customMocks;
const GenerateMocks(this.classes, {this.customMocks = []});
const GenerateMocks(this.classes, {this.customMocks = const []});
}
class MockSpec<T> {
final Symbol mockName;
final Symbol? mockName;
final bool returnNullOnMissingStub;
Expand All @@ -43,7 +43,7 @@ class MockSpec<T> {
final Map<Symbol, Function> fallbackGenerators;
const MockSpec({
Symbol as,
Symbol? as,
this.returnNullOnMissingStub = false,
this.unsupportedMembers = const {},
this.fallbackGenerators = const {},
Expand Down
2 changes: 1 addition & 1 deletion test/builder/custom_mocks_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GenerateNiceMocks {
}
class MockSpec<T> {
final Symbol mockName;
final Symbol? mockName;
final List<Type> mixins;
Expand Down

0 comments on commit b421775

Please sign in to comment.