-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Parametrized class Operation
is used without a type parameter
#155
Comments
thanks for the suggestion, PR welcome :)
|
Do you mean But I totally agree with @algomaster99 that this is a bit of a painpoint in using I see two options. Remove the parameterization of
|
I completely missed this comment over the multiple updates in diffmin this week. I meant this
But this still wouldn't solve the problem. We would still have to suppress the use of |
That is a private instance variable, it's not part of the API. It's the return types of
It's meant as a justification for keeping the parameterization, because right now it does not seem to add anything for the end user as casts are required anyway. Going with this idea would also entail fixing the raw types in the API.
I disagree. Diffmin does different things depending on the type of operation. All instance type checks could be removed from this loop if it was possible to specifically get one kind of operation. Then it would be simplified to: for (UpdateOperation update : diff.getRootOperations(UpdateOperation.class) {
// add update
}
for (InsertOperation insert : diff.getRootOperations(InsertOperation.class) {
// add insert
}
[ ... etc etc ... ] To me, that's cleaner code, as it avoids both type checking and type casting. |
For this, I was suggesting to change the return type of
List<? extends Operation<?>> . It would still require the casts but I think it would remove the warnings. Of course, eliminating casts would be best altogether.
Seems like a better idea to me too! And since we know that theoretically the order of applying patches should not matter, this would not pose a problem as well. |
https://github.com/SpoonLabs/gumtree-spoon-ast-diff/blob/master/src/main/java/gumtree/spoon/diff/DiffImpl.java#L38
I feel that the use of the
Operation
class in the above line, and maybe in the entire file, should be parametrized with? extends Operation<?>
. This will reduce the number of warnings in projects which usegumtree-spoon
as a package.EDIT: missed a very important detail to parametrize
Operation
class.The text was updated successfully, but these errors were encountered: