Transpiled version (131L) is out of date.
1 | // Can a be converted to b? |
2 | |
3 | // score 0 = exact match |
4 | // score Int.MAX_VALUE = no match |
5 | // score 1 = conversion needed (boxing/unboxing or non-primitve widening) |
6 | // score -2 = primitive widening needed |
7 | |
8 | static int typeConversionScoreWithUnboxing(Class a, Class b) {
|
9 | int score = typeConversionScore(a, b); |
10 | if (score == 0 || score == 1) ret score; |
11 | |
12 | Class aPrim = boxedToPrimitiveType(a); |
13 | if (aPrim != null) {
|
14 | int score2 = typeConversionScore(aPrim, b); |
15 | if (score2 == 0) ret 1; |
16 | else if (score2 != Int.MAX_VALUE) ret score2; |
17 | } |
18 | ret score; |
19 | } |
Began life as a copy of #1034747
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034755 |
| Snippet name: | typeConversionScoreWithUnboxing |
| Eternal ID of this version: | #1034755/6 |
| Text MD5: | 1113801f2f7b71c0cd591459d8fb22cc |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-08 03:47:52 |
| Source code size: | 579 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 363 / 472 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |