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

Component generator has inconsistent behaviors #4453

Closed
ZheSun88 opened this issue Jul 30, 2018 · 2 comments
Closed

Component generator has inconsistent behaviors #4453

ZheSun88 opened this issue Jul 30, 2018 · 2 comments
Assignees

Comments

@ZheSun88
Copy link
Contributor

ZheSun88 commented Jul 30, 2018

This issue occurs when generates code for vaadin-time-picker:

Behavior 1:
when i am using only "vaadin-time-picker": "1.0.0-beta1" in the bower.json, we will get two generated java files successfully, in the GeneratedVaadinTimePickerTextField.java file, we can see the signature:

public abstract class GeneratedVaadinTimePickerTextField<R extends GeneratedVaadinTimePickerTextField<R, T>, T>
        extends AbstractSinglePropertyField<R, T> implements HasStyle {

Behavior 2:
if i am adding "vaadin-time-picker": "1.0.0-beta1" to bower.json with updated webcomponent version (will list the bower file next), we will get a compilation failure on the generation, the signature of GeneratedVaadinTimePickerTextField.java is

public abstract class GeneratedVaadinTimePickerTextField<R extends GeneratedVaadinTimePickerTextField<R>>
        extends GeneratedVaadinTextField<R> implements HasStyle {

and there is not import for the GeneratedVaadinTextField and the usage is wrong because the parent should take two parameters like GeneratedVaadinTextField<R, T>

further investigation on the next thread

@ZheSun88
Copy link
Contributor Author

ZheSun88 commented Jul 30, 2018

the bower.json file used for the 2nd case:

    "vaadin-text-field": "2.1.0-beta2",
    "vaadin-time-picker": "1.0.0-beta1"

some investigations:
in the 2nd case, the webcomponent-api-analyzer cannot provide a correct .json file for the vaadin-time-picker-text-field and from the log, it shows

 Element: vaadin-time-picker-text-field baseUrl: vaadin-time-picker/src/vaadin-time-picker-text-field.html extends: Vaadin.TextFieldElement, template: false
[INFO]     behaviors:
[INFO]     kinds: class,element,polymer-element
[INFO]     identifiers: Vaadin.TimePickerTextFieldElement,vaadin-time-picker-text-field
[INFO]     mixins:
[INFO] Generating JSON for vaadin-time-picker-text-field
[INFO]     Wrote 0 properties out of 23
[INFO]     Wrote 0 methods out of 22
[INFO]     Wrote 0 events out of 1

@ZheSun88 ZheSun88 added the bug label Jul 30, 2018
@ZheSun88 ZheSun88 added this to the 1.0 Maintenance milestone Jul 30, 2018
@ZheSun88 ZheSun88 self-assigned this Aug 1, 2018
@ZheSun88
Copy link
Contributor Author

ZheSun88 commented Aug 1, 2018

i am not sure which is the correct behavior, it looks both cases have some incorrect part:

for case 1): the vaadin-time-picker-text-field.html has an import for text-field, so it can be understood as the parent https://github.com/vaadin/vaadin-time-picker/blob/master/src/vaadin-time-picker-text-field.html#L7 , so the generated class should extends from TextField

for case 2): the generated file is using wrong signature and without correct import

possibly related to https://github.com/vaadin/flow/blob/master/flow-components-parent/flow-webcomponent-api-analyzer/lib/js/element-json-transform.js#L142

when there is only one dependency, the parentClassDate returns undefined. After add vaadin-text-field dependency to bower.json, it returns vaadin-text-field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant