-
Notifications
You must be signed in to change notification settings - Fork 145
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
DiamondOperatorForVariableDefinitionCheck: fixing violation leads to a compilation error in Java 7 #361
Comments
Does checkstyle support java 7 anymore? If not, then we should close this issue. |
We support all versions of Java up to 8. @romani Is this issue valid? |
we support all that is compilable by We do not know version of java user is working on, all Checks suppose to work on all versions. |
According to first post, user got an exception on code change using Java 7. It seems there were changes to make type parameters work in more cases. I agree with @romani 's statement now that we must find a way to skip these cases. I think the only way we can identify these cases is if we know that the variable being sent to the constructor is a different type than the new variable being assigned. @romani You agree? |
yes, but slight change for name is required to my mind .... JEP-101 looks like not about c-tors only, looks like all c-tor/methods with parameters are affected. As Checkstyle is not type-aware tool , we need to skip all methods/c-tor with arguments. So it might be better to name property as is @rnveach , are you ok with this ? |
yes, that is fine. I was aiming to atleast still cover some cases, but we can skip all for now. @AustinShalit you can start this issue if you still want to. |
Sounds good 👍 |
Check generates violation in the 5th line:
We can fix this violation as follows:
But the fixed version of code stops compiling on Java 7 with such an error:
I found this JEP-101 which was released within Java 8. Probably that is why everything is ok under Java 8.
The text was updated successfully, but these errors were encountered: