Swift name should only be set if it's different than the Objective C name
- Dominant language
- Java
- Stars
- 6k
- Forks
- 999
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 14
Description
Class properties and enums are now declared with NS_SWIFT_NAME, such as this constant:
```
@property (readonly, class) jint FOO NS_SWIFT_NAME(FOO);
@property (readonly, class) jint EOF_ NS_SWIFT_NAME(EOF_);
```
There are two problems with the above. First, there's no reason to define an NS_SWIFT_NAME, since it's the same name. Second, the Java name is EOF, but the trailing underscore is necessary because it's a preprocessor constant from a common system header. Since Swift doesn't use the preprocessor, the Swift name just be the Java name (unless it's a Swift reserved word). So better code would look like:
```
@property (readonly, class) jint FOO;
@property (readonly, class) jint EOF_ NS_SWIFT_NAME(EOF);
```
Contributor guide
Assessment
This issue has not been assessed yet.