[apex] Really fix ApexLexer logging
The fix introduced with #503 (fba00843bb523cbeb06157c4793ffc29bd9a6ee7) was incomplete and didn't work: * The logger uses the full class name insteand of simple name * After we changed the log level of the logger, the logger could be garbage collected before ApexLexer retrieves it and thus the configuration could be lost
This commit is contained in:
@ -16,6 +16,9 @@ This is a {{ site.pmd.release_type }} release.
|
|||||||
|
|
||||||
### Fixed Issues
|
### Fixed Issues
|
||||||
|
|
||||||
|
* apex
|
||||||
|
* [#2092](https://github.com/pmd/pmd/issues/2092): \[apex] ApexLexer logs visible when Apex is the selected language upon starting the designer
|
||||||
|
|
||||||
### API Changes
|
### API Changes
|
||||||
|
|
||||||
### External Contributions
|
### External Contributions
|
||||||
|
@ -10,6 +10,9 @@ import java.util.logging.Logger;
|
|||||||
import apex.jorje.parser.impl.BaseApexLexer;
|
import apex.jorje.parser.impl.BaseApexLexer;
|
||||||
|
|
||||||
public final class ApexJorjeLogging {
|
public final class ApexJorjeLogging {
|
||||||
|
// note: that's a static/strong reference in order to avoid that the logger is garbage collected
|
||||||
|
private static final Logger APEX_LOGGER = Logger.getLogger(BaseApexLexer.class.getName());
|
||||||
|
|
||||||
private ApexJorjeLogging() {
|
private ApexJorjeLogging() {
|
||||||
// this is a utility class
|
// this is a utility class
|
||||||
}
|
}
|
||||||
@ -19,7 +22,6 @@ public final class ApexJorjeLogging {
|
|||||||
// Jul 16, 2017 8:49:56 PM apex.jorje.parser.impl.BaseApexLexer dedupe
|
// Jul 16, 2017 8:49:56 PM apex.jorje.parser.impl.BaseApexLexer dedupe
|
||||||
// INFORMATION: Deduped array ApexLexer.DFA23_transition. Found 7927114 shorts which is 15MB not
|
// INFORMATION: Deduped array ApexLexer.DFA23_transition. Found 7927114 shorts which is 15MB not
|
||||||
// including array overhead. Removed 7204963 shorts which is 13MB not counting array overhead. Took 18ms.
|
// including array overhead. Removed 7204963 shorts which is 13MB not counting array overhead. Took 18ms.
|
||||||
Logger log = Logger.getLogger(BaseApexLexer.class.getSimpleName());
|
APEX_LOGGER.setLevel(Level.WARNING);
|
||||||
log.setLevel(Level.WARNING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,5 +42,8 @@ public class AllRulesIT extends AbstractBinaryDistributionTest {
|
|||||||
result.assertNoError("Use of deprecated attribute");
|
result.assertNoError("Use of deprecated attribute");
|
||||||
result.assertNoErrorInReport("Error while processing");
|
result.assertNoErrorInReport("Error while processing");
|
||||||
result.assertNoErrorInReport("Error while parsing");
|
result.assertNoErrorInReport("Error while parsing");
|
||||||
|
|
||||||
|
// See bug #2092: [apex] ApexLexer logs visible when Apex is the selected language upon starting the designer
|
||||||
|
result.assertNoError("Deduped array ApexLexer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user