google / google/jsinterop-generator

If a static property and an instance property are defined on the same type, the instance property is omitted

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
85
Forks
24
PR merge metrics
No merged PRs in 30d

Description

(Discovered while testing #46)

Given this JS, the expected behavior presently is that `_STATIC` will be appended to the `static` version since these would otherwise collide. Instead, we see a few different behaviors, I can't yet explain what is happening here:

Example JS:
```
/**
* @type {string}
*/
Foo.plainProperty;

/**
* @type {string}
*/
Foo.prototype.plainProperty;
```
Resulting Java, with only one field and no `_STATIC` present on the static member:
```
public static String plainProperty;
```

Example JS:
```
/**
* @type {string|number}
*/
Foo.unionProperty;
/**
* @type {string|number}
*/
Foo.prototype.unionProperty;
```

Resulting Java (union type omittied), correctly with two fields:
```
@JsProperty(name = "unionProperty")
public static Foo.StaticUnionPropertyUnionType unionProperty_STATIC;

public Foo.UnionPropertyUnionType unionProperty;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.