Commit fa7078e
committed
[generator] refactoring for methods
In the same fashion that 7a96efe refactored fields, this commit aims at
refactoring methods. I also added various unit tests to add coverage
around the new `TestMethod` support type.
Refactoring in generator:
- Dropped the method "support" classes in favor of extension methods
from `ManagedExtensions` and `XmlExtensions`. These existed due to C#
single-inheritance getting in the way of the relationship between
methods, properties, constructors, etc.
- Moved methods from `Method` and `MethodBase` to `CodeGenerator` and
renamed them from `Generate*` to `WriteMethod*`. I tried to not modify
the code in these methods other than to add a parameter for the incoming
method.
- Output of generator *should* remain the same.
- `*Method` classes are now alot closer to POCOs
Other changes:
- Dropped usage of `ContextTypes` stack in `XamarinAndroidCodeGenerator`
- Added a base test class for `JavaInteropCodeGeneratorTests` and
`XamarinAndroidCodeGeneratorTests` because there were several tests that
were completely identical (due to `CodeGenerator` base class)
- Changed `StreamWriter` to `TextWriter` as needed
- Now up to 88 tests! Most new ones are ~1ms
Future plans (trying to keep this commit of reasonable size):
- The `CodeGenerator` base class is starting to get large. As
refactoring continues, I would like to make a class for
`FieldGenerator`, `MethodGenerator`, etc. and `CodeGenerator` would get
properties named `Fields` and `Methods` that would return these child
generator classes
- This is exactly what grendel did with his prototype, so we should
adopt this improvement:
https://github.com/grendello/JavaBindingGenerator/blob/fb8864d1842bdf0b8d45eb04b89ef2bd57de0014/src/Java.Interop.Bindings/Compiler/MethodCodeGenerator.cs1 parent 6023584 commit fa7078e
File tree
16 files changed
+1283
-669
lines changed- tools/generator
- Tests
- Unit-Tests
16 files changed
+1283
-669
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 18 | + | |
27 | 19 | | |
28 | 20 | | |
29 | 21 | | |
| |||
352 | 344 | | |
353 | 345 | | |
354 | 346 | | |
355 | | - | |
| 347 | + | |
356 | 348 | | |
357 | | - | |
| 349 | + | |
358 | 350 | | |
359 | 351 | | |
360 | 352 | | |
| |||
497 | 489 | | |
498 | 490 | | |
499 | 491 | | |
500 | | - | |
| 492 | + | |
501 | 493 | | |
502 | 494 | | |
503 | 495 | | |
| |||
631 | 623 | | |
632 | 624 | | |
633 | 625 | | |
634 | | - | |
| 626 | + | |
635 | 627 | | |
636 | 628 | | |
637 | 629 | | |
638 | | - | |
| 630 | + | |
639 | 631 | | |
640 | 632 | | |
641 | 633 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 18 | + | |
24 | 19 | | |
25 | 20 | | |
| 21 | + | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
| |||
31 | 27 | | |
32 | 28 | | |
33 | 29 | | |
34 | | - | |
| 30 | + | |
35 | 31 | | |
36 | 32 | | |
37 | 33 | | |
| |||
52 | 48 | | |
53 | 49 | | |
54 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
64 | | - | |
| 67 | + | |
65 | 68 | | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| |||
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
128 | 137 | | |
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
132 | | - | |
133 | | - | |
| 141 | + | |
| 142 | + | |
134 | 143 | | |
135 | 144 | | |
136 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
211 | | - | |
| 210 | + | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
| 291 | + | |
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
| 635 | + | |
636 | 636 | | |
637 | | - | |
| 637 | + | |
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| |||
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
717 | | - | |
| 717 | + | |
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
0 commit comments