-
Notifications
You must be signed in to change notification settings - Fork 39
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
Move files and resources to .refastertemplates
packages
#113
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.
Some context.
@@ -196,10 +194,7 @@ private static ImmutableListMultimap<String, CodeTransformer> loadAllCodeTransfo | |||
|
|||
private static ImmutableSet<ResourceInfo> getClassPathResources() { | |||
try { | |||
return ClassPath.from( |
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.
This change is copied over from here.
@@ -68,9 +66,9 @@ public final class RefasterCheck extends BugChecker implements CompilationUnitTr | |||
private static final String REFASTER_TEMPLATE_SUFFIX = ".refaster"; | |||
private static final String INCLUDED_TEMPLATES_PATTERN_FLAG = "Refaster:NamePattern"; | |||
|
|||
@VisibleForTesting |
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.
This will also change in the "end-state" implementation.
8269b7b
to
7b8da2d
Compare
(Not yet fixed) 😄 |
7b8da2d
to
082d0de
Compare
Fixed now :). |
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.
Added two commits; TBD whether both make sense in the context of #43. (Hope to review that PR ~tomorrow.)
import tech.picnic.errorprone.bugpatterns.RefasterCheck; | ||
|
||
public final class RefasterCheckTest { |
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.
So the test is now in a different package than the main class. As discussed, this is to work around a limitation of the current test setup, to be resolved in an upcoming PR. Let's add a comment to that effect.
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, we can avoid the move using another few-line change. Not elegant, but IMHO preferable to moving the class.
(TBD whether this insight allows simplifications in #43; didn't scrutinize that PR yet.)
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'm not sure whether I agree that this is better, but as is it a temporary state I'm OK with it 😄.
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.
The RefasterCheck
will go to the refaster-runner
module in #43.
@VisibleForTesting | ||
static final Supplier<ImmutableListMultimap<String, CodeTransformer>> ALL_CODE_TRANSFORMERS = | ||
Suppliers.memoize(RefasterCheck::loadAllCodeTransformers); | ||
/** All code transformers loaded by {@link RefasterCheck}. */ |
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.
/** All code transformers loaded by {@link RefasterCheck}. */ | |
/** All code transformers found on the classpath, loaded lazily. */ |
Build fails because of:
I didn't see this error locally. Turns out that this error triggers when building with JDK 11, but not when building with JDK 17. In the latter case the |
9588d46
to
b31a789
Compare
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.
Suggested commit message:
Move Refaster template test resources to proper package (#113)
Made a tiny tweak to the suggested commit message to be more accurate. |
Right. Tweaked further ;) |
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. Thought we could create a final member variable for BugCheckerRefactoringTestHelper
but this didn't speed up tests much and I suspect will become a problem with Junit method parallelism.
Discussed offline. This is a good idea. However, as we'll anyway change this code in #43 we'll skip this change 👍 |
This commit is to prepare the code for #43.
Here we already move the templates and associated resources.
Note that for the
RefasterCheckTest
,RefasterTemplateTestCase
, andRefasterCheckTest
there are some temporary changes. In #43 most things will be moved torefaster-test-support
orrefaster-runner
. They are currently moved as to make the existing state work.