This repository was archived by the owner on Oct 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
main/java/io/ebean/querybean/generator
test/java/io/ebean/querybean/generator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,9 +132,9 @@ String generatedSourcesDir() {
132132 private String typeDef (TypeMirror typeMirror ) {
133133 if (typeMirror .getKind () == TypeKind .DECLARED ) {
134134 DeclaredType declaredType = (DeclaredType ) typeMirror ;
135- return declaredType .asElement ().toString ();
135+ return Split . trimType ( declaredType .asElement ().toString () );
136136 } else {
137- return typeMirror .toString ();
137+ return Split . trimType ( typeMirror .toString () );
138138 }
139139 }
140140
Original file line number Diff line number Diff line change @@ -31,4 +31,14 @@ static String shortName(String className) {
3131 return className .substring (startPos + 1 );
3232 }
3333
34+ /**
35+ * Trim "? extends" from a Kotlin "out" collection type.
36+ */
37+ static String trimType (String fullType ) {
38+ if (fullType .startsWith ("? " )) {
39+ return fullType .substring (10 );
40+ }
41+ return fullType ;
42+ }
43+
3444}
Original file line number Diff line number Diff line change 88public class SplitTest {
99
1010 @ Test
11- public void shortName () throws Exception {
11+ public void trimType () {
12+ assertEquals (Split .trimType ("com.foo.domain.Customer" ), "com.foo.domain.Customer" );
13+ assertEquals (Split .trimType ("? extends com.foo.domain.Customer" ), "com.foo.domain.Customer" );
14+ }
1215
16+ @ Test
17+ public void shortName () {
1318 assertEquals (Split .shortName ("com.foo.domain.Customer" ), "Customer" );
1419 assertEquals (Split .shortName ("Customer" ), "Customer" );
1520 }
1621
1722 @ Test
18- public void split_normal () throws Exception {
23+ public void split_normal () {
1924
2025 String [] split = Split .split ("com.foo.domain.Customer" );
2126
@@ -24,7 +29,7 @@ public void split_normal() throws Exception {
2429 }
2530
2631 @ Test
27- public void split_noPackage () throws Exception {
32+ public void split_noPackage () {
2833
2934 String [] split = Split .split ("Customer" );
3035
You can’t perform that action at this time.
0 commit comments