Skip to content
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

Analyzer throw Unhandled exception #25779

Closed
kzhdev opened this issue Feb 14, 2016 · 14 comments
Closed

Analyzer throw Unhandled exception #25779

kzhdev opened this issue Feb 14, 2016 · 14 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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

@kzhdev
Copy link

kzhdev commented Feb 14, 2016

in analyzer/src/dart/element/element.dart:1588, evaluationResult need to be null checked

 @override
  DartObject get constantValue => evaluationResult.value;
Unhandled exception:
The null object does not have a getter 'value'.

NoSuchMethodError: method not found: 'value'
Receiver: null
Arguments: []
#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2      ElementAnnotationImpl.constantValue (package:analyzer/src/dart/element/element.dart:1588)
#3      findAnnotation (package:dev_compiler/src/utils.dart:347)
#4      JSCodegenVisitor._getJSExportName (package:dev_compiler/src/codegen/js_codegen.dart:1410)
#5      JSCodegenVisitor._emitTopLevelName (package:dev_compiler/src/codegen/js_codegen.dart:1910)
#6      JSCodegenVisitor._emitTypeName (package:dev_compiler/src/codegen/js_codegen.dart:1895)
#7      JSCodegenVisitor._emitSimpleIdentifier (package:dev_compiler/src/codegen/js_codegen.dart:1709)
#8      JSCodegenVisitor.visitSimpleIdentifier (package:dev_compiler/src/codegen/js_codegen.dart:1686)
#9      SimpleIdentifierImpl.accept (package:analyzer/src/dart/ast/ast.dart:8688)
#10     JSCodegenVisitor._visit (package:dev_compiler/src/codegen/js_codegen.dart:3448)
#11     JSCodegenVisitor.visitMethodInvocation (package:dev_compiler/src/codegen/js_codegen.dart:2081)
#12     MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7047)
#13     JSCodegenVisitor._visit (package:dev_compiler/src/codegen/js_codegen.dart:3448)
#14     JSCodegenVisitor.visitAwaitExpression (package:dev_compiler/src/codegen/js_codegen.dart:2289)
#15     AwaitExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:991)
#16     JSCodegenVisitor._visit (package:dev_compiler/src/codegen/js_codegen.dart:3448)
#17     JSCodegenVisitor.visitVariableDeclarationStatement (package:dev_compiler/src/codegen/js_codegen.dart:2331)
#18     VariableDeclarationStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:10594)
#19     JSCodegenVisitor._visit (package:dev_compiler/src/codegen/js_codegen.dart:3448)
#20     JSCodegenVisitor._visitList (package:dev_compiler/src/codegen/js_codegen.dart:3458)
#21     JSCodegenVisitor.visitBlockFunctionBody (package:dev_compiler/src/codegen/js_codegen.dart:2028)
#22     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1195)
#23     JSCodegenVisitor._visit (package:dev_compiler/src/codegen/js_codegen.dart:3448)
#24     JSCodegenVisitor._emitGeneratorFunctionBody (package:dev_compiler/src/codegen/js_codegen.dart:1645)
#25     JSCodegenVisitor._emitFunctionBody (package:dev_compiler/src/codegen/js_codegen.dart:1592)
#26     JSCodegenVisitor._emitMethodDeclaration (package:dev_compiler/src/codegen/js_codegen.dart:1371)
#27     JSCodegenVisitor._emitClassMethods (package:dev_compiler/src/codegen/js_codegen.dart:666)
#28     JSCodegenVisitor.visitClassDeclaration (package:dev_compiler/src/codegen/js_codegen.dart:433)
#29     ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1796)
#30     JSCodegenVisitor._visit (package:dev_compiler/src/codegen/js_codegen.dart:3448)
#31     JSCodegenVisitor._emitModuleItem (package:dev_compiler/src/codegen/js_codegen.dart:229)
#32     ModuleItemLoadOrder.loadDeclaration (package:dev_compiler/src/codegen/js_module_item_order.dart:148)
#33     JSCodegenVisitor.emitLibrary (package:dev_compiler/src/codegen/js_codegen.dart:170)
#34     JSGenerator.generateLibrary (package:dev_compiler/src/codegen/js_codegen.dart:3728)
#35     BatchCompiler._processPending (package:dev_compiler/src/compiler.dart:185)
#36     BatchCompiler._compileSource (package:dev_compiler/src/compiler.dart:154)
#37     BatchCompiler._compileFromUri (package:dev_compiler/src/compiler.dart:145)
#38     BatchCompiler.compileFromUriString (package:dev_compiler/src/compiler.dart:133)
#39     Object&ListMixin.forEach (dart:collection/list.dart:63)
#40     BatchCompiler.run (package:dev_compiler/src/compiler.dart:124)
@kzhdev
Copy link
Author

kzhdev commented Feb 14, 2016

Please review:
https://codereview.chromium.org/1693223002

@bwilkerson bwilkerson added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Feb 14, 2016
@bwilkerson
Copy link
Member

Looks good to me! Thanks! Let me know if you have any trouble committing the change.

@kzhdev
Copy link
Author

kzhdev commented Feb 14, 2016

@bwilkerson
I don't have permission to commit the change.

@bwilkerson
Copy link
Member

Have you followed the steps here: https://github.com/dart-lang/sdk/wiki/Contributing ?

@kzhdev
Copy link
Author

kzhdev commented Feb 15, 2016

@bwilkerson
Yes, I did follow the steps. Here is what I got:

kzhao@MacBook-Pro-3:sdk (fix_analyzer_unhandled_exception) $ git cl land
Using 50% similarity for rename/copy detection. Override with --similarity.
Running presubmit commit checks ...

Presubmit checks passed.
Description:
Fix unhandle exception when access ElementAnnotationImpl.constantValue

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1693223002 .
pkg/analyzer/lib/src/dart/element/element.dart | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
ERROR: Permission to dart-lang/sdk.git denied to kzhdev.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Failed to push. If this persists, please file a bug.

@bwilkerson
Copy link
Member

@kevmoo Can you look into why he doesn't have permission to commit? Thanks!

@jmesserly
Copy link

I don't think folks can commit directly unless they are committers. We haven't traditionally given that out unless folks met with the Chromium guidelines: https://www.chromium.org/getting-involved/become-a-committer (TL;DR 10-20 non-trivial patches)

Our traditional approach is described here: https://www.chromium.org/developers/contributing-code#TOC-Committing-a-patch-for-a-non-committer (which links to https://www.chromium.org/developers/contributing-code/external-contributor-checklist)

Since this is GitHub, I often just encourage folks to re-send it as a pull request, which you can LGTM & accept with one click.

@kevmoo
Copy link
Member

kevmoo commented Feb 16, 2016

Agreeing with @jmesserly – can we run w/ a pull request here?

Or one could land the CL using git cl land -c CONTRIBUTOR

@kevmoo
Copy link
Member

kevmoo commented Feb 16, 2016

@kzhdev Have you signed the CLA agreement?

https://cla.developers.google.com/clas

@kevmoo
Copy link
Member

kevmoo commented Feb 16, 2016

...I noticed the email you have for https://codereview.chromium.org/user/kzhdev is different than your github email, @kzhdev

@kevmoo
Copy link
Member

kevmoo commented Feb 16, 2016

Closed with 7199398

@kevmoo kevmoo closed this as completed Feb 16, 2016
@kzhdev
Copy link
Author

kzhdev commented Feb 17, 2016

@bwilkerson @kevmoo
I see the build failed, not sure if the failure was caused by my change. Do I need to do anything?

@bwilkerson
Copy link
Member

Nope. I'm not sure what the problem was, but every bot that failed when running with the code you wrote has since started passing again.

@kzhdev
Copy link
Author

kzhdev commented Feb 17, 2016

@bwilkerson
Thanks. I'm relieved now.

@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Type-Defect labels Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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

No branches or pull requests

4 participants