-
Notifications
You must be signed in to change notification settings - Fork 906
prevent NPE when clazz.type field is null #8700
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
base: master
Are you sure you want to change the base?
Conversation
Please don't open issues if you have a pull request ready, and please add the issue description to the pull request. The pull request is linked from release notes. Minor nit on the formatting - should be a space between |
as stated on a similar PR. We shouldn't patch NPEs like this without a reproducer. The same snippet is used across the file (type has 9 usages), if null is a valid value it will just fail somewhere else. |
I think VanillaCompileWorker needs more null checks. The problem with the "this needs a reproducer" is, that reproduction of these situations is difficult, as it might be a mix of "source in state of editing", incomplete indexing, $other reason. If there are other patterns like the problematic one, then sure, lets also guard them, but also lets be real, that not all cases can be caught. I too often see exception from the javac infrastructure and that hast to stop, if every change is vetoed by "needs a reproducer", even when the reporter clearly says, that he can't, this will always be a problem. |
i am looking into this right now (unless someone else wants) and check other usages. if there is no way to get a reproducer, sure I would be ok with adding guards as best effort attempt. But given that the issue mentions under reproducer "open a module", my assumption was that this is somehow verifiable. There is also the risk that things like this hide an issue which would surface in a less direct way later. I do also maintain a small collection of reproducers here https://github.com/mbien/nb-reprorepo/tree/master/tinybugs/src/main/java/bugs for anyone interested. |
Agreed! There is also a question of where this is being reported from and why. I think we're possibly reporting exceptions too often in the UI where they should just be caught at a higher level and logged as parsing errors. |
Making an Issue AND a PR at almost the same time allows me to deal with the naming problem. If the purpose of the error bulb is to invite reporting or to prompt solving the issue, then that is what I did. |
My opinion: it is better to make an effort to find reproducers, and look what exactly is happening, than just adding
|
closes #8699
^Add meaningful description above
Click to collapse/expand PR instructions
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
Please make sure (eg.
git log
) that all commits have a valid name and email address for you in the Author field.If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)