Commit 53339f9
committed
Support generating locals that reference generated class types (#146)
We have had support for the const-class operation, but it was only possible to
fill a local with the value of a Class object you could reference in the geneeration
context. This meant that it was not possible to generate a reference to a generated
class, as it did not exist in the class loader until after the generation was finished
and the new class loader could be used.
The real issue here is the restriction of the loadConstant() method, which requires an
actual Class object. This class object gets turned into a string internally for code
generation, and so we don't actually need a real class to fill the variable value
correctly. Using a TypeId will still get converted to a ConstantInsn under the hood,
and the value will be assigned correctly.1 parent dfad9e8 commit 53339f9
File tree
2 files changed
+36
-4
lines changed- dexmaker-tests/src/androidTest/java/com/android/dx
- dexmaker/src/main/java/com/android/dx
2 files changed
+36
-4
lines changedLines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
174 | 194 | | |
175 | 195 | | |
176 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
479 | 491 | | |
480 | | - | |
481 | | - | |
| 492 | + | |
| 493 | + | |
482 | 494 | | |
483 | 495 | | |
484 | | - | |
| 496 | + | |
485 | 497 | | |
486 | 498 | | |
487 | | - | |
| 499 | + | |
488 | 500 | | |
489 | 501 | | |
490 | 502 | | |
| |||
0 commit comments