Skip to content

polymer application compilation error #18481

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
DartBot opened this issue Apr 28, 2014 · 11 comments
Closed

polymer application compilation error #18481

DartBot opened this issue Apr 28, 2014 · 11 comments
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.

Comments

@DartBot
Copy link

DartBot commented Apr 28, 2014

This issue was originally filed by [email protected]


Dart2js output contains the following erorr messages:

This import is not annotated with @­MirrorsUsed, which may lead to unnecessarily large generated code.
Try adding '@MirrorsUsed(...)' as described at https://goo.gl/Akrrog.
import 'dart:mirrors';
^^^^^^^^^^^^^^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:18.394552 to compile od_web|web/load.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/resetPassword.html_bootstrap.dart...

294 methods retained for use by dart:mirrors out of 2026 total methods (15%).
[Info from Dart2JS]:
Took 0:00:05.577569 to compile od_web|web/resetPassword.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/profile.html_bootstrap.dart...

'smoke_8' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_8.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^

Not a compile-time constant.
          #viewmodel: const Declaration(#viewmodel, smoke_8.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:05.676572 to compile od_web|web/profile.html_bootstrap.dart.

Took 0:00:10.231995 to compile od_web|web/home.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/data.html_bootstrap.dart...

'smoke_9' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_9.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^

Not a compile-time constant.
          #viewmodel: const Declaration(#viewmodel, smoke_9.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:09.715136 to compile od_web|web/data.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/profilewizard.html_bootstrap.dart...

'smoke_15' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_15.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^

'smoke_15' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_15.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^

Not a compile-time constant.
          #viewmodel: const Declaration(#viewmodel, smoke_15.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:22.513475 to compile od_web|web/profilewizard.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/datawizard.html_bootstrap.dart...

Symbol literal '#_hightlightChanged' is currently unsupported by dart2js.
        #_hightlightChanged: (o) => o._hightlightChanged,
        ^^^^^^^^^^^^^^^^^^^

'smoke_14' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_14.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^

Symbol literal '#_hightlightChanged' is currently unsupported by dart2js.
          #_hightlightChanged: const Declaration(#_hightlightChanged, Function, kind: METHOD),
          ^^^^^^^^^^^^^^^^^^^

Symbol literal '#_hightlightChanged' is currently unsupported by dart2js.
          #_hightlightChanged: const Declaration(#_hightlightChanged, Function, kind: METHOD),
                                                 ^^^^^^^^^^^^^^^^^^^

Symbol literal '#_hightlightChanged' is currently unsupported by dart2js.
        #_hightlightChanged: r'_hightlightChanged',
        ^^^^^^^^^^^^^^^^^^^

Not a compile-time constant.
          #viewmodel: const Declaration(#viewmodel, smoke_14.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:04.672336 to compile od_web|web/datawizard.html_bootstrap.dart.
Build failed.

What version of the product are you using? On what operating system?

  • Dart Editor version 1.4.0.dev_04_00 (DEV)
  • Dart SDK version 1.4.0-dev.4.0
  • polymer 0.10.0-pre.9
@sigmundch
Copy link
Member

Hi!

It seems that there are 3 issues:

a) import to 'dart:mirrors' - I presume this is just something you do in your app? Note that we are careful to remove all uses of mirrors in the generated code of polymer applications to reduce the size of the compiled application. You might want to be careful on how you use mirrors and annotate them with @­MirrorsUsed to make sure your app doesn't explode in size.

b) _highlightChanged: looks like you have an event handler that is private. This is currently not supported. We report warnings on some cases like this, but it might be that we are not covering all cases. For example, I think we report this if you have a private field annotated with @­published, but we don't necessarily do this for private methods. We should fix that, but meanwhile you can workaround this issue by making the method public. I filed issue #18490 for this.

c) smoke_9.T: you probably have a custom element that uses a type-parameter <T>, this seems to be confusing our compiler tool. We also need to fix that, but meanwhile if you remove the type annotation (just make the field dynamic), the compilation should hopefully work. I filed issue #18491 for this.

If there is something else I missed, let me know.


Added Area-Polymer, Triaged labels.
Marked this as being blocked by #18490, #18491.

@DartBot
Copy link
Author

DartBot commented Apr 28, 2014

This comment was originally written by [email protected]


thanks for the clarification! I will try the suggested workaround.

regarding using of 'dart:mirrors'. I don't use import to mirrors explicit in my code.. I don't understand why there is "This import is not annotated with @­MirrorsUsed, which may lead to unnecessarily large generated code..." message.

@DartBot
Copy link
Author

DartBot commented Apr 28, 2014

This comment was originally written by [email protected]


I have starred both issues 18490 and 18491

@sigmundch
Copy link
Member

regarding "dart:mirrors" - interesting. It's pretty strange that the message above has no location of where that warning is coming from. I wonder if this is a false positive warning from dart2js, in which case we might want to get more data.

  • It's the log truncated or that's all there is?
  • Is your code available publicly so we could try it out and investigate from there?

@DartBot
Copy link
Author

DartBot commented Apr 28, 2014

This comment was originally written by [email protected]


This is full dart2js output. Later I can send an example of my code.

[Warning from polymer (Linter) on od_web|web/profile_container.html]:
web/profile_container.html:17:111: Unexpected end tag (img). Ignored.
[Warning from polymer (Linter) on od_web|web/profilewizard_container.html]:
web/profilewizard_container.html:30:138: Unexpected end tag (img). Ignored.
[Warning from polymer (Linter) on od_web|web/data_table_wizard.html]:
web/data_table_wizard.html:59:21: Event handler "onselectstart" will be interpreted as an inline JavaScript event handler. Use the form on-event-name="handlerName" if you want a Dart handler that will automatically update the UI based on model changes.
[Warning from polymer (Linter) on od_web|web/data_table_wizard.html]:
web/data_table_wizard.html:60:21: Event handler "onmousedown" will be interpreted as an inline JavaScript event handler. Use the form on-event-name="handlerName" if you want a Dart handler that will automatically update the UI based on model changes.
[Warning from polymer (Linter) on od_web|web/data_holder.html]:
web/data_holder.html:12:54: Unexpected end tag (data-table). Ignored.
[Warning from polymer (Linter) on od_web|web/data_holder.html]:
web/data_holder.html:13:5: End tag (div) seen too early. Expected other end tag.
[Warning from Observable on od_web|web/viewmodels/data_viewmodel.dart]:
web/viewmodels/data_viewmodel.dart:25:3: Observable fields should be put in an observable objects. Please declare that this class extends from Observable, includes Observable, or implements Observable.
[Warning from Observable on od_web|web/viewmodels/data_paginator.dart]:
web/viewmodels/data_paginator.dart:5:3: Observable fields should be put in an observable objects. Please declare that this class extends from Observable, includes Observable, or implements Observable.
[Warning from Observable on od_web|web/viewmodels/data_paginator.dart]:
web/viewmodels/data_paginator.dart:6:3: Observable fields should be put in an observable objects. Please declare that this class extends from Observable, includes Observable, or implements Observable.
[Warning from Observable on od_web|web/viewmodels/data_paginator.dart]:
web/viewmodels/data_paginator.dart:7:3: Observable fields should be put in an observable objects. Please declare that this class extends from Observable, includes Observable, or implements Observable.
[Warning from polymer (Linter) on od_web|web/data_container.html]:
web/data_holder.html:12:54: Unexpected end tag (data-table). Ignored.
[Warning from polymer (Linter) on od_web|web/data_container.html]:
web/data_holder.html:13:5: End tag (div) seen too early. Expected other end tag.
[Warning from polymer (Linter) on od_web|web/profile.html]:
web/profile_container.html:17:111: Unexpected end tag (img). Ignored.
[Warning from polymer (Linter) on od_web|web/profilewizard.html]:
web/profilewizard_container.html:30:138: Unexpected end tag (img). Ignored.
[Info from Dart2JS]:
Took 0:00:12.967345 to compile od_web|test/collapsed_safe_html_test.dart.
[Info from Dart2JS]:
Compiling od_web|test/safe_html_test.dart...
[Info from Dart2JS]:
Took 0:00:04.820100 to compile od_web|test/safe_html_test.dart.
[Warning from polymer (Linter) on od_web|web/datawizard.html]:
web/data_holder.html:12:54: Unexpected end tag (data-table). Ignored.
[Warning from polymer (Linter) on od_web|web/datawizard.html]:
web/data_holder.html:13:5: End tag (div) seen too early. Expected other end tag.
[Warning from ImportInliner on od_web|web/profile.html]:
web/profile_container.html:17:111: Unexpected end tag (img). Ignored.
[Warning from ImportInliner on od_web|web/profilewizard.html]:
web/profilewizard_container.html:30:138: Unexpected end tag (img). Ignored.
[Warning from ImportInliner on od_web|web/datawizard.html]:
web/data_holder.html:12:54: Unexpected end tag (data-table). Ignored.
[Warning from ImportInliner on od_web|web/datawizard.html]:
web/data_holder.html:13:5: End tag (div) seen too early. Expected other end tag.
[Info from Dart2JS]:
Compiling od_web|web/agreement.dart...
[Info from Dart2JS]:
Took 0:00:05.834678 to compile od_web|web/agreement.dart.
[Info from Dart2JS]:
Compiling od_web|web/tags.dart...
[Info from Dart2JS]:
Took 0:00:07.807532 to compile od_web|web/tags.dart.
[Info from Dart2JS]:
Compiling od_web|web/join.dart...
[Info from Dart2JS]:
Took 0:00:05.839107 to compile od_web|web/join.dart.
[Info from Dart2JS]:
Compiling od_web|web/profilewizard.dart...
[Info from Dart2JS]:
Took 0:00:06.680745 to compile od_web|web/profilewizard.dart.
[Info from Dart2JS]:
Compiling od_web|web/list.dart...
[Info from Dart2JS]:
Took 0:00:06.851734 to compile od_web|web/list.dart.
[Info from Dart2JS]:
Compiling od_web|web/profile.dart...
[Info from Dart2JS]:
Took 0:00:03.706488 to compile od_web|web/profile.dart.
[Info from Dart2JS]:
Compiling od_web|web/data.dart...
[Info from Dart2JS]:
Took 0:00:05.063795 to compile od_web|web/data.dart.
[Info from Dart2JS]:
Compiling od_web|web/load.dart...
[Info from Dart2JS]:
Took 0:00:06.322624 to compile od_web|web/load.dart.
[Info from Dart2JS]:
Compiling od_web|web/home.dart...
[Info from Dart2JS]:
Took 0:00:10.038175 to compile od_web|web/home.dart.
[Info from Dart2JS]:
Compiling od_web|web/datawizard.dart...
[Info from Dart2JS]:
Took 0:00:06.588684 to compile od_web|web/datawizard.dart.
[Info from Dart2JS]:
Compiling od_web|web/login.dart...
[Info from Dart2JS]:
Took 0:00:04.052123 to compile od_web|web/login.dart.
[Info from Dart2JS]:
Compiling od_web|web/resetPassword.dart...
[Info from Dart2JS]:
Took 0:00:04.001602 to compile od_web|web/resetPassword.dart.
[Info from Dart2JS]:
Compiling od_web|web/confirmEmail.dart...
[Info from Dart2JS]:
Took 0:00:04.114973 to compile od_web|web/confirmEmail.dart.
[Info from Dart2JS]:
Compiling od_web|web/agreement.html_bootstrap.dart...

286 methods retained for use by dart:mirrors out of 1874 total methods (15%).
[Info from Dart2JS]:
Took 0:00:07.848522 to compile od_web|web/agreement.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/join.html_bootstrap.dart...

290 methods retained for use by dart:mirrors out of 1990 total methods (15%).
[Info from Dart2JS]:
Took 0:00:06.552749 to compile od_web|web/join.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/confirmEmail.html_bootstrap.dart...

288 methods retained for use by dart:mirrors out of 1938 total methods (15%).
[Info from Dart2JS]:
Took 0:00:10.885587 to compile od_web|web/confirmEmail.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/login.html_bootstrap.dart...

288 methods retained for use by dart:mirrors out of 1942 total methods (15%).
[Info from Dart2JS]:
Took 0:00:04.825340 to compile od_web|web/login.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/tags.html_bootstrap.dart...

302 methods retained for use by dart:mirrors out of 1906 total methods (16%).
[Info from Dart2JS]:
Took 0:00:05.957166 to compile od_web|web/tags.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/load.html_bootstrap.dart...

280 methods retained for use by dart:mirrors out of 2164 total methods (13%).

This import is not annotated with @­MirrorsUsed, which may lead to unnecessarily large generated code.
Try adding '@MirrorsUsed(...)' as described at https://goo.gl/Akrrog.
import 'dart:mirrors';
^^^^^^^^^^^^^^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:07.668435 to compile od_web|web/load.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/resetPassword.html_bootstrap.dart...

294 methods retained for use by dart:mirrors out of 2026 total methods (15%).
[Info from Dart2JS]:
Took 0:00:05.272718 to compile od_web|web/resetPassword.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/profile.html_bootstrap.dart...

'smoke_8' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_8.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^

Not a compile-time constant.
          #viewmodel: const Declaration(#viewmodel, smoke_8.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:05.365087 to compile od_web|web/profile.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/list.html_bootstrap.dart...

319 methods retained for use by dart:mirrors out of 2187 total methods (15%).
[Info from Dart2JS]:
Took 0:00:07.313541 to compile od_web|web/list.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/home.html_bootstrap.dart...

321 methods retained for use by dart:mirrors out of 2199 total methods (15%).
[Info from Dart2JS]:
Took 0:00:05.168201 to compile od_web|web/home.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/data.html_bootstrap.dart...

'smoke_9' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_9.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^

Not a compile-time constant.
          #viewmodel: const Declaration(#viewmodel, smoke_9.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:05.271549 to compile od_web|web/data.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/profilewizard.html_bootstrap.dart...

'smoke_15' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_15.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^

'smoke_15' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_15.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^

Not a compile-time constant.
          #viewmodel: const Declaration(#viewmodel, smoke_15.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:02.010867 to compile od_web|web/profilewizard.html_bootstrap.dart.
[Info from Dart2JS]:
Compiling od_web|web/datawizard.html_bootstrap.dart...

Symbol literal '#_hightlightChanged' is currently unsupported by dart2js.
        #_hightlightChanged: (o) => o._hightlightChanged,
        ^^^^^^^^^^^^^^^^^^^

'smoke_14' has no member named 'T'.
          #viewmodel: const Declaration(#viewmodel, smoke_14.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^

Symbol literal '#_hightlightChanged' is currently unsupported by dart2js.
          #_hightlightChanged: const Declaration(#_hightlightChanged, Function, kind: METHOD),
          ^^^^^^^^^^^^^^^^^^^

Symbol literal '#_hightlightChanged' is currently unsupported by dart2js.
          #_hightlightChanged: const Declaration(#_hightlightChanged, Function, kind: METHOD),
                                                 ^^^^^^^^^^^^^^^^^^^

Symbol literal '#_hightlightChanged' is currently unsupported by dart2js.
        #_hightlightChanged: r'_hightlightChanged',
        ^^^^^^^^^^^^^^^^^^^

Not a compile-time constant.
          #viewmodel: const Declaration(#viewmodel, smoke_14.T, kind: PROPERTY, annotations: const [smoke_2.reflectable, smoke_1.published]),
                                                    ^^^^^^^^^^
[Info from Dart2JS]:
Took 0:00:02.543197 to compile od_web|web/datawizard.html_bootstrap.dart.
Build failed.

@DartBot
Copy link
Author

DartBot commented Apr 28, 2014

This comment was originally written by [email protected]


If you see something which could be improved please let me know :)

@sigmundch
Copy link
Member

I see. Yes, you can see that the error about mirrors comes from using the "reflection" package.

This import is not annotated with @­MirrorsUsed, which may lead to unnecessarily large generated code.
Try adding '@MirrorsUsed(...)' as described at https://goo.gl/Akrrog.
import 'dart:mirrors';
^^^^^^^^^^^^^^^^^^^^^^

Depending on what you use reflection for, you could add a @­MirrorsUsed annotation to override the default behavior of this import. By default dart2js will keep around lots of symbols assuming that you can reflectively access anything in your code. If you are using this in a very limited way, you can write:

@MirrorsUsed(..., override: const ['reflection'])
import 'dart:mirrors' show MirrorsUsed;

You can use the parameters of this annotation to say what you want to keep around at runtime. The "override" parameter tells dart2js to apply this to the import that comes from reflection.dart (which has that library name, see: https://github.com/mezoni/reflection/blob/master/lib/reflection.dart).

I personally try to avoid using mirrors unless I know how to also generate code automatically that can replace the mirror calls. This is what we do today in polymer. We do this in our initialization code and how we read data from templates. For the latter, we use 'package:smoke', a package with 2 implementations: A mirror-based implementation which we use during development in Dartium, and a second implementation that can take generated code and use it to implement the same API.

Hope this helps!

@DartBot
Copy link
Author

DartBot commented Apr 29, 2014

This comment was originally written by [email protected]


Thanks for the very helpful information!

@jmesserly
Copy link

Removed Area-Polymer label.
Added Pkg-Polymer, Area-Pkg labels.

@sigmundch
Copy link
Member

I'm closing this bug since all pending issues here are now tracked in issues 18490 and 18491.


Added Done label.

@DartBot DartBot added Type-Defect area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. labels Jul 1, 2014
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This issue has been moved to dart-archive/polymer-dart#171.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.
Projects
None yet
Development

No branches or pull requests

5 participants