slf4j
slf4j copied to clipboard
Fixed situation where migrator does not convert JCL log statements and breaks code.
There is a bug in the migrator: when the migrator encounters the method line on a new line apart from the class, the convertor changes the declaration but not the method name and thus breaks the code.
Normal convert:
Log logger = LogFactory.getLog(MyClass.class);
To
Logger logger = LoggerFactory.getLogger(MyClass.class);
When method name is on a separate line...
static Log logger = LogFactory
.getLog(DoesntWork.class);
.. the migrator changes the declaration ... but not the type and method name.
static Logger logger = LogFactory
.getLog(DoesntWork.class);
//sb LoggerFactory
// .getLogger(DoesntWork.class);
This looks like an old bug. See http://mailman.qos.ch/pipermail/slf4j-dev/2011-March/003280.html
Also I fixed the spelling of 'instanciation'. :)
Ideally we could just have a single multiline rule for this instead of two separate rules. Please look at using MultiGroupConversionRule instead to capture the whitespace between LogFactory and .getLog()
Hello Steve, do you have any interest in revisiting this pull request?
You implementing your suggestion?
No, probably not. My fix was an attempt to solve a nagging problem, contribute to the community and to learn GitHub and OpenSource techniques.
Whether the pull request is accepted or not, I'm not emotionally attached either way.
Thanks for checking in. Steve
On Sep 26, 2014, at 6:08 PM, Matt Bishop [email protected] wrote:
Hello Steve, do you have any interest in revisiting this pull request?
— Reply to this email directly or view it on GitHub.
I think everyone appreciates effort put into any open-source contribution. You took the time to create a pull request, which indicates you fully understand and believe in the philosophy.
The last mile is to provide the best contribution possible given feedback from others. No one owns SLF4J, we are all volunteers. SLF4J only as good as the code contributed, and your contribution would be a good one to bring in.
I hope you can take some time to revisit this one as you are in the best position to complete it.
Matt - I changed the rule I used to a MultiGroupConversionRule version,, but I honestly couldn't figure out how to use that class.(I see in TrivialMatcher (46) where the class is employed) but is the point of that class to provide multiple patterns for a single replacement?