mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
improved super handling
This commit is contained in:
parent
6bdaa71de4
commit
f1710fa060
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.5.2</version>
|
||||
<version>0.5.3</version>
|
||||
<name>Codegen</name>
|
||||
<description>Code generation and compilation for Java</description>
|
||||
<parent>
|
||||
|
||||
@ -41,7 +41,12 @@ public class TypeSuper extends TypeAdapter {
|
||||
@Override
|
||||
public String getGenericName(boolean asArgType, Set<String> packages, Set<String> classes) {
|
||||
if (!asArgType) {
|
||||
return "? super " + superType.getGenericName(true, packages, classes);
|
||||
if (superType instanceof TypeExtends) {
|
||||
return "?";
|
||||
} else {
|
||||
return "? super " + superType.getGenericName(true, packages, classes);
|
||||
}
|
||||
|
||||
} else {
|
||||
return super.getGenericName(asArgType, packages, classes);
|
||||
}
|
||||
|
||||
@ -20,5 +20,14 @@ public class TypeSuperTest {
|
||||
public void GetGenericName_As_ArgType() {
|
||||
assertEquals("java.lang.Object", new TypeSuper(Types.STRING).getGenericName(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Comparable() {
|
||||
// T extends Comparable<? super T>
|
||||
Type comparable = new ClassType(Comparable.class);
|
||||
Type type = new TypeExtends("T",
|
||||
new SimpleType(comparable, new TypeSuper(new TypeExtends("T", comparable))));
|
||||
assertEquals("? extends java.lang.Comparable<?>", type.getGenericName(false));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user