Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit 933b31f

Browse files
committed
Refactor ProcessingContext, return early on unknown type
1 parent d2e702d commit 933b31f

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

src/main/java/io/ebean/querybean/generator/ProcessingContext.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -265,33 +265,33 @@ PropertyType getPropertyType(VariableElement field) {
265265
}
266266

267267
Element fieldType = typeUtils.asElement(typeMirror);
268+
if (fieldType == null) {
269+
return null;
270+
}
271+
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544288
272+
fieldType = elementUtils.getTypeElement(fieldType.toString());
268273

269-
if (fieldType != null) {
270-
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544288
271-
fieldType = elementUtils.getTypeElement(fieldType.toString());
272-
273-
if (fieldType.getKind() == ElementKind.ENUM) {
274-
String fullType = typeDef(typeMirror);
275-
return new PropertyTypeEnum(fullType, Split.shortName(fullType));
276-
}
274+
if (fieldType.getKind() == ElementKind.ENUM) {
275+
String fullType = typeDef(typeMirror);
276+
return new PropertyTypeEnum(fullType, Split.shortName(fullType));
277+
}
277278

278-
if (isEntityOrEmbedded(fieldType)) {
279-
// public QAssocContact<QCustomer> contacts;
280-
return createPropertyTypeAssoc(typeDef(typeMirror));
281-
}
279+
if (isEntityOrEmbedded(fieldType)) {
280+
// public QAssocContact<QCustomer> contacts;
281+
return createPropertyTypeAssoc(typeDef(typeMirror));
282+
}
282283

283-
if (typeMirror.getKind() == TypeKind.DECLARED) {
284-
DeclaredType declaredType = (DeclaredType) typeMirror;
285-
List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments();
286-
if (typeArguments.size() == 1) {
287-
TypeMirror argType = typeArguments.get(0);
288-
if (argType.getKind() == TypeKind.WILDCARD) {
289-
argType = ((WildcardType) argType).getExtendsBound();
290-
}
291-
Element argElement = typeUtils.asElement(argType);
292-
if (isEntityOrEmbedded(argElement)) {
293-
return createPropertyTypeAssoc(typeDef(argElement.asType()));
294-
}
284+
if (typeMirror.getKind() == TypeKind.DECLARED) {
285+
DeclaredType declaredType = (DeclaredType) typeMirror;
286+
List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments();
287+
if (typeArguments.size() == 1) {
288+
TypeMirror argType = typeArguments.get(0);
289+
if (argType.getKind() == TypeKind.WILDCARD) {
290+
argType = ((WildcardType) argType).getExtendsBound();
291+
}
292+
Element argElement = typeUtils.asElement(argType);
293+
if (isEntityOrEmbedded(argElement)) {
294+
return createPropertyTypeAssoc(typeDef(argElement.asType()));
295295
}
296296
}
297297
}

0 commit comments

Comments
 (0)