Skip to content

NPE while scanning instance methods #2242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
isoos opened this issue Jun 22, 2020 · 2 comments · Fixed by #2254
Closed

NPE while scanning instance methods #2242

isoos opened this issue Jun 22, 2020 · 2 comments · Fixed by #2254
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@isoos
Copy link
Contributor

isoos commented Jun 22, 2020

Found on pub.dev for fid_widgets 0.0.6

Unhandled exception:
NoSuchMethodError: The getter 'inheritanceManager' was called on null.
Receiver: null
Tried calling: inheritanceManager
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1      Class._inheritedElements (package:dartdoc/src/model/class.dart:306:41)
#2      Class.inheritedMethods (package:dartdoc/src/model/class.dart:159:37)
#3      Class.instanceMethods (package:dartdoc/src/model/class.dart:61:45)
#4      Container.allModelElements (package:dartdoc/src/model/container.dart:39:9)
#5      Class.allModelElements (package:dartdoc/src/model/class.dart:75:17)
#6      Library.modelElementsMap.<anonymous closure> (package:dartdoc/src/model/library.dart:598:15)
#7      ExpandIterator.moveNext (dart:_internal/iterable.dart:484:31)
#8      ExpandIterator.moveNext (dart:_internal/iterable.dart:478:31)
#9      Iterable.forEach (dart:core/iterable.dart:279:23)
#10     Library.modelElementsMap (package:dartdoc/src/model/library.dart:615:15)
#11     Library.allModelElements (package:dartdoc/src/model/library.dart:630:33)
#12     PackageGraph.allModelElements.<anonymous closure>.<anonymous closure> (package:dartdoc/src/model/package_graph.dart:882:48)
#13     SetMixin.forEach (dart:collection/set.dart:148:30)
#14     PackageGraph.allModelElements.<anonymous closure> (package:dartdoc/src/model/package_graph.dart:881:18)
#15     SetMixin.forEach (dart:collection/set.dart:148:30)
#16     PackageGraph.allModelElements (package:dartdoc/src/model/package_graph.dart:875:52)
#17     PackageGraph.precacheLocalDocs (package:dartdoc/src/model/package_graph.dart:120:19)
#18     _SyncIterator.moveNext (dart:core-patch/core_patch.dart:146:23)
#19     new List.from (dart:core-patch/array_patch.dart:47:19)
#20     Iterable.toList (dart:core/iterable.dart:400:12)
#21     PackageGraph.initializePackageGraph (package:dartdoc/src/model/package_graph.dart:71:47)
#22     PubPackageBuilder.buildPackageGraph (package:dartdoc/src/model/package_builder.dart:73:20)
<asynchronous suspension>
@jcollins-g jcollins-g added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jun 22, 2020
@srawlins
Copy link
Member

srawlins commented Jul 7, 2020

Looks like this is caused by the // in export 'src/fid_enum_picker//enum_picker.dart';

@srawlins
Copy link
Member

srawlins commented Jul 8, 2020

There is a quick fix I intend to implement, which will just prevent dartdoc from crashing.

A more broad fix might be desired, but the behavior is correct according to the dart spec. For example, take these three libs:

// lib/src/a.dart
class C {}
// lib/b.dart
import 'src/a.dart';

f(C c) {}
// lib/c.dart
import 'src//a.dart';
import 'b.dart';

main() => f(C());

Running c.dart results in a crash:

lib/c.dart:4:13: Error: The argument type 'C/*1*/' can't be assigned to the parameter type 'C/*2*/'.
 - 'C/*1*/' is from 'package:fid_widgets/src//a.dart' ('lib/src//a.dart').
 - 'C/*2*/' is from 'package:fid_widgets/src/a.dart' ('lib/src/a.dart').
main() => f(C());
            ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants