mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
fixes based on Sonar reports
This commit is contained in:
parent
7a702845da
commit
8afc6495bd
@ -265,8 +265,8 @@ public final class APTTypeFactory {
|
||||
return key;
|
||||
}
|
||||
|
||||
private Set<EntityType> getSupertypes(TypeMirror type, Type value) {
|
||||
type = normalize(type);
|
||||
private Set<EntityType> getSupertypes(TypeMirror t, Type value) {
|
||||
TypeMirror type = normalize(t);
|
||||
Set<EntityType> superTypes = Collections.emptySet();
|
||||
if (type.getKind() == TypeKind.DECLARED){
|
||||
DeclaredType declaredType = (DeclaredType)type;
|
||||
|
||||
@ -54,6 +54,6 @@ public interface Visitor {
|
||||
/**
|
||||
* @param query
|
||||
*/
|
||||
void visit(SubQuery query);
|
||||
void visit(SubQuery<?> query);
|
||||
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ public final class HQLSerializer extends SerializerBase<HQLSerializer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(SubQuery query) {
|
||||
public void visit(SubQuery<?> query) {
|
||||
append("(");
|
||||
serialize(query.getMetadata(), false, null);
|
||||
append(")");
|
||||
@ -285,26 +285,26 @@ public final class HQLSerializer extends SerializerBase<HQLSerializer> {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void visitOperation(Class<?> type, Operator<?> operator, List<Expr<?>> args) {
|
||||
protected void visitOperation(Class<?> type, Operator<?> operator, List<Expr<?>> a) {
|
||||
boolean old = wrapElements;
|
||||
wrapElements = HQLTemplates.wrapCollectionsForOp.contains(operator);
|
||||
//
|
||||
if (operator.equals(Ops.INSTANCE_OF)) {
|
||||
args = new ArrayList<Expr<?>>(args);
|
||||
List<Expr<?>> args = new ArrayList<Expr<?>>(a);
|
||||
args.set(1, EStringConst.create(((Class<?>) ((Constant<?>) args.get(1)).getConstant()).getName()));
|
||||
super.visitOperation(type, operator, args);
|
||||
|
||||
} else if (operator.equals(Ops.NUMCAST)) {
|
||||
visitCast(args.get(0), (Class<?>) ((Constant<?>) args.get(1)).getConstant());
|
||||
visitCast(a.get(0), (Class<?>) ((Constant<?>) a.get(1)).getConstant());
|
||||
|
||||
} else if (operator.equals(Ops.EXISTS) && args.get(0) instanceof SubQuery){
|
||||
SubQuery subQuery = (SubQuery) args.get(0);
|
||||
} else if (operator.equals(Ops.EXISTS) && a.get(0) instanceof SubQuery){
|
||||
SubQuery subQuery = (SubQuery) a.get(0);
|
||||
append("exists (");
|
||||
serialize(subQuery.getMetadata(), false, "1");
|
||||
append(")");
|
||||
|
||||
} else if (operator.equals(Ops.MATCHES)){
|
||||
args = new ArrayList<Expr<?>>(args);
|
||||
List<Expr<?>> args = new ArrayList<Expr<?>>(a);
|
||||
if (args.get(1) instanceof Constant){
|
||||
args.set(1, regexToLike(args.get(1).toString()));
|
||||
}else if (args.get(1) instanceof Operation){
|
||||
@ -313,7 +313,7 @@ public final class HQLSerializer extends SerializerBase<HQLSerializer> {
|
||||
super.visitOperation(type, operator, args);
|
||||
|
||||
} else {
|
||||
super.visitOperation(type, operator, args);
|
||||
super.visitOperation(type, operator, a);
|
||||
}
|
||||
//
|
||||
wrapElements = old;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user