mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-27 03:46:17 -06:00
use AtomicReference for method parameters that return values
This commit is contained in:
@@ -18,6 +18,7 @@ package com.formdev.flatlaf;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
import com.formdev.flatlaf.UIDefaultsLoader.ValueType;
|
||||
|
||||
@@ -57,14 +58,14 @@ public class UIDefaultsLoaderAccessor
|
||||
return UIDefaultsLoader.resolveValue( value, propertiesGetter );
|
||||
}
|
||||
|
||||
public static Object parseValue( String key, String value, Object[] resultValueType,
|
||||
public static Object parseValue( String key, String value, AtomicReference<Object> resultValueType,
|
||||
Function<String, String> resolver )
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
ValueType[] resultValueType2 = new ValueType[1];
|
||||
AtomicReference<ValueType> resultValueType2 = new AtomicReference<>();
|
||||
Object result = UIDefaultsLoader.parseValue( key, value, null,
|
||||
resultValueType2, resolver, Collections.emptyList() );
|
||||
resultValueType[0] = resultValueType2[0];
|
||||
resultValueType.set( resultValueType2.get() );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
import javax.swing.UIDefaults;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
@@ -96,7 +97,7 @@ class FlatThemePropertiesSupport
|
||||
return null;
|
||||
|
||||
try {
|
||||
Object[] resultValueType = new Object[1];
|
||||
AtomicReference<Object> resultValueType = new AtomicReference<>();
|
||||
String value = resolveValue( keyValue.value );
|
||||
parsedValue = UIDefaultsLoaderAccessor.parseValue( keyValue.key, value, resultValueType, resolver );
|
||||
parsedValueCache.put( lineKey, parsedValue );
|
||||
@@ -156,7 +157,7 @@ class FlatThemePropertiesSupport
|
||||
return null;
|
||||
|
||||
try {
|
||||
Object[] resultValueType = new Object[1];
|
||||
AtomicReference<Object> resultValueType = new AtomicReference<>();
|
||||
String value = resolveValue( str );
|
||||
parsedValue = UIDefaultsLoaderAccessor.parseValue( key, value, resultValueType, resolver );
|
||||
parsedValueCache2.put( key, parsedValue );
|
||||
|
||||
Reference in New Issue
Block a user