Skip to content

Commit 7aabe64

Browse files
committed
improve error message in case a getter is not found
1 parent 50546e0 commit 7aabe64

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

gwt-editor-processor/src/main/java/org/gwtproject/editor/processor/model/EditorModel.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private List<EditorProperty> calculateEditorData() {
111111
TypeMirror fieldClassType = field.asType();
112112
if (shouldExamine(fieldClassType)) {
113113
List<EditorProperty> data =
114-
new EditorProperty.Builder(editorTypes, dataType)
114+
new EditorProperty.Builder(editorTypes, dataType, editorType)
115115
.access(field)
116116
.build(Optional.ofNullable(editorSoFar));
117117
accumulateEditorData(data, flatData, toReturn);
@@ -145,7 +145,7 @@ private List<EditorProperty> calculateEditorData() {
145145
}
146146

147147
List<EditorProperty> data =
148-
new EditorProperty.Builder(editorTypes, dataType)
148+
new EditorProperty.Builder(editorTypes, dataType, editorType)
149149
.access(method)
150150
.build(Optional.ofNullable(editorSoFar));
151151
accumulateEditorData(data, flatData, toReturn);
@@ -162,7 +162,7 @@ private List<EditorProperty> calculateEditorData() {
162162
.get(2);
163163

164164
EditorProperty subEditor =
165-
new EditorProperty.Builder(editorTypes, dataType)
165+
new EditorProperty.Builder(editorTypes, dataType, editorType)
166166
.root(subEditorType)
167167
.build(Optional.ofNullable(editorSoFar))
168168
.get(0); // doesn't matter which instance, there must be at least one
@@ -266,7 +266,7 @@ public List<EditorProperty> getEditorData(TypeMirror editor) {
266266
}
267267

268268
public EditorProperty getRootData() {
269-
return new EditorProperty.Builder(editorTypes, dataType)
269+
return new EditorProperty.Builder(editorTypes, dataType, editorType)
270270
.root(getEditorType())
271271
.build(Optional.empty())
272272
.get(0);

gwt-editor-processor/src/main/java/org/gwtproject/editor/processor/model/EditorProperty.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import com.google.auto.common.MoreElements;
1919
import java.util.List;
20+
import java.util.Objects;
2021
import java.util.Optional;
2122
import java.util.function.Consumer;
2223
import java.util.regex.Pattern;
@@ -43,10 +44,12 @@ public static class Builder {
4344

4445
private Stream.Builder<EditorProperty> builder = Stream.builder();
4546
private Stream<EditorProperty> stream;
47+
private TypeMirror editorType;
4648

47-
public Builder(EditorTypes types, TypeMirror dataType) {
49+
public Builder(EditorTypes types, TypeMirror dataType, TypeMirror editorType) {
4850
this.types = types;
4951
this.dataType = dataType;
52+
this.editorType = editorType;
5053
}
5154

5255
public Builder root(TypeMirror type) {
@@ -237,8 +240,16 @@ private void findBeanPropertyMethods(String path, TypeMirror propertyType) {
237240
if (!foundGetterForPart) {
238241
// poison(noGetterMessage(path, proxyType));
239242
// return;
240-
throw new IllegalStateException(
241-
"generation aborted! No getter exists for >>" + path + "<<");
243+
String message =
244+
"gwt-editor ==> generation aborted! No getter exists for >>"
245+
+ path
246+
+ "<< of owner >>"
247+
+ owner.toString()
248+
+ "<<";
249+
if (Objects.nonNull(this.editorType)) {
250+
message += " in editor >>" + this.editorType + "<<";
251+
}
252+
throw new IllegalStateException(message);
242253
}
243254
}
244255

@@ -308,7 +319,7 @@ public List<EditorProperty> build(Optional<EditorProperty> parent) {
308319
property.editorType)
309320
.get(2);
310321
property.composedData =
311-
new Builder(types, dataType)
322+
new Builder(types, dataType, editorType)
312323
.root(subEditorType)
313324
.build(Optional.of(property))
314325
.get(0);

0 commit comments

Comments
 (0)