google / google/j2objc

[JavaLangStringBuilder isEmpty]: unrecognized selector sent to instance

Open
#2,823 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6k
Forks
999
Avg merge
19h 20m
Merged PRs (30d)
14

Description

Running transpiled code like this
```java
StringBuilder sb = new StringBuilder();
if (sb.isEmpty()) {
sb.append("");
}
```
I get
```
[JavaLangStringBuilder isEmpty]: unrecognized selector sent to instance
```
using self-compiled j2objc version 7e76bfd.
The default implementation is present at that commit: https://github.com/google/j2objc/blame/7e76bfd/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/CharSequence.java#L89
so I'm not sure where the problem is.

Contributor guide

Open the contributing guide

Research direction

Reproduce the Java StringBuilder example and inspect the generated Objective-C behavior behind the isEmpty call. Compare that behavior with the default implementation at jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/CharSequence.java:89. Done means the sample no longer raises an unrecognized-selector error when calling StringBuilder.isEmpty().

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.