mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective code change: Fixwarnings, overrides, generics etc. (#1285)
This commit is contained in:
committed by
Rob Bygrave
parent
cdbbd749a3
commit
0e3f47ee82
@@ -158,6 +158,7 @@ public class Pairs {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "p0:" + property0 + " p1:" + property1 + " entries:" + entries;
|
||||
}
|
||||
@@ -183,6 +184,7 @@ public class Pairs {
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + a + "," + b + "}";
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public final class CallStack implements Serializable {
|
||||
return hc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hc;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.CustomDbTypeMapping;
|
||||
import io.ebean.config.DbTypeConfig;
|
||||
import io.ebean.config.ServerConfig;
|
||||
import io.ebeaninternal.util.JdbcClose;
|
||||
import io.ebeaninternal.util.JdbcClose; // FIXME: should not import ebeaninternal here
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public abstract class SequenceBatchIdGenerator extends SequenceIdGenerator {
|
||||
/**
|
||||
* Add the next set of Ids as the next value plus all the following numbers up to the step size.
|
||||
*/
|
||||
@Override
|
||||
protected List<Long> readIds(ResultSet resultSet, int loadSize) throws SQLException {
|
||||
|
||||
List<Long> newIds = new ArrayList<>(loadSize);
|
||||
|
||||
@@ -23,6 +23,7 @@ public abstract class SequenceStepIdGenerator extends SequenceIdGenerator {
|
||||
/**
|
||||
* Add the next set of Ids as the next value plus all the following numbers up to the step size.
|
||||
*/
|
||||
@Override
|
||||
protected List<Long> readIds(ResultSet resultSet, int ignoreRequestSize) throws SQLException {
|
||||
|
||||
List<Long> newIds = new ArrayList<>(allocationSize);
|
||||
|
||||
@@ -13,42 +13,43 @@ import java.util.Map;
|
||||
*/
|
||||
class YamlLoader {
|
||||
|
||||
private final Yaml yaml = new Yaml();
|
||||
private final Yaml yaml = new Yaml();
|
||||
|
||||
private final LoadContext loadContext;
|
||||
private final LoadContext loadContext;
|
||||
|
||||
YamlLoader(LoadContext loadContext) {
|
||||
this.loadContext = loadContext;
|
||||
}
|
||||
YamlLoader(LoadContext loadContext) {
|
||||
this.loadContext = loadContext;
|
||||
}
|
||||
|
||||
void load(InputStream is) {
|
||||
if (is != null) {
|
||||
loadMap(yaml.load(is), null);
|
||||
}
|
||||
}
|
||||
void load(InputStream is) {
|
||||
if (is != null) {
|
||||
loadMap(yaml.load(is), null);
|
||||
}
|
||||
}
|
||||
|
||||
void loadMap(Map<String, Object> map, String path) {
|
||||
@SuppressWarnings("unchecked")
|
||||
void loadMap(Map<String, Object> map, String path) {
|
||||
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (path != null) {
|
||||
key = path + "." + key;
|
||||
}
|
||||
Object val = entry.getValue();
|
||||
if (val instanceof Map) {
|
||||
loadMap((Map<String, Object>) val, key);
|
||||
} else {
|
||||
addScalar(key, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (path != null) {
|
||||
key = path + "." + key;
|
||||
}
|
||||
Object val = entry.getValue();
|
||||
if (val instanceof Map) {
|
||||
loadMap((Map<String, Object>) val, key);
|
||||
} else {
|
||||
addScalar(key, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addScalar(String key, Object val) {
|
||||
if (val instanceof String) {
|
||||
loadContext.put(key, (String) val);
|
||||
} else if (val instanceof Number || val instanceof Boolean) {
|
||||
loadContext.put(key, val.toString());
|
||||
}
|
||||
}
|
||||
private void addScalar(String key, Object val) {
|
||||
if (val instanceof String) {
|
||||
loadContext.put(key, (String) val);
|
||||
} else if (val instanceof Number || val instanceof Boolean) {
|
||||
loadContext.put(key, val.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -136,7 +136,6 @@ public class EJson {
|
||||
/**
|
||||
* Parse the json returning as a List taking into account the current token.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> List<T> parseList(JsonParser parser, JsonToken currentToken) throws IOException {
|
||||
return plugin.parseList(parser, currentToken);
|
||||
}
|
||||
|
||||
@@ -34,13 +34,14 @@ public class AnnotationUtil {
|
||||
* does not execute specialized search algorithms for classes or methods. It only traverses through Annotations!
|
||||
* It also does not filter out platform dependent annotations!
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <A extends Annotation> A findAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType) {
|
||||
if (annotationType == null) {
|
||||
return null;
|
||||
}
|
||||
// check if directly present, if not, start search for meta-annotations.
|
||||
Annotation[] anns = annotatedElement.getAnnotations();
|
||||
if (anns.length == 0) {
|
||||
Annotation[] anns = annotatedElement.getAnnotations();
|
||||
if (anns.length == 0) {
|
||||
return null; // no annotations present, so searching for meta annotations not required
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ public class AnnotationUtil {
|
||||
return (A) ann;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return findAnnotation(anns, annotationType, new HashSet<>());
|
||||
|
||||
}
|
||||
@@ -62,6 +63,7 @@ public class AnnotationUtil {
|
||||
* the supplied element.
|
||||
* <p><strong>Note</strong>: this method searches for annotations at class & superClass(es)!
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <A extends Annotation> A findAnnotationRecursive(Class<?> clazz, Class<A> annotationType) {
|
||||
if (annotationType == null) {
|
||||
return null;
|
||||
|
||||
@@ -89,6 +89,7 @@ public class ScopeTrans {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScopeTrans[" + transaction + "]";
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public class ScopedTransaction extends SpiTransactionProxy {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScopedTransaction[" + current + "]";
|
||||
}
|
||||
|
||||
@@ -101,5 +101,5 @@ public interface SpiExpression extends Expression {
|
||||
/**
|
||||
* Check for match to a natural key query returning false if it doesn't match.
|
||||
*/
|
||||
boolean naturalKey(NaturalKeyQueryData data);
|
||||
boolean naturalKey(NaturalKeyQueryData<?> data);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class RemoteCacheEvent {
|
||||
return clearCaches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "clearAll:" + clearAll + " caches:" + clearCaches;
|
||||
}
|
||||
|
||||
@@ -272,6 +272,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements BeanQueryRe
|
||||
/**
|
||||
* Rollback the transaction if it was created for this request.
|
||||
*/
|
||||
@Override
|
||||
public void rollbackTransIfRequired() {
|
||||
if (createdTransaction) {
|
||||
try {
|
||||
|
||||
@@ -429,7 +429,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
private Class<?> theClassOf(Collection<EntityBean> beans) {
|
||||
if (beans instanceof List) {
|
||||
return ((List)beans).get(0).getClass();
|
||||
return ((List<?>)beans).get(0).getClass();
|
||||
}
|
||||
return beans.iterator().next().getClass();
|
||||
}
|
||||
@@ -532,7 +532,6 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
/**
|
||||
* Return a bean from the bean cache.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private T beanCacheGetInternal(Object id, Boolean readOnly, PersistenceContext context) {
|
||||
|
||||
CachedBeanData data = (CachedBeanData) getBeanCache().get(id);
|
||||
@@ -548,6 +547,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
return convertToBean(id, readOnly, context, data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private T convertToBean(Object id, Boolean readOnly, PersistenceContext context, CachedBeanData data) {
|
||||
if (cacheSharableBeans && !Boolean.FALSE.equals(readOnly)) {
|
||||
Object bean = data.getSharableBean();
|
||||
|
||||
@@ -1035,7 +1035,7 @@ public class BeanProperty implements ElPropertyValue, Property {
|
||||
*/
|
||||
public Set<String> getDbCheckConstraintValues() {
|
||||
if (scalarType instanceof ScalarTypeEnum) {
|
||||
return ((ScalarTypeEnum) scalarType).getDbCheckConstraintValues();
|
||||
return ((ScalarTypeEnum<?>) scalarType).getDbCheckConstraintValues();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1391,7 +1391,6 @@ public class BeanProperty implements ElPropertyValue, Property {
|
||||
/**
|
||||
* JSON write the property for 'insert only depth'.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void jsonWriteForInsert(SpiJsonWriter writeJson, EntityBean bean) throws IOException {
|
||||
if (!jsonSerialize) {
|
||||
return;
|
||||
@@ -1422,7 +1421,6 @@ public class BeanProperty implements ElPropertyValue, Property {
|
||||
jsonWriteVal(writeJson, getValueIntercept(bean));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void jsonWriteVal(SpiJsonWriter writeJson, Object value) throws IOException {
|
||||
if (value == null) {
|
||||
writeJson.writeNullField(name);
|
||||
@@ -1431,6 +1429,7 @@ public class BeanProperty implements ElPropertyValue, Property {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void jsonWriteScalar(SpiJsonWriter writeJson, Object value) throws IOException {
|
||||
if (scalarType != null) {
|
||||
writeJson.writeFieldName(name);
|
||||
|
||||
@@ -606,11 +606,13 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
return localHelp.read(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTenant(SpiQuery<?> query, Object tenantId) {
|
||||
T refBean = targetDescriptor.createReference(tenantId, null);
|
||||
query.where().eq(name, refBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTenantValue(EntityBean entityBean, Object tenantId) {
|
||||
T refBean = targetDescriptor.createReference(tenantId, null);
|
||||
setValue(entityBean, refBean);
|
||||
|
||||
@@ -34,6 +34,7 @@ public final class DeployPropertyParser extends DeployParser {
|
||||
/**
|
||||
* Skip if in raw sql expression with from tableName or join tableName.
|
||||
*/
|
||||
@Override
|
||||
protected boolean skipWordConvert() {
|
||||
return FROM.equalsIgnoreCase(priorWord) || JOIN.equalsIgnoreCase(priorWord);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public abstract class AbstractExpression implements SpiExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// by default can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class DefaultExampleExpression implements SpiExpression, ExampleExpressio
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class ExistsQueryExpression implements SpiExpression, UnsupportedDocStoreExpress
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class InExpression extends AbstractExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache for NOT IN
|
||||
return !not && data.matchIn(propName, bindValues);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class InPairsExpression extends AbstractExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
return !not && data.matchInPairs(pairs);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ abstract class LogicExpression implements SpiExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class NestedPathWrapperExpression implements SpiExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import io.ebeaninternal.api.NaturalKeyQueryData;
|
||||
abstract class NonPrepareExpression implements SpiExpression {
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class NoopExpression implements SpiExpression {
|
||||
protected static final NoopExpression INSTANCE = new NoopExpression();
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ final class NotExpression implements SpiExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SimpleExpression extends AbstractValueExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData data) {
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
// can't use naturalKey cache for NOT IN
|
||||
if (type != Op.EQ) {
|
||||
return false;
|
||||
|
||||
@@ -15,6 +15,7 @@ class BasicProfileLocation implements ProfileLocation {
|
||||
this.shortDescription = shortDesc(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return shortDescription;
|
||||
}
|
||||
@@ -24,6 +25,7 @@ class BasicProfileLocation implements ProfileLocation {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public String obtain() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class DProfileLocation implements ProfileLocation {
|
||||
this.lineNumber = lineNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "location: " + location;
|
||||
}
|
||||
@@ -37,6 +38,7 @@ class DProfileLocation implements ProfileLocation {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public String obtain() {
|
||||
// atomic assignment so happy with this
|
||||
if (location == null) {
|
||||
|
||||
@@ -29,6 +29,7 @@ class DTimeMetricStats implements TimedMetricStats {
|
||||
this.max = max != Long.MIN_VALUE ? max : (count < 1 ? 0 : Math.round(total / count));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (location != null) {
|
||||
@@ -43,6 +44,7 @@ class DTimeMetricStats implements TimedMetricStats {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class DTimedMetric implements TimedMetric {
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public DTimeMetricStats collect(boolean reset) {
|
||||
boolean empty = count.sum() == 0;
|
||||
if (empty) {
|
||||
|
||||
@@ -109,6 +109,7 @@ class OrmQueryPlanKey implements CQueryPlanKey {
|
||||
return planHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return description + " maxRows:" + maxRows + " firstRow:" + firstRow + " rawSqlKey:" + rawSqlKey + " planHash:" + planHash;
|
||||
}
|
||||
|
||||
@@ -201,6 +201,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
/**
|
||||
* Return the current active transaction.
|
||||
*/
|
||||
@Override
|
||||
public SpiTransaction getActive() {
|
||||
return scopeManager.getActive();
|
||||
}
|
||||
@@ -288,10 +289,12 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
return dataSourceSupplier.getDataSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getReadOnlyDataSource() {
|
||||
return dataSourceSupplier.getReadOnlyDataSource();
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ interface ArrayElementConverter<T> {
|
||||
/**
|
||||
* String converter (noop based).
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
class EnumConverter implements ArrayElementConverter {
|
||||
|
||||
private final ScalarType<?> scalarType;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ArrayElementConverterEnum implements ArrayElementConverter<String>
|
||||
|
||||
@Override
|
||||
public String toElement(Object rawValue) {
|
||||
|
||||
// FIXME: Don't understand for what is this.
|
||||
Enum<?>[] enumConstants = valueType1.getEnumConstants();
|
||||
if (scalarType == null) {
|
||||
return rawValue.toString();
|
||||
|
||||
@@ -59,7 +59,6 @@ public class ScalarTypeArrayList extends ScalarTypeJsonCollection<List> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public ScalarTypeArrayList typeForEnum(ScalarType<?> scalarType) {
|
||||
return new ScalarTypeArrayList("varchar", DocPropertyType.TEXT, new ArrayElementConverter.EnumConverter(scalarType));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ class ScalarTypeArraySetH2<T> extends ScalarTypeArraySet<T> {
|
||||
* Return the ScalarType to use based on the List's generic parameter type.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ScalarTypeArraySetH2<?> typeFor(Type valueType) {
|
||||
if (valueType.equals(java.util.UUID.class)) {
|
||||
return UUID;
|
||||
@@ -49,12 +48,13 @@ class ScalarTypeArraySetH2<T> extends ScalarTypeArraySet<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public ScalarTypeArraySetH2 typeForEnum(ScalarType<?> scalarType) {
|
||||
return new ScalarTypeArraySetH2("varchar", DocPropertyType.TEXT, new ArrayElementConverter.EnumConverter(scalarType));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private ScalarTypeArraySetH2(String arrayType, DocPropertyType docPropertyType, ArrayElementConverter converter) {
|
||||
super(arrayType, docPropertyType, converter);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user