-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
Fix type of constructor calls in noclasspathmode #4647
Conversation
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.
A couple of comments on what's there right now with some suggestions. I haven't taken the time yet to actually verify that this is the correct way to go about it, but at first glance it looks reasonable.
I think it's very important that going forward we clearly separate the noclasspath workarounds in the code from the "happy path" of all types actually being available. Noclasspath workarounds often look cryptic, and can change from one JDT release to another as the behavior changes as it's technically speaking bad input to JDT.
Hi, |
Should we start locating these temporary fixes in a separate class like |
@munnasyed, @MartinWitt's branch is publicly accessible. If you want to try it out, I'd suggest cloning it and building spoon yourself using |
I would say, probably not. It's first of all pretty unlikely that we'd ever achieve any kind of consistency in using said helper class, as there is so much legacy and new contributors will likely not be aware of them. "Noclasspath" in itself is also not necessarily a good unifying quality for functionality. The workarounds are also, typically, incredibly context dependent and only used in a single place, and so the definition of the method used to handle that very specific case should imo be as close as possible to the use. What we should definitely agree upon is a convention for structuring noclasspath workarounds. We might want to have a naming convention for helper methods, or something like that. I think at the very least we should not litter the "core logic" with the nitty-gritty details of these workarounds as it makes the core logic somewhat hard to follow. |
You are correct, but we could decide that it is time for a change in our code style, and we start marking them from now on?
This clearly sounds like the use case for a marker annotation. Something like this as documenting annotation would enforce to link the related issue. We can mark all new methods resolving issues with noclasspath mode and clearly document that these fixes/workarounds are unstable. @interface NoClasspathWorkaround {
int issueNumber();
}
100% correct. |
Yes, absolutely. What I meant was specifically about the idea of "all methods doing X go into helper class Y". If you don't achieve consistency with such a solution (which, due to legacy, we never will), it's of little value: you'll never know where to look for those helpers. On the other hand, adopting a coding guideline of extracting noclasspath stuff into separate methods and marking them somehow improves code quality locally, even if it's not used everywhere.
I like that idea, let's do that. Introduce it in this PR perhaps? I'm thinking if perhaps |
|
We could easily move it.
You're right, I was apparently on an out-of-date branch that didn't have the JUnit stuff when I was looking at it, I forgot we added that. With the How about just having a |
I have added a field reason to |
Sorry, missed this completely. I've been preoccupied and sick over the past month so my open sourcing has suffered.
We typically refer to the issue, but honestly I think either is fine as they are linked anyway. |
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.
@MartinWitt I think it looks good, just thinking that we might want to put the annotation in the internal package?
* | ||
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. | ||
*/ | ||
package spoon; |
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 hate to come with yet another thing after not saying anything for so long, but should we not perhaps put this in the internal package? It seems like something we don't want to share with the world, but only use internally in Spoon.
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.
Actually, spoon.testing.utils
is probably the place we want to put it, considering the naming of that package.
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.
Using a testing package seems wrong for this. As this is not really related to testing or? An internal package, yes indeed.
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.
Using a testing package seems wrong for this. As this is not really related to testing or?
I have no idea of what last week me was thinking. It was close to midnight so I suspect: not much.
An internal package, yes indeed.
Yes. That.
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.
How about we do this in spoon.experimental
and see if we have enough classes to create an internal package in the future?
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.
@MartinWitt Ugh, missed this comment.
But yes, sure. Essentially, if you put it anywhere where we can freely break it I'm satisfied.
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.
Ugh, missed this comment.
No worries, I also had a lengthy summer vacation and enjoyed the nice weather.
I moved the class to the experimental package and added Experimental
and Internal
. More evidence that we can and will break this annotation's package is not possible.
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.
LGTM, thanks @MartinWitt. Let's try to start adopting the NoClasspathWorkaround annotation as we go along and see how it fares.
@monperrus note this new annotation that should be used when we do something strange in noclasspath mode. It's to avoid littering otherwise sane code with insane fixes.
See #4643
Okay this fix has the useable stage reached.