File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
core/src/main/java/com/axellience/vuegwt/core/generation Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 66import com .google .gwt .resources .client .ClientBundle ;
77import com .google .gwt .resources .client .ClientBundle .Source ;
88import com .squareup .javapoet .AnnotationSpec ;
9+ import com .squareup .javapoet .ArrayTypeName ;
910import com .squareup .javapoet .ClassName ;
1011import com .squareup .javapoet .CodeBlock ;
1112import com .squareup .javapoet .FieldSpec ;
2728import java .io .IOException ;
2829import java .io .Writer ;
2930import java .lang .annotation .Annotation ;
31+ import java .util .regex .Matcher ;
32+ import java .util .regex .Pattern ;
3033
3134/**
3235 * @author Adrien Baron
@@ -172,6 +175,24 @@ public static TypeName stringTypeToTypeName(String type)
172175 if (type .equals ("Double" ) || type .equals ("java.lang.Double" ))
173176 return TypeName .DOUBLE .box ();
174177
175- return ClassName .bestGuess (type );
178+ // Manage array types
179+ Pattern arrayEnding = Pattern .compile ("\\ [\\ ]" );
180+ Matcher matcher = arrayEnding .matcher (type );
181+ int arrayCount = 0 ;
182+ while (matcher .find ())
183+ arrayCount ++;
184+
185+ if (arrayCount > 0 )
186+ {
187+ type = type .substring (0 , type .length () - arrayCount * 2 );
188+ }
189+
190+ TypeName typeName = ClassName .bestGuess (type );
191+ for (int i = 0 ; i < arrayCount ; i ++)
192+ {
193+ typeName = ArrayTypeName .of (typeName );
194+ }
195+
196+ return typeName ;
176197 }
177198}
You can’t perform that action at this time.
0 commit comments