-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#10 - [WARNING] Attempt to create a file for type 'package.to.MyEditor_field_Context' multiple times when running tests #16
Conversation
gwtproject#10 - [WARNING] Attempt to create a file for type 'package.to.MyEditor_field_Context' multiple times when running tests
gwtproject#10 - [WARNING] Attempt to create a file for type 'package.to.MyEditor_field_Context' multiple times when running tests - fixed formating
gwt-editor-processor/src/main/java/org/gwtproject/editor/processor/DriverProcessor.java
Outdated
Show resolved
Hide resolved
gwt-editor-processor/src/main/java/org/gwtproject/editor/processor/DriverProcessor.java
Outdated
Show resolved
Hide resolved
ClassName.get(((DeclaredType) data.getEditorType()).getTypeArguments().get(1))), | ||
"editor", | ||
Modifier.PRIVATE); | ||
} else if (((DeclaredType) data.getEditorType()).getTypeArguments().size() == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic is a bit gross, wonder if we can generalize instead of handling different arity like this...
in all three cases we add a field, the type of the field just varies. Zero type args is a special case, where we just make it "raw" apparently, though raw seems actually wrong to me? It should actually be unparamaterized (but maybe the variable is just poorly named).
In the other two cases, i wonder if we could just stream the type args to pass to ParameterizedTypeName.get(baseType, args...), make them an array after doing the logic on them? It would support super-weird cases like 3 or more args, and it might even be shorter than doing it by hand twice...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider CompositeEditor as an example of a case with three args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, looks like Script Kid Programming .... Think, found a better solution.
gwt-editor-processor/src/main/java/org/gwtproject/editor/processor/DriverProcessor.java
Outdated
Show resolved
Hide resolved
@@ -307,8 +345,8 @@ private ClassName getEditorDelegate(EditorModel editorModel, EditorProperty data | |||
.addModifiers(Modifier.PROTECTED) | |||
.returns(void.class) | |||
.addAnnotation(Override.class) | |||
.addParameter(Editor.class, "editor") | |||
.addStatement("this.editor = ($T) editor", rawEditorType) | |||
.addParameter(ClassName.get(data.getEditorType()), "editor") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this ever need to be parameterized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved back to the original implementation, cause we have another issue regarding the generation warning issue. (#11) Might be the better place to discuss it.
This will lead to more ' missing type arguments`-warnings, but will not create compilation errors.
@@ -324,8 +362,8 @@ private ClassName getEditorDelegate(EditorModel editorModel, EditorProperty data | |||
.addModifiers(Modifier.PROTECTED) | |||
.returns(void.class) | |||
.addAnnotation(Override.class) | |||
.addParameter(ClassName.get(Object.class), "object") | |||
.addStatement("this.object = ($T) object", ClassName.get(data.getEditedType())) | |||
.addParameter(ClassName.get(data.getEditedType()), "object") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so as above, is there any chance that this could go wrong if the edited type is itself generic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see a answer above
gwt-editor-processor/src/main/java/org/gwtproject/editor/processor/DriverProcessor.java
Outdated
Show resolved
Hide resolved
gwt-editor-processor/src/main/java/org/gwtproject/editor/processor/DriverProcessor.java
Outdated
Show resolved
Hide resolved
gwt-editor-processor/src/main/java/org/gwtproject/editor/processor/DriverProcessor.java
Outdated
Show resolved
Hide resolved
...editor-processor/src/test/resources/org/gwtproject/editor/processor/test08/TestEditor08.java
Outdated
Show resolved
Hide resolved
gwt-editor-processor/pom.xml
Outdated
<auto.common.version>0.10</auto.common.version> | ||
<auto.service.version>1.0-rc6</auto.service.version> | ||
<auto.common.version>0.11</auto.common.version> | ||
<auto.service.version>1.0-rc7</auto.service.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.1 and 1.0 are latest of these now
import org.gwtproject.editor.client.testing.FakeLeafValueEditorWithHasEditorDelegate_Long_SimpleBeanEditorDelegate; | ||
import org.gwtproject.editor.client.testing.FakeLeafValueEditorWithHasEditorDelegate_String_SimpleBeanEditorDelegate; | ||
import org.gwtproject.editor.processor.common.Model01Dto; | ||
public class TestEditor08_SimpleBeanEditorDelegate extends SimpleBeanEditorDelegate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we're still missing generics here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct ... that is another upcoming PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix the versions and ship
changed version of auto-common to 1.1 & auto-version to 1.0
No description provided.