Skip to content

Commit

Permalink
[#11196] Drop support for Java 6 and 7
Browse files Browse the repository at this point in the history
- More IntelliJ inspections fixed
  • Loading branch information
lukaseder committed Jan 8, 2021
1 parent ed9cf84 commit 5493815
Show file tree
Hide file tree
Showing 33 changed files with 148 additions and 322 deletions.
9 changes: 7 additions & 2 deletions .gitignore
@@ -1,4 +1,9 @@
/target
*.iml
.idea
.data/
# Include top level code styles and inspection profile
.idea/.*
.idea/*.xml
.idea/libraries
.data/
# Ignore project level .idea folders
*/.idea
Expand Up @@ -358,10 +358,10 @@ public List<String> getJavaClassImplements(Definition definition, Mode mode) {
String result = null;

switch (mode) {
case DEFAULT: result = match(definition, embeddables.getExpression(), embeddables.getRecordImplements()); break;
case INTERFACE: result = match(definition, embeddables.getExpression(), embeddables.getInterfaceImplements()); break;
case POJO: result = match(definition, embeddables.getExpression(), embeddables.getPojoImplements()); break;
case RECORD: result = match(definition, embeddables.getExpression(), embeddables.getRecordImplements()); break;
case RECORD:
case DEFAULT: result = match(definition, embeddables.getExpression(), embeddables.getRecordImplements()); break;
}

if (result != null)
Expand Down Expand Up @@ -421,10 +421,10 @@ public String getJavaClassName(Definition definition, Mode mode) {
String result = null;

switch (mode) {
case DEFAULT: result = match(definition, embeddables.getExpression(), embeddables.getRecordClass()); break;
case INTERFACE: result = match(definition, embeddables.getExpression(), embeddables.getInterfaceClass()); break;
case POJO: result = match(definition, embeddables.getExpression(), embeddables.getPojoClass()); break;
case RECORD: result = match(definition, embeddables.getExpression(), embeddables.getRecordClass()); break;
case RECORD:
case DEFAULT: result = match(definition, embeddables.getExpression(), embeddables.getRecordClass()); break;
}

if (result != null)
Expand Down
Expand Up @@ -105,7 +105,7 @@ protected void export() throws Exception {
}

// [#9058] Properties use camelCase notation.
boolean useAttributeConverters = Boolean.valueOf(
boolean useAttributeConverters = Boolean.parseBoolean(
getProperties().getProperty("useAttributeConverters",
getProperties().getProperty("use-attribute-converters", "true")
)
Expand Down
Expand Up @@ -101,7 +101,7 @@ public class LiquibaseDatabase extends AbstractInterpretingDatabase {
@Override
protected void export() throws Exception {
String scripts = getProperties().getProperty("scripts");
includeLiquibaseTables = Boolean.valueOf(getProperties().getProperty("includeLiquibaseTables", "false"));
includeLiquibaseTables = Boolean.parseBoolean(getProperties().getProperty("includeLiquibaseTables", "false"));

if (isBlank(scripts)) {
scripts = "";
Expand Down
2 changes: 1 addition & 1 deletion jOOQ-meta/src/main/java/org/jooq/meta/BufferedLog.java
Expand Up @@ -82,7 +82,7 @@ public static synchronized void flush() {
case TRACE: delegate.trace(m.message, m.details, m.throwable); break;
case INFO: delegate.info (m.message, m.details, m.throwable); break;
case WARN: delegate.warn (m.message, m.details, m.throwable); break;
case ERROR: delegate.error(m.message, m.details, m.throwable); break;
case ERROR:
case FATAL: delegate.error(m.message, m.details, m.throwable); break;
}

Expand Down
Expand Up @@ -240,7 +240,7 @@ private List<Integer> decode(String descriptor) {

if (split != null)
for (String index : split)
result.add(Integer.valueOf(index.trim()) - 1);
result.add(Integer.parseInt(index.trim()) - 1);
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion jOOQ/src/main/java/org/jooq/impl/AbstractDataTypeX.java
Expand Up @@ -77,7 +77,7 @@ abstract AbstractDataTypeX<T> construct(

@Override
public final DataType<T> nullability(Nullability n) {
return construct(precision0(), scale0(), length0(), n, collation(), characterSet(), n.nullable() ? false : identity(), defaultValue());
return construct(precision0(), scale0(), length0(), n, collation(), characterSet(), !n.nullable() && identity(), defaultValue());
}

@Override
Expand Down
2 changes: 0 additions & 2 deletions jOOQ/src/main/java/org/jooq/impl/AbstractQuery.java
Expand Up @@ -161,7 +161,6 @@ public final Param<?> getParam(String name) {
* <p>
* {@inheritDoc}
*/
@SuppressWarnings("deprecation")
@Override
public Query bind(String param, Object value) {
Integer index = Ints.tryParse(param);
Expand All @@ -188,7 +187,6 @@ public Query bind(String param, Object value) {
* <p>
* {@inheritDoc}
*/
@SuppressWarnings("deprecation")
@Override
public Query bind(int index, Object value) {
Param<?>[] params = getParams().values().toArray(EMPTY_PARAM);
Expand Down
8 changes: 0 additions & 8 deletions jOOQ/src/main/java/org/jooq/impl/Alias.java
Expand Up @@ -123,14 +123,6 @@ final class Alias<Q extends QueryPart> extends AbstractQueryPart {
this(wrapped, wrapping, alias, null, false);
}

Alias(Q wrapped, Q wrapping, Name alias, boolean wrapInParentheses) {
this(wrapped, wrapping, alias, null, wrapInParentheses);
}

Alias(Q wrapped, Q wrapping, Name alias, Name[] fieldAliases) {
this(wrapped, wrapping, alias, fieldAliases, false);
}

Alias(Q wrapped, Q wrapping, Name alias, Name[] fieldAliases, boolean wrapInParentheses) {
this.wrapped = wrapped;
this.wrapping = wrapping;
Expand Down
5 changes: 0 additions & 5 deletions jOOQ/src/main/java/org/jooq/impl/AlterTableImpl.java
Expand Up @@ -1742,11 +1742,6 @@ private final void acceptDropColumn(Context<?> ctx) {








default:
ctx.visit(K_DROP);
break;
Expand Down
4 changes: 0 additions & 4 deletions jOOQ/src/main/java/org/jooq/impl/CurrentSchema.java
Expand Up @@ -95,10 +95,6 @@ public final void accept(Context<?> ctx) {







case CUBRID:
case FIREBIRD:
case SQLITE:
Expand Down
59 changes: 26 additions & 33 deletions jOOQ/src/main/java/org/jooq/impl/DefaultBinding.java
Expand Up @@ -116,7 +116,6 @@
import static org.jooq.impl.Tools.getMappedUDTName;
import static org.jooq.impl.Tools.needsBackslashEscaping;
import static org.jooq.tools.StringUtils.leftPad;
import static org.jooq.tools.jdbc.JDBCUtils.safeClose;
import static org.jooq.tools.jdbc.JDBCUtils.safeFree;
import static org.jooq.tools.jdbc.JDBCUtils.wasNull;
import static org.jooq.tools.reflect.Reflect.on;
Expand Down Expand Up @@ -1711,17 +1710,17 @@ final void set0(BindingSetSQLOutputContext<U> ctx, Boolean value) throws SQLExce

@Override
final Boolean get0(BindingGetResultSetContext<U> ctx) throws SQLException {
return wasNull(ctx.resultSet(), Boolean.valueOf(ctx.resultSet().getBoolean(ctx.index())));
return wasNull(ctx.resultSet(), ctx.resultSet().getBoolean(ctx.index()));
}

@Override
final Boolean get0(BindingGetStatementContext<U> ctx) throws SQLException {
return wasNull(ctx.statement(), Boolean.valueOf(ctx.statement().getBoolean(ctx.index())));
return wasNull(ctx.statement(), ctx.statement().getBoolean(ctx.index()));
}

@Override
final Boolean get0(BindingGetSQLInputContext<U> ctx) throws SQLException {
return wasNull(ctx.input(), Boolean.valueOf(ctx.input().readBoolean()));
return wasNull(ctx.input(), ctx.input().readBoolean());
}

@Override
Expand Down Expand Up @@ -1769,17 +1768,17 @@ final void set0(BindingSetSQLOutputContext<U> ctx, Byte value) throws SQLExcepti

@Override
final Byte get0(BindingGetResultSetContext<U> ctx) throws SQLException {
return wasNull(ctx.resultSet(), Byte.valueOf(ctx.resultSet().getByte(ctx.index())));
return wasNull(ctx.resultSet(), ctx.resultSet().getByte(ctx.index()));
}

@Override
final Byte get0(BindingGetStatementContext<U> ctx) throws SQLException {
return wasNull(ctx.statement(), Byte.valueOf(ctx.statement().getByte(ctx.index())));
return wasNull(ctx.statement(), ctx.statement().getByte(ctx.index()));
}

@Override
final Byte get0(BindingGetSQLInputContext<U> ctx) throws SQLException {
return wasNull(ctx.input(), Byte.valueOf(ctx.input().readByte()));
return wasNull(ctx.input(), ctx.input().readByte());
}

@Override
Expand Down Expand Up @@ -2325,17 +2324,17 @@ final void set0(BindingSetSQLOutputContext<U> ctx, Double value) throws SQLExcep

@Override
final Double get0(BindingGetResultSetContext<U> ctx) throws SQLException {
return wasNull(ctx.resultSet(), Double.valueOf(ctx.resultSet().getDouble(ctx.index())));
return wasNull(ctx.resultSet(), ctx.resultSet().getDouble(ctx.index()));
}

@Override
final Double get0(BindingGetStatementContext<U> ctx) throws SQLException {
return wasNull(ctx.statement(), Double.valueOf(ctx.statement().getDouble(ctx.index())));
return wasNull(ctx.statement(), ctx.statement().getDouble(ctx.index()));
}

@Override
final Double get0(BindingGetSQLInputContext<U> ctx) throws SQLException {
return wasNull(ctx.input(), Double.valueOf(ctx.input().readDouble()));
return wasNull(ctx.input(), ctx.input().readDouble());
}

@Override
Expand Down Expand Up @@ -2363,12 +2362,7 @@ static final class DefaultEnumTypeBinding<U> extends AbstractBinding<EnumType, U

@Override
final void sqlInline0(BindingSQLContext<U> ctx, EnumType value) throws SQLException {
String literal = value.getLiteral();

if (literal == null)
binding(VARCHAR).sql(new DefaultBindingSQLContext<>(ctx.configuration(), ctx.data(), ctx.render(), literal));
else
binding(VARCHAR).sql(new DefaultBindingSQLContext<>(ctx.configuration(), ctx.data(), ctx.render(), literal));
binding(VARCHAR).sql(new DefaultBindingSQLContext<>(ctx.configuration(), ctx.data(), ctx.render(), value.getLiteral()));
}

@Override
Expand Down Expand Up @@ -2500,17 +2494,17 @@ final void set0(BindingSetSQLOutputContext<U> ctx, Float value) throws SQLExcept

@Override
final Float get0(BindingGetResultSetContext<U> ctx) throws SQLException {
return wasNull(ctx.resultSet(), Float.valueOf(ctx.resultSet().getFloat(ctx.index())));
return wasNull(ctx.resultSet(), ctx.resultSet().getFloat(ctx.index()));
}

@Override
final Float get0(BindingGetStatementContext<U> ctx) throws SQLException {
return wasNull(ctx.statement(), Float.valueOf(ctx.statement().getFloat(ctx.index())));
return wasNull(ctx.statement(), ctx.statement().getFloat(ctx.index()));
}

@Override
final Float get0(BindingGetSQLInputContext<U> ctx) throws SQLException {
return wasNull(ctx.input(), Float.valueOf(ctx.input().readFloat()));
return wasNull(ctx.input(), ctx.input().readFloat());
}

@Override
Expand Down Expand Up @@ -2552,17 +2546,17 @@ final void set0(BindingSetSQLOutputContext<U> ctx, Integer value) throws SQLExce

@Override
final Integer get0(BindingGetResultSetContext<U> ctx) throws SQLException {
return wasNull(ctx.resultSet(), Integer.valueOf(ctx.resultSet().getInt(ctx.index())));
return wasNull(ctx.resultSet(), ctx.resultSet().getInt(ctx.index()));
}

@Override
final Integer get0(BindingGetStatementContext<U> ctx) throws SQLException {
return wasNull(ctx.statement(), Integer.valueOf(ctx.statement().getInt(ctx.index())));
return wasNull(ctx.statement(), ctx.statement().getInt(ctx.index()));
}

@Override
final Integer get0(BindingGetSQLInputContext<U> ctx) throws SQLException {
return wasNull(ctx.input(), Integer.valueOf(ctx.input().readInt()));
return wasNull(ctx.input(), ctx.input().readInt());
}

@Override
Expand Down Expand Up @@ -2605,17 +2599,17 @@ final void set0(BindingSetSQLOutputContext<U> ctx, Long value) throws SQLExcepti

@Override
final Long get0(BindingGetResultSetContext<U> ctx) throws SQLException {
return wasNull(ctx.resultSet(), Long.valueOf(ctx.resultSet().getLong(ctx.index())));
return wasNull(ctx.resultSet(), ctx.resultSet().getLong(ctx.index()));
}

@Override
final Long get0(BindingGetStatementContext<U> ctx) throws SQLException {
return wasNull(ctx.statement(), Long.valueOf(ctx.statement().getLong(ctx.index())));
return wasNull(ctx.statement(), ctx.statement().getLong(ctx.index()));
}

@Override
final Long get0(BindingGetSQLInputContext<U> ctx) throws SQLException {
return wasNull(ctx.input(), Long.valueOf(ctx.input().readLong()));
return wasNull(ctx.input(), ctx.input().readLong());
}

@Override
Expand Down Expand Up @@ -2810,6 +2804,10 @@ final void sqlInline0(BindingSQLContext<U> ctx, OffsetDateTime value) {
SQLDialect family = ctx.family();

switch (family) {




// [#5895] HSQLDB derives the specific data type from the literal
case HSQLDB:
ctx.render().visit(K_TIMESTAMP).sql(" '").sql(escape(format(value, family), ctx.render())).sql('\'');
Expand All @@ -2828,10 +2826,6 @@ final void sqlInline0(BindingSQLContext<U> ctx, OffsetDateTime value) {







// Some dialects implement SQL standard time literals
default:
ctx.render().visit(K_TIMESTAMP_WITH_TIME_ZONE).sql(" '").sql(escape(format(value, family), ctx.render())).sql('\'');
Expand Down Expand Up @@ -3121,7 +3115,6 @@ static final class DefaultInstantBinding<U> extends AbstractBinding<Instant, U>
*/
private static final long serialVersionUID = -1850495302106551527L;

@SuppressWarnings("unchecked")
private static final Converter<OffsetDateTime, Instant> CONVERTER = Converter.ofNullable(
OffsetDateTime.class,
Instant.class,
Expand Down Expand Up @@ -3694,17 +3687,17 @@ final void set0(BindingSetSQLOutputContext<U> ctx, Short value) throws SQLExcept

@Override
final Short get0(BindingGetResultSetContext<U> ctx) throws SQLException {
return wasNull(ctx.resultSet(), Short.valueOf(ctx.resultSet().getShort(ctx.index())));
return wasNull(ctx.resultSet(), ctx.resultSet().getShort(ctx.index()));
}

@Override
final Short get0(BindingGetStatementContext<U> ctx) throws SQLException {
return wasNull(ctx.statement(), Short.valueOf(ctx.statement().getShort(ctx.index())));
return wasNull(ctx.statement(), ctx.statement().getShort(ctx.index()));
}

@Override
final Short get0(BindingGetSQLInputContext<U> ctx) throws SQLException {
return wasNull(ctx.input(), Short.valueOf(ctx.input().readShort()));
return wasNull(ctx.input(), ctx.input().readShort());
}

@Override
Expand Down
6 changes: 1 addition & 5 deletions jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java
Expand Up @@ -525,11 +525,7 @@ public List<Object> extractBindValues(QueryPart part) {

@Override
public Map<String, Param<?>> extractParams(QueryPart part) {
return extractParams0(part, true);
}

final Map<String, Param<?>> extractParams0(QueryPart part, boolean includeInlinedParams) {
ParamCollector collector = new ParamCollector(configuration(), includeInlinedParams);
ParamCollector collector = new ParamCollector(configuration(), true);
collector.visit(part);
return Collections.unmodifiableMap(collector.resultFlat);
}
Expand Down
2 changes: 1 addition & 1 deletion jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java
Expand Up @@ -101,7 +101,7 @@ public class DefaultDataType<T> extends AbstractDataTypeX<T> {
* A pattern to be used to replace all precision, scale, and length
* information.
*/
private static final Pattern TYPE_NAME_PATTERN = Pattern.compile("\\([^\\)]*\\)");
private static final Pattern TYPE_NAME_PATTERN = Pattern.compile("\\([^)]*\\)");

// -------------------------------------------------------------------------
// Data type caches
Expand Down
4 changes: 0 additions & 4 deletions jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java
Expand Up @@ -649,10 +649,6 @@ protected final void visit0(QueryPartInternal internal) {










Expand Down
7 changes: 2 additions & 5 deletions jOOQ/src/main/java/org/jooq/impl/Diff.java
Expand Up @@ -149,8 +149,7 @@ else if (migrateConf.dropSchemaCascade()) {
// TODO: Can we reuse the logic from DROP_TABLE?
for (Table<?> t1 : s.getTables())
for (UniqueKey<?> uk : t1.getKeys())
for (ForeignKey<?, ?> fk : uk.getReferences())
r.droppedFks.add(fk);
r.droppedFks.addAll(uk.getReferences());

if (!StringUtils.isEmpty(s.getName()))
r.queries.add(ctx.dropSchema(s).cascade());
Expand Down Expand Up @@ -428,10 +427,8 @@ private final boolean typeNameDifference(DataType<?> type1, DataType<?> type2) {
return false;

// [#10864] In most dialects, DECIMAL and NUMERIC are aliases and don't need to be changed into each other
else if (type1.getType() == BigDecimal.class && type2.getType() == BigDecimal.class)
return false;
else
return true;
return type1.getType() != BigDecimal.class || type2.getType() != BigDecimal.class;
}

private final boolean precisionDifference(DataType<?> type1, DataType<?> type2) {
Expand Down

0 comments on commit 5493815

Please sign in to comment.