Skip to content

Commit d37df9c

Browse files
[jnigen] Use dollar signs for nested class name separator (#1791)
* Close #1516
1 parent da5dc14 commit d37df9c

File tree

13 files changed

+1157
-1084
lines changed

13 files changed

+1157
-1084
lines changed

pkgs/jnigen/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 0.13.0-wip
22

3+
- **Breaking Change**([#1516](https://github.com/dart-lang/native/issues/1516)):
4+
Inner classes are now generated as `OuterClass$InnerClass`.
35
- **Breaking Change**([#1644](https://github.com/dart-lang/native/issues/1644)):
46
Generate null-safe Dart bindings for Java and Kotlin.
57
- Fixed a potential name collision when generating in multi-file mode.

pkgs/jnigen/doc/java_differences.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,27 @@ class $_Example extends JObject {
213213
void $_printMessage() { /* ... */ }
214214
}
215215
```
216+
217+
### Inner classes
218+
219+
Java has the concept of inner classes, while Dart does not. Therefore, inner
220+
classes are generated as separate classes named using the name of their
221+
outer-class followed by a dollar sign (`$`) followed by their original name.
222+
223+
For example:
224+
225+
```java
226+
// Java
227+
public class Outer {
228+
public class Inner {}
229+
}
230+
```
231+
232+
will be turned into:
233+
234+
```dart
235+
// Dart Bindings - Boilerplate omitted for clarity.
236+
class Outer extends JObject {}
237+
238+
class Outer$Inner extends JObject {}
239+
```

0 commit comments

Comments
 (0)