Skip to content

Injection conflicts with Computed properties #23

@adrienbaron

Description

@adrienbaron

If an @Inject property has the same name as a computed property then the injection breaks for that property.

For example:

@Inject
TreeController treeController;

@Computed
public TreeController getTreeController() {
    return treeController;
}

The problem comes from the Component generated JsType. It in inherits from the Component Class and adds attributes for Computed properties.

It also adds a method to deal with injection. In this method the following code gets generated to copy injected properties on the Component instance at runtime:

treeController = dependencies.treeController;

But we should actually generate this, in case a computed property with the same name masks this attribute:

super.treeController = dependencies.treeController;

This masking can occur because non JsInterop properties on the Component class get minified whereas name of properties in the JsType are kept. Therefore they are different at runtime.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions