Skip to content

Commit e63e9aa

Browse files
committed
Switched type arguments of TypedDataField (#3)
1 parent e70cbd3 commit e63e9aa

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## [Unreleased]
44
### Removed
5-
- **BREAKING** Removed `ColorPool.getSystemColor()`.
5+
- **BREAKING** Removed `ColorPool.getSystemColor()` ([#8](https://github.com/diffplug/durian-swt/issues/8)).
6+
- **BREAKING** Switched type arguments of `TypedDataField` ([#3](https://github.com/diffplug/durian-swt/issues/3)).
67

78
## [3.6.1] - 2022-02-18
89
### Fixed

durian-swt/src/main/java/com/diffplug/common/swt/TypedDataField.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 DiffPlug
2+
* Copyright (C) 2020-2022 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,14 +30,14 @@
3030
* field.set(widget, model);
3131
* ```
3232
*/
33-
public class TypedDataField<T, W extends Widget> {
33+
public class TypedDataField<W extends Widget, T> {
3434
/** Creates a TypedDataField for `setData(String key, Object value)`. */
35-
public static <T, W extends Widget> TypedDataField<T, W> create(String key) {
35+
public static <T, W extends Widget> TypedDataField<W, T> create(String key) {
3636
return new TypedDataField<>(key);
3737
}
3838

3939
/** Creates a TypedDataField for `setData(Object value)`. */
40-
public static <T, W extends Widget> TypedDataField<T, W> create() {
40+
public static <T, W extends Widget> TypedDataField<W, T> create() {
4141
return new TypedDataField<>(null);
4242
}
4343

@@ -48,13 +48,13 @@ public static <T, W extends Widget> TypedDataField<T, W> create() {
4848
this.key = key;
4949
}
5050

51-
public T get(Widget widget) {
51+
public T get(W widget) {
5252
return Objects.requireNonNull(getNullable(widget));
5353
}
5454

5555
@SuppressWarnings("unchecked")
5656
@Nullable
57-
public T getNullable(Widget widget) {
57+
public T getNullable(W widget) {
5858
if (key == null) {
5959
return (T) widget.getData();
6060
} else {

0 commit comments

Comments
 (0)