这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Sep 2, 2020. It is now read-only.

Conversation

@grantland
Copy link
Member

Removes the weird syntax:

// Before:
Task<Void>.TaskCompletionSource tcs = Task.create();

// After:
TaskCompletionSource<Void> tcs = Task.create();
TaskCompletionSource<Void> tcs = new TaskCompletionSource<>();

Deprecated APIs:
bolts.Task<TResult>.TaskCompletionSource
bolts.Task.create()

New APIs:
bolts.TaskCompletionSource<TResult> (new class, same methods as from bolts.Task<TResult>.TaskCompletionSource)
new bolts.TaskCompletionSource<>()

The constructor is so that we don't always have to use Task.create() which creates the anonymous inner class bs.

…tionSource

Removes the weird syntax:

```java
// Before:
Task<Void>.TaskCompletionSource tcs = Task.create();

// After:
TaskCompletionSource<Void> tcs = Task.create();
TaskCompletionSource<Void> tcs = new TaskCompletionSource<>();
```

Deprecated APIs:
`bolts.Task<TResult>.TaskCompletionSource`
`bolts.Task.create()`

New APIs:
`bolts.TaskCompletionSource<TResult>` (new class, same methods as from `bolts.Task<TResult>.TaskCompletionSource`)
`new bolts.TaskCompletionSource<>()`

The constructor is so that we don't always have to use `Task.create()` which creates the anonymous inner class bs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if intentional or not...

@nlutsenko
Copy link
Member

This is awesome!

@nlutsenko nlutsenko assigned grantland and unassigned nlutsenko Sep 3, 2015
@grantland
Copy link
Member Author

bolts.TaskCompletionSource<TResult> is so much cleaner than bolts.Task<TResult>.TaskCompletionSource, but is it worth @deprecating bolts.Task<TResult>.TaskCompletionSource and bolts.Task<TResult>.create()?

/cc @hallucinogen @wangmengyan95

@hallucinogen
Copy link

Looks fine to me. Seems like a breaking change? (Task<Void>.TaskCompletionSource tcs = Task.create(); will absolutely break). Though I'm not against breaking it.

@grantland
Copy link
Member Author

@hallucinogen how does that break? Task.create() is untouched and still returns the non-static inner class Task<TResult>.TaskCompletionSource so the either of the following will work:

TaskCompletionSource<Void> tcs = Task.create();
Task<Void>.TaskCompletionSource tcs = Task.create();

I've also added a unit test to ensure this.

@grantland grantland assigned depoll and unassigned grantland Sep 3, 2015
@grantland grantland removed the accepted label Sep 3, 2015
@grantland
Copy link
Member Author

@depoll it'd be great to get your opinion on this when you can 😄

@grantland grantland assigned grantland and unassigned depoll Sep 30, 2015
grantland added a commit that referenced this pull request Sep 30, 2015
Implement bolts.TaskCompletionSource, deprecate bolts.Task.TaskCompletionSource
@grantland grantland merged commit 76c9eae into master Sep 30, 2015
@grantland grantland deleted the grantland.tcs branch October 13, 2015 19:52
@grantland grantland added this to the 1.2.2 milestone Nov 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants