Update changelog
This commit is contained in:
@@ -13,6 +13,7 @@ This is a bug fixing release.
|
||||
### Table Of Contents
|
||||
|
||||
* [New and noteworthy](#new-and-noteworthy)
|
||||
* [XPath Type Resolution Methods](#xpath-type-resolution-methods)
|
||||
* [New Rules](#new-rules)
|
||||
* [Modified Rules](#modified-rules)
|
||||
* [Fixed Issues](#fixed-issues)
|
||||
@@ -21,6 +22,40 @@ This is a bug fixing release.
|
||||
|
||||
### New and noteworthy
|
||||
|
||||
#### XPath Type Resolution Methods
|
||||
|
||||
For some time now PMD has supported Type Resolution, and exposed this functionality to XPath rules for Java language
|
||||
with the `typeof` method. This method however had a number of shortcomings:
|
||||
|
||||
* It would take a first arg with the name to match if types couldn't be resolved. In all cases this was `@Image`
|
||||
but was still required.
|
||||
* It required 2 separate arguments for the Fully Qualified Class Name and the short name of the class against
|
||||
which to test.
|
||||
* If only the Fully Qualified Class Name was provided, no short name check was performed (not documented,
|
||||
but abused on some rules to "fix" some false positives).
|
||||
|
||||
In this release we are deprecating `typeof` in favor of a simpler `typeIs` method, which behaves exactly as the
|
||||
old `typeof` when given all 3 arguments.
|
||||
|
||||
`typeIs` receives a single parameter, containing the fully qualified name of the class to test against.
|
||||
|
||||
So, calls such as:
|
||||
|
||||
```xml`
|
||||
//ClassOrInterfaceType[typeof(@Image, 'junit.framework.TestCase', 'TestCase')]
|
||||
```
|
||||
|
||||
can now we expressed much more concisely as:
|
||||
|
||||
```xml`
|
||||
//ClassOrInterfaceType[typeIs('junit.framework.TestCase')]
|
||||
```
|
||||
|
||||
Additionally, we have introduced a companion `typeIsExactly` method, that receives the same parameters, but
|
||||
will check for exact type matches without transversing the type hierarchy. That is, when using
|
||||
`typeIsExactly('junit.framework.TestCase')` will match only if the class is an instance of `TestCase`, but
|
||||
not if it's a subclass of `TestCase`.
|
||||
|
||||
#### New Rules
|
||||
|
||||
* The new Java rule [`HardCodedCryptoKey`](pmd_rules_java_security.html#hardcodedcryptokey) (`java-security`)
|
||||
|
Reference in New Issue
Block a user