-
Notifications
You must be signed in to change notification settings - Fork 105
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
java.lang.ClassCastException SingleMemberAnnotation to NormalAnnotation #201
Comments
FYI here's the example - just fork uncomment it. |
Cool project btw |
@astubbs you need to use |
Can the code then not be improved to prevent this mistake from happening, or produce a better error? perhaps if String is assignable from (parameter) throw illegal argument exception? It would be a common mistake IMO. |
Sure, that would be nice to have. Fancy submitting a PR? 😉 |
Maybe. The issues are starting to pile up. Why close the issue then? Perhaps you should reopen this issue if you agree there's a UX problem, instead of closing it. |
Or - if you don't think it's a bug, tag it as not a bug, but a ux improvement or something. Any lib that throws out NPE or Class casts is a bug IMO. What type of bug though... |
That makes sense. I'll leave it open until we get a better error message in this case |
@astubbs Thanks for the issue! Just getting up to speed on this. I agree that re-classifying the issue as a feature request seems appropriate. In the future, if you would like to report a bug, it would be helpful to also provide a minimal reproduction of the defect so the team can more quickly understand and fix the problem without forking or downloading other codebases. A link to a branch with the comment "just fork uncomment it" means any number of things to me. If you must link to a fork or branch of a larger project, consider providing the git commands and detailed steps to reproduce the issue in the project. Regarding libraries throwing NPEs and other exceptions. I agree, particularly since what Roaster is doing is attempting to hide the messy parts of the Eclipse JDT to provide a tasteful and easy to understand way to manipulate the very complex domain of Java Source; however, nobody is perfect and we only try to predict or code a response for every possible misuse of the JDT API. It does provide its own (unfortunately terse) error messages in the end. We can only do our best with the limited time we have. At some point, it becomes impractical to attempt encapsulation of every underlying language feature or facet, or we'd have re-written the language. Hence, PRs very welcome. Also, cool project! :) Given that you seem to care about legibility, we would of course welcome your contribution! It's very much in line with what we are trying to achieve. |
@lincolnthree Thanks for the response! I agree it's helpful to provide more detail in bug reports, examples, tests etc. However I also think it's better to report them with some information rather than not at all if time is pressing. I agree my link to my fork with comment was next to useless :) I'm not accusing anyone of being perfect; however generally speaking, class casting is an unsafe operation (which is what caused this issue) in what is usually strongly typed language, so if you do it (cast) - you should be sure that the type are going to be compatible. Otherwise - test it first - as is being done in other parts of the code already. This is what I was getting at. However after looking further and understanding a bit more - I see this class is choco-block with casts - it appears this part is quite a bit more complex than I assumed - first thinking this was simply missing a single type check :) I'll have to leave it there but I see this issue is actually much larger that I thought - which touches on what you were getting at. BTW FYI - I had already submitted a PR for another issue of a similar type (input verification): https://github.com/forge/roaster/pull/200/files. PRs are nice, but we're all time poor :( I have moved away from my work with Roaster as I'm not working on the project that used it for a while now. But if I pick it back up again - there'll be more PRs to come. Cheers! |
Error adding a annotation value to @generated
The text was updated successfully, but these errors were encountered: