mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
improved TypeExtends serialization
This commit is contained in:
parent
6df167a527
commit
862c0d003b
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.mysema.codegen</groupId>
|
||||
<artifactId>codegen</artifactId>
|
||||
<version>0.3.6-SNAPSHOT</version>
|
||||
<version>0.3.7-SNAPSHOT</version>
|
||||
<name>Codegen</name>
|
||||
<description>Code generation and compilation for Java</description>
|
||||
<parent>
|
||||
|
||||
@ -19,7 +19,7 @@ import net.jcip.annotations.Immutable;
|
||||
@Immutable
|
||||
public class TypeAdapter implements Type{
|
||||
|
||||
private final Type type;
|
||||
protected final Type type;
|
||||
|
||||
public TypeAdapter(Type type){
|
||||
this.type = type;
|
||||
|
||||
@ -31,7 +31,7 @@ public class TypeExtends extends TypeAdapter{
|
||||
super(type);
|
||||
varName = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getGenericName(boolean asArgType){
|
||||
return getGenericName(asArgType, Collections.<String>emptySet(),Collections.<String>emptySet());
|
||||
@ -40,7 +40,11 @@ public class TypeExtends extends TypeAdapter{
|
||||
@Override
|
||||
public String getGenericName(boolean asArgType, Set<String> packages, Set<String> classes){
|
||||
if (!asArgType){
|
||||
return "? extends " + super.getGenericName(true, packages, classes);
|
||||
if (type.equals(Types.OBJECT)){
|
||||
return "?";
|
||||
}else{
|
||||
return "? extends " + super.getGenericName(true, packages, classes);
|
||||
}
|
||||
}else{
|
||||
return super.getGenericName(asArgType, packages, classes);
|
||||
}
|
||||
|
||||
@ -21,4 +21,9 @@ public class TypeExtendsTest {
|
||||
assertEquals("java.util.Collection<java.lang.Object>", new TypeExtends(Types.COLLECTION).getGenericName(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void GetGenericName_With_Object(){
|
||||
assertEquals("?", new TypeExtends(Types.OBJECT).getGenericName(false));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user