8444 Commits

Author SHA1 Message Date
Bram Stappers
f801b30e70 Added template string token to EcmaScript 5 language definition. 2017-01-20 09:11:36 -03:00
Juan Martín Sotuyo Dodero
c8b38c83ca Update changelog 2017-01-10 11:07:32 -03:00
Juan Martín Sotuyo Dodero
bbba3aa608 Add documentation on formatter encoding 2017-01-10 10:50:14 -03:00
pyxide
43a38d3144 Console encoding only when interactive 2017-01-10 09:54:44 -03:00
pyxide
d7c503bee4 checkstyle fixes 2017-01-10 09:54:44 -03:00
pyxide
958f8df5f5 Reflection detection code for console encoding
Note: calling the static native method `String Console.encoding()` returns the current console encoding, even if `System.console()` is null because the console is not interactive (pipe or redirection).
2017-01-10 09:54:44 -03:00
pyxide
89600bfcc4 checkstyle fixes 2017-01-10 09:54:44 -03:00
pyxide
abf65acb63 Bug fix and enhanced console output encoding
- due to some rewriting without testing, the encoding property was not added to the renderer properties.
- better console encoding: use system property `sun.stdout.encoding` in interactive console, and `file.encoding` in piped or redirected output
2017-01-10 09:54:44 -03:00
pyxide
4c71b0da4a checkstyle fixes 2017-01-10 09:54:44 -03:00
pyxide
368313fd8f Update Formatter.java 2017-01-10 09:54:44 -03:00
pyxide
74583d003a Ant Task Formatter encoding issue with XMLRenderer
Hi,

The writers in the Ant task's formatter uses the default platform's encoding (for instance cp1252 on Western Windows) and the XMLRenderer sets the default XML encoding to UTF-8. This may lead to incorrect XML encoding, detected for instance when the XML file is sent to a XSLT task.
This goes undetected as long as the characters in the XML file are in the ASCII subset, which is frequently the case with code, usually in plain Latin language. In my case, the issue was raised because of the localized formatting of some line numbers greater than 999, due to localized thousand separator 0xA0, which is out of the ASCII subset.

I modified the Formatter class to always use a charset for writers. When no encoding is specified, UTF-8 is used instead of the default platform's encoding.

I strongly recommend to *always set the encoding parameter* of the formatter element. It should be reflected as so in the Ant Task documentation.

```xml
<pmd encoding="cp1252"> <!-- source encoding -->
  <formatter type="xml" toFile="pmd.xml">
    <param name="encoding" value="UTF-8" /> <!-- report encoding -->
  </formatter>
  <fileset dir="src/main/java">
    <include name="**/*.java"/>
  </fileset>
</pmd>
```
Note: when digging into sourceforge issues for similar bugs, I found [Bug 877: Output with encoding CP1252](https://sourceforge.net/p/pmd/bugs/877/) . Not the same task, but the same symptoms, probably the same cause ?
2017-01-10 09:54:44 -03:00
Andreas Dangel
c0e1c3e731 Slightly improve performance of XPath Rule UseLocaleWithCaseConversions 2017-01-08 13:51:44 +01:00
Andreas Dangel
af3ad2bc02 Fixes #1556 [java] UseLocaleWithCaseConversions does not works with ResultSet (false negative) 2017-01-08 12:12:56 +01:00
Andreas Dangel
f825cdb1db Merge branch 'bug-177' into pmd/5.4.x
Fixes #177
2017-01-06 10:17:34 +01:00
Andreas Dangel
af9d78c01a Update changelog 2017-01-06 10:16:45 +01:00
Andreas Dangel
767c9aae79 Bugfix singular field + lambda 2017-01-06 10:07:19 +01:00
Andreas Dangel
ba7a7a2f8d Merge branch 'pr-162' into pmd/5.4.x
Closes #162 (rebased onto pmd/5.4.x)
2017-01-03 11:45:28 +01:00
Juan Martín Sotuyo Dodero
6283316e51 Avoid redundant method calls and improve codebase
- Avoid making calls within for loops, specially costly ones
    such as `getQualifiedTypeNames`
 - Don't create lists when they are empty.
 - Create lists of proper size to avoid resizing / oversizing
 - I'm seeing a ~5% improvement. We are reaching the point were noise
    makes it hard to detect improvements. We should attack GC cycles soon.
2017-01-03 11:41:33 +01:00
Andreas Dangel
e5dbeb800b Merge branch 'pr-159' into pmd/5.4.x
Closes #159 (rebased onto pmd/5.4.x)
2017-01-03 10:21:50 +01:00
Andreas Dangel
c6afa6ca26 Update changelog 2017-01-03 10:21:33 +01:00
Juan Martín Sotuyo Dodero
54db0ffbd9 [java] UnnecessaryFullyQualifiedNameRule handles same file class conflicts
- This resolves [#1555](https://sourceforge.net/p/pmd/bugs/1555/)
 - If a class is defined in the same file that conflicts with an import,
    it's not considered a violation
2017-01-03 10:18:29 +01:00
Juan Martín Sotuyo Dodero
66b6b8df19 Merge branch 'changelog' into pmd/5.4.x 2016-12-13 13:26:42 -03:00
Juan Martín Sotuyo Dodero
454fddb09d Revamp changelog format
- Make it a little more marketing friendly
2016-12-13 13:25:01 -03:00
Andreas Dangel
a7b89a8c47 Merge branch 'pr-141' into pmd/5.4.x
Closes #141 (rebased for pmd/5.4.x)
2016-12-10 10:15:45 +01:00
Andreas Dangel
48e803392a Update changelog 2016-12-10 10:14:00 +01:00
Juan Martín Sotuyo Dodero
28a24dec2a [java] Speedup PreserveStackTrace by over 7X
- By avoiding to look at all variable declarators we can greatly improve
    analysis speed without loosing accurancy
2016-12-10 10:13:37 +01:00
Andreas Dangel
637b82bce9 Merge branch 'pr-140' into pmd/5.4.x
Closes #140 (rebased onto pmd/5.4.x)
2016-12-09 09:49:17 +01:00
Andreas Dangel
a250974b29 Update changelog 2016-12-09 09:45:25 +01:00
Juan Martín Sotuyo Dodero
f4e727d274 [java] Make CloneMethodMustImplementCloneable over 500x faster
- This was an excruciatingly slow rule, the slowest by far of all PMD
 - We speed it up by:
    * checking early if we are analyzing a `clone()` method to cut the AST tree
    * making better use of type information available
    * only performing additional checks when we know we can't rely on
       available type information
2016-12-09 09:44:23 +01:00
Juan Martín Sotuyo Dodero
795d437cd4 Merge branch 'pr-154' into pmd/5.4.x 2016-12-07 14:28:06 -03:00
Juan Martín Sotuyo Dodero
2fbe0b977a Update changelog 2016-12-07 14:26:58 -03:00
Sebastian Ratz
61e0fc5875 [java] Fix #1547: UnusedImports: Adjust regex to support underscores 2016-12-07 14:14:07 -03:00
Juan Martín Sotuyo Dodero
68546d1907 Merge branch 'pr-152' into pmd/5.4.x 2016-12-07 13:24:21 -03:00
Juan Martín Sotuyo Dodero
6096bb9c98 Update changelog 2016-12-07 13:17:59 -03:00
Felix Otto
9f1f63ffe6 fixes #1552 [java] continue does not require break
Similar to RETURN after a CONTINUE statement break is not required in a
case section
2016-12-07 13:10:23 -03:00
Andreas Dangel
6a75353da3 Merge branch 'issue-1546' into pmd/5.4.x 2016-11-26 18:16:04 +01:00
Juan Martín Sotuyo Dodero
9460758e69 Update changelog 2016-11-26 18:14:27 +01:00
Juan Martín Sotuyo Dodero
7e3546c130 UnnecessaryFullyQualifiedName can detect conflicts
- Fixes https://sourceforge.net/p/pmd/bugs/1546/
2016-11-26 18:13:10 +01:00
Andreas Dangel
a5d7df9929 Merge branch 'pr-130' into pmd/5.4.x 2016-11-26 17:08:05 +01:00
Juan Martín Sotuyo Dodero
1b5135f360 Update changelog 2016-11-26 17:07:31 +01:00
Juan Martín Sotuyo Dodero
eca1f7c8ef Remove synchronization from RuleContext 2016-11-26 17:07:05 +01:00
Juan Martín Sotuyo Dodero
87f26e57e7 Use a LRU cache in SaxonXPathRuleQuery 2016-11-26 17:07:05 +01:00
Juan Martín Sotuyo Dodero
49e3de4a06 Allow concurrency in AttributeAxisIterator 2016-11-26 17:03:32 +01:00
Andreas Dangel
68b41d3bc9 Merge branch 'pr-128' into pmd/5.4.x 2016-11-26 11:06:02 +01:00
Juan Martín Sotuyo Dodero
b5ca7baa9a Ensure className is never null 2016-11-26 11:04:29 +01:00
Juan Martín Sotuyo Dodero
810760e3a6 Update changelog 2016-11-26 11:04:29 +01:00
Juan Martín Sotuyo Dodero
19a8d0d060 Minor optimizations to type resolution 2016-11-26 11:04:00 +01:00
Andreas Dangel
d395ddca53 Merge branch 'pr-127' into pmd/5.4.x 2016-11-26 10:30:35 +01:00
Andreas Dangel
716b628062 Update changelog 2016-11-26 10:30:01 +01:00
Juan Martín Sotuyo Dodero
95101fddaf Don't look twice for the same variables
- This reduces calls to all scope resolution methods
2016-11-26 10:29:02 +01:00