From 4ece30368e164d997b05437d5ddf2251439d99e9 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 12 Jan 2021 15:19:31 +0100 Subject: [PATCH] [jOOQ/jOOQ#11200] Multithread deadlock: org.jooq.impl.AbstractField references subclass org.jooq.impl.Val in static initializer --- .../main/java/org/jooq/impl/AbstractField.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java index 1c57e50ab5..fc40fa346e 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractField.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractField.java @@ -111,8 +111,6 @@ abstract class AbstractField extends AbstractTypedNamed implements Field> TRUE_VALUES = Tools.inline(Convert.TRUE_VALUES.toArray(EMPTY_STRING)); - private static final List> FALSE_VALUES = Tools.inline(Convert.FALSE_VALUES.toArray(EMPTY_STRING)); AbstractField(Name name, DataType type) { this(name, type, null); @@ -629,19 +627,27 @@ abstract class AbstractField extends AbstractTypedNamed implements Field> TRUE_VALUES = Tools.inline(Convert.TRUE_VALUES.toArray(EMPTY_STRING)); + static final List> FALSE_VALUES = Tools.inline(Convert.FALSE_VALUES.toArray(EMPTY_STRING)); + } + @SuppressWarnings({ "unchecked" }) @Override public final Condition isTrue() { Class type = getType(); if (type == String.class) - return ((Field) this).in(TRUE_VALUES); + return ((Field) this).in(BooleanValues.TRUE_VALUES); else if (Number.class.isAssignableFrom(type)) return ((Field) this).equal(inline((Number) getDataType().convert(1))); else if (Boolean.class.isAssignableFrom(type)) return ((Field) this).equal(inline(true, (DataType) getDataType())); else - return castIfNeeded(this, String.class).in(TRUE_VALUES); + return castIfNeeded(this, String.class).in(BooleanValues.TRUE_VALUES); } @SuppressWarnings({ "unchecked" }) @@ -650,13 +656,13 @@ abstract class AbstractField extends AbstractTypedNamed implements Field type = getType(); if (type == String.class) - return ((Field) this).in(FALSE_VALUES); + return ((Field) this).in(BooleanValues.FALSE_VALUES); else if (Number.class.isAssignableFrom(type)) return ((Field) this).equal(inline((Number) getDataType().convert(0))); else if (Boolean.class.isAssignableFrom(type)) return ((Field) this).equal(inline(false, (DataType) getDataType())); else - return castIfNeeded(this, String.class).in(FALSE_VALUES); + return castIfNeeded(this, String.class).in(BooleanValues.FALSE_VALUES); } @Override