Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jdereg committed Dec 24, 2024
1 parent 37562c4 commit 485c3d5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main/java/com/cedarsoftware/util/CompactMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ public class CompactMap<K, V> implements Map<K, V> {
// The only "state" and why this is a compactMap - one member variable
protected Object val = EMPTY_MAP;

protected interface FactoryCreated { }

/**
* Constructs an empty CompactMap with the default configuration.
* <p>
Expand Down Expand Up @@ -1192,7 +1190,7 @@ protected int capacity() {
}

protected boolean isCaseInsensitive() {
if (getClass() != CompactMap.class && !(this instanceof FactoryCreated)) {
if (getClass() != CompactMap.class) {
Method method = ReflectionUtils.getMethod(getClass(), "isCaseInsensitive");
if (method != null && method.getDeclaringClass() == CompactMap.class) {
Map<String, Object> inferredOptions = INFERRED_OPTIONS.get();
Expand Down Expand Up @@ -1223,7 +1221,7 @@ protected int compactSize() {
* @return the ordering strategy for this map
*/
protected String getOrdering() {
if (getClass() != CompactMap.class && !(this instanceof FactoryCreated)) {
if (getClass() != CompactMap.class) {
Method method = ReflectionUtils.getMethod(getClass(), "getOrdering");
// Changed condition - if method is null, we use inferred options
// since this means the subclass doesn't override getOrdering()
Expand Down Expand Up @@ -1515,7 +1513,7 @@ private void initializeLegacyConfig() {
* @throws IllegalArgumentException if the provided options are invalid or incompatible
* @see #validateAndFinalizeOptions(Map)
*/
public static <K, V> CompactMap<K, V> newMap(Map<String, Object> options) {
static <K, V> CompactMap<K, V> newMap(Map<String, Object> options) {
// Validate and finalize options first (existing code)
validateAndFinalizeOptions(options);

Expand Down Expand Up @@ -1550,7 +1548,6 @@ static void validateAndFinalizeOptions(Map<String, Object> options) {
Class<? extends Map> mapType = determineMapType(options, ordering);

// Store both the class and its name
options.put("MAP_TYPE_CLASS", mapType);
options.put(MAP_TYPE, mapType); // Keep it as Class object

// Special handling for unsupported map types
Expand Down

0 comments on commit 485c3d5

Please sign in to comment.