Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into metal
Browse files Browse the repository at this point in the history
  • Loading branch information
arapte committed Mar 6, 2023
2 parents a1273ca + b213450 commit 182d6f3
Show file tree
Hide file tree
Showing 291 changed files with 5,013 additions and 1,676 deletions.
2 changes: 1 addition & 1 deletion .jcheck/conf
Expand Up @@ -24,7 +24,7 @@
[general]
project=openjfx
jbs=jdk
version=openjfx21
version=jfx21

[repository]
tags=(jdk-){0,1}([1-9]([0-9]*)(\.(0|[1-9][0-9]*)){0,3})(\+(([0-9]+))|(-ga))|[1-9]((\.\d{1,3}){0,2})-((b\d{2,3})|(ga))|[1-9]u(\d{1,3})-((b\d{2,3})|(ga))
Expand Down
6 changes: 3 additions & 3 deletions UPDATING-VERSION.md
Expand Up @@ -11,7 +11,7 @@ Here are the steps to increment the JavaFX release version number to a new
feature version (for example, from 13 to 14).

* In `.jcheck/conf`, modify the `version` property in the `[general]`
section to increment the version number from `openjfx$N` to `openjfx$N+1`.
section to increment the JBS version number from `jfx$N` to `jfx$N+1`.

* In `build.properties`, modify the following properties to increment the
feature version number from `N` to `N+1`:
Expand All @@ -33,8 +33,8 @@ Here are the steps to increment the JavaFX release version number to a new
security version (for example, from 13 to 13.0.1).

* In `.jcheck/conf`, modify the `version` property in the `[general]`
section to increment the version number from `openjfx$N` to `openjfx$N.0.1`
or from `openjfx$N.0.M` to `openjfx$N.0.$M+1`.
section to increment the JBS version number from `jfx$N` to `jfx$N.0.1`
or from `jfx$N.0.M` to `jfx$N.0.$M+1`.

* In `build.properties`, modify the `jfx.release.security.version` property
to increment the security version number from `M` to `M+1`.
Expand Up @@ -79,7 +79,7 @@ public static <T> BidirectionalBinding bind(Property<T> property1, Property<T> p
public static Object bind(Property<String> stringProperty, Property<?> otherProperty, Format format) {
checkParameters(stringProperty, otherProperty);
Objects.requireNonNull(format, "Format cannot be null");
final var binding = new StringFormatBidirectionalBinding(stringProperty, otherProperty, format);
final var binding = new StringFormatBidirectionalBinding<>(stringProperty, otherProperty, format);
stringProperty.setValue(format.format(otherProperty.getValue()));
stringProperty.getValue();
stringProperty.addListener(binding);
Expand Down Expand Up @@ -854,11 +854,10 @@ public void invalidated(Observable observable) {
}
}

private static class StringFormatBidirectionalBinding extends StringConversionBidirectionalBinding {
private static class StringFormatBidirectionalBinding<T> extends StringConversionBidirectionalBinding<T> {
private final Format format;

@SuppressWarnings("unchecked")
public StringFormatBidirectionalBinding(Property<String> stringProperty, Property<?> otherProperty, Format format) {
public StringFormatBidirectionalBinding(Property<String> stringProperty, Property<T> otherProperty, Format format) {
super(stringProperty, otherProperty);
this.format = format;
}
Expand All @@ -868,9 +867,10 @@ protected String toString(Object value) {
return format.format(value);
}

@SuppressWarnings("unchecked")
@Override
protected Object fromString(String value) throws ParseException {
return format.parseObject(value);
protected T fromString(String value) throws ParseException {
return (T) format.parseObject(value); // May result in ClassCastException, this is expected
}
}

Expand Down
Expand Up @@ -76,22 +76,19 @@ public static <K, V> Object bind(ObservableMap<K, V> map1, ObservableMap<K, V> m

public static void unbind(Object obj1, Object obj2) {
checkParameters(obj1, obj2);
if ((obj1 instanceof ObservableList) && (obj2 instanceof ObservableList)) {
final ObservableList list1 = (ObservableList)obj1;
final ObservableList list2 = (ObservableList)obj2;
final ListContentBinding binding = new ListContentBinding(list1, list2);
if ((obj1 instanceof ObservableList<?> list1) && (obj2 instanceof ObservableList<?> list2)) {
@SuppressWarnings("unchecked")
final ListContentBinding<Object> binding = new ListContentBinding<>((ObservableList<Object>) list1, (ObservableList<Object>) list2);
list1.removeListener(binding);
list2.removeListener(binding);
} else if ((obj1 instanceof ObservableSet) && (obj2 instanceof ObservableSet)) {
final ObservableSet set1 = (ObservableSet)obj1;
final ObservableSet set2 = (ObservableSet)obj2;
final SetContentBinding binding = new SetContentBinding(set1, set2);
} else if ((obj1 instanceof ObservableSet<?> set1) && (obj2 instanceof ObservableSet<?> set2)) {
@SuppressWarnings("unchecked")
final SetContentBinding<Object> binding = new SetContentBinding<>((ObservableSet<Object>) set1, (ObservableSet<Object>) set2);
set1.removeListener(binding);
set2.removeListener(binding);
} else if ((obj1 instanceof ObservableMap) && (obj2 instanceof ObservableMap)) {
final ObservableMap map1 = (ObservableMap)obj1;
final ObservableMap map2 = (ObservableMap)obj2;
final MapContentBinding binding = new MapContentBinding(map1, map2);
} else if ((obj1 instanceof ObservableMap<?, ?> map1) && (obj2 instanceof ObservableMap<?, ?> map2)) {
@SuppressWarnings("unchecked")
final MapContentBinding<Object, Object> binding = new MapContentBinding<>((ObservableMap<Object, Object>) map1, (ObservableMap<Object, Object>) map2);
map1.removeListener(binding);
map2.removeListener(binding);
}
Expand Down Expand Up @@ -172,8 +169,7 @@ public boolean equals(Object obj) {
return false;
}

if (obj instanceof ListContentBinding) {
final ListContentBinding otherBinding = (ListContentBinding) obj;
if (obj instanceof ListContentBinding<?> otherBinding) {
final Object propertyB1 = otherBinding.propertyRef1.get();
final Object propertyB2 = otherBinding.propertyRef2.get();
if ((propertyB1 == null) || (propertyB2 == null)) {
Expand Down Expand Up @@ -258,8 +254,7 @@ public boolean equals(Object obj) {
return false;
}

if (obj instanceof SetContentBinding) {
final SetContentBinding otherBinding = (SetContentBinding) obj;
if (obj instanceof SetContentBinding<?> otherBinding) {
final Object propertyB1 = otherBinding.propertyRef1.get();
final Object propertyB2 = otherBinding.propertyRef2.get();
if ((propertyB1 == null) || (propertyB2 == null)) {
Expand Down Expand Up @@ -345,8 +340,7 @@ public boolean equals(Object obj) {
return false;
}

if (obj instanceof MapContentBinding) {
final MapContentBinding otherBinding = (MapContentBinding) obj;
if (obj instanceof MapContentBinding<?, ?> otherBinding) {
final Object propertyB1 = otherBinding.propertyRef1.get();
final Object propertyB2 = otherBinding.propertyRef2.get();
if ((propertyB1 == null) || (propertyB2 == null)) {
Expand Down
Expand Up @@ -49,8 +49,8 @@ private static void checkParameters(Object property1, Object property2) {
public static <E> Object bind(List<E> list1, ObservableList<? extends E> list2) {
checkParameters(list1, list2);
final ListContentBinding<E> contentBinding = new ListContentBinding<>(list1);
if (list1 instanceof ObservableList) {
((ObservableList) list1).setAll(list2);
if (list1 instanceof ObservableList<E> observableList) {
observableList.setAll(list2);
} else {
list1.clear();
list1.addAll(list2);
Expand Down Expand Up @@ -82,12 +82,21 @@ public static <K, V> Object bind(Map<K, V> map1, ObservableMap<? extends K, ? ex

public static void unbind(Object obj1, Object obj2) {
checkParameters(obj1, obj2);
if ((obj1 instanceof List) && (obj2 instanceof ObservableList)) {
((ObservableList)obj2).removeListener(new ListContentBinding((List)obj1));
} else if ((obj1 instanceof Set) && (obj2 instanceof ObservableSet)) {
((ObservableSet)obj2).removeListener(new SetContentBinding((Set)obj1));
} else if ((obj1 instanceof Map) && (obj2 instanceof ObservableMap)) {
((ObservableMap)obj2).removeListener(new MapContentBinding((Map)obj1));
if ((obj1 instanceof List<?> list1) && (obj2 instanceof ObservableList<?> list2)) {
@SuppressWarnings("unchecked")
ListContentBinding<Object> binding = new ListContentBinding<>((List<Object>) list1);

list2.removeListener(binding);
} else if ((obj1 instanceof Set<?> set1) && (obj2 instanceof ObservableSet<?> set2)) {
@SuppressWarnings("unchecked")
SetContentBinding<Object> binding = new SetContentBinding<>((Set<Object>) set1);

set2.removeListener(binding);
} else if ((obj1 instanceof Map<?, ?> map1) && (obj2 instanceof ObservableMap<?, ?> map2)) {
@SuppressWarnings("unchecked")
MapContentBinding<Object, Object> binding = new MapContentBinding<>((Map<Object, Object>) map1);

map2.removeListener(binding);
}
}

Expand Down
Expand Up @@ -554,7 +554,7 @@ protected void fireValueChangedEvent() {
final ObservableList<E> safeOldValue = (oldValue == null)?
FXCollections.<E>emptyObservableList()
: FXCollections.unmodifiableObservableList(oldValue);
change = new NonIterableChange.GenericAddRemoveChange(0, safeSize, safeOldValue, observable);
change = new NonIterableChange.GenericAddRemoveChange<>(0, safeSize, safeOldValue, observable);
}
notifyListeners(oldValue, change, false);
} else {
Expand Down

0 comments on commit 182d6f3

Please sign in to comment.