3059 |
|
|
3060 |
|
/** |
3061 |
|
* Returns a string identifying this CompletableFuture, as well as |
3062 |
< |
* its completion state. The state, in brackets, includes the |
3062 |
> |
* its completion state. The state, in brackets, contains the |
3063 |
|
* String {@code "Completed Normally"} or the String {@code |
3064 |
|
* "Completed Exceptionally"}, or the String {@code "Not |
3065 |
|
* completed"} followed by the number of CompletableFutures |
3068 |
|
* @return a string identifying this CompletableFuture, as well as its state |
3069 |
|
*/ |
3070 |
|
public String toString() { |
3071 |
– |
String id = super.toString(); |
3072 |
– |
int count = getNumberOfDependents(); |
3071 |
|
Object r = result; |
3072 |
< |
Throwable ex = (r != null && (r instanceof AltResult) ? |
3073 |
< |
((AltResult)r).ex : null); |
3074 |
< |
return id + (ex != null ? "[Completed exceptionally]" : |
3075 |
< |
(r != null ? "[Completed normally]" : |
3076 |
< |
(count == 0 ? "[Not completed]" : |
3077 |
< |
("[Not completed, " + count + " dependents]")))); |
3072 |
> |
int count; |
3073 |
> |
return super.toString() + |
3074 |
> |
((r == null) ? |
3075 |
> |
(((count = getNumberOfDependents()) == 0) ? |
3076 |
> |
"[Not completed]" : |
3077 |
> |
"[Not completed, " + count + " dependents]") : |
3078 |
> |
(((r instanceof AltResult) && ((AltResult)r).ex != null) ? |
3079 |
> |
"[Completed exceptionally]" : |
3080 |
> |
"[Completed normally]")); |
3081 |
|
} |
3082 |
|
|
3083 |
|
// Unsafe mechanics |