forked from phoedos/pmd
Merge branch 'master' into 7.0.x
This commit is contained in:
@@ -10,6 +10,7 @@ env:
|
||||
- secure: "B2quYqla3mqu3QHqeRGMde66IFAluUHhzY87q/giPvONm/V7xmIcxzC6JNQ7X4pHotC7MUbsMf7vdcL1tyuPP5nqyfaxk0nnGnVoJZIQhMaBQ6Lkyt2Ac5u5/QBeHujrj8gqGjT7vzgPIYMYiSLV09VcPgMaYS6WxCrFmXOEJOeVGOGjG9J2wApAmlf6m/hBogLEbdbzRheqJwX5gMxppKX5XRaiqvKGR7hHFiW5HBaAiQ6caQEw6DZL9GnjMsqd5VMVL7DmbETncNE1utLVDO7mFwDMbkeonmwjsmQsJAo5Be+WFl/a/yRQLrqhhTFwag+V7g7RjcBKAdJ5IZJkN0EC9GjY0ZGOjE2cmcrX03U1g1voO7oreH6+25VqPTTGWHv5K8wDWM5QnhBJGtH2yH76p5XYK8iNOXPTqvjubN9sG3INsnTjxBHuQw+aY2vgwBGCvW+Asqe73BV8SDrmqcCqgmm/BUy0kZRd8mhaQdFL0SAO3suV7uf+fzIsmRtndFx24J5Cm6LE6NnTmtbhHhs4mUEqfngMq0XZBXj5z4LDhzOH4g3rf/Y7jHBjAAa6sKeh1sINdHrMdB843dDfNQPp/7g3hfKi31U9ZMczndsr2QYqm2OC/3lPiRHC+8Grj5PxXmiBplzTppyhl+1pjZWy5SCoQi6ulBOyaZcwfYM="
|
||||
- secure: "Kmh31kozw9NBbwtkucpf+QslinJIclB7rcktHz4RokVS5xiMD7njWvD8ptZhXqZG/tNcNiXkWskgM9EV/OvLTTavJToHE1gMhJel5ODxKM0b5QZDy6tkW/wI0Kdl0lck90EAJ7bmsOmF+oGczGsauiLPSlBOZV0tn1zdeJKwwmg46C9UyIhTDcFqUD1ehxExkDHnbOk6HmEPGCsZQCGNXY2t++dO7fRodIgjZAKcyTwgrh6WEZDfQDjvC51yQlVzL2mrcFqHi8qYAx3OHnuidRoMZ4huaoxLimw/1bGii/txTZwJ/pQdF90kGqSqLpRiO2lHLq5l8WAd4Z1XPSs1ZzbKUEhWO8VGgfR0Cp+Bkkd6P/vcuTq7bdhpvdnZn9FRUI/bfgZi827Skj/WoUh0RR7ns6RuDfQ5uGD9NiWDsbfoKLbvvYjyQycQlQTKglYQVcU/pWsuqVlx+27vM6JltR0Pct4uAJxAN+EFA4sTT/u4HiZ0NQyZWisZauu7CyMRN29fkKVVyYHHCr6QcNMUpvp1vvKYaUN7GeykGNVfoHB7CWAKcc6banh33c+QqG5DSTE++ZNa712gxEizQnO5MmLECUxNDpOGZnLsTlgbABwDxxe4PxFxXvBLm9pkJftq5cp9T9Syzz/yyT7z5weSGvRes94eUtSt0agoeX2MKsE="
|
||||
- secure: "VezxV+VdmbmtrQYT8AZIyg41WBROxuxpumerkcubADF7V4wV6lwx9Rd2G6yAr0VuHCNUUhS4m+gPFIsuiQbAhyupiEkwhzUYqk1tF+LITlLLPegLypjiLmhJMwGUNuDSSsih1Icmg9FzrP4VyzgGn9pBjoG9QYj1civBZeGwg++e/XDYlHMXrpd/UEfMKVB71JwB0tle4fKJZSvblIqP62yvbBaKHx6A4+ZWzJV5Vps0DoIeNtKCNmNNloKZVHfjbsvqSjnMYUJzkOzyPkM822q41N/D+3IAufO16+jH/W0vAZeN0e4GXiN5W+CVkr2Gbh0FwkVQcI3bekaOIn45XLUMLKdf+JsWDPKz9RraHelR9YxL5GoJ7ntwvmucxw0p8EVyJ/xLk/pBCP8iHq0Jb8//js25XHgxzzAWI37MErPAAGgTKZAVdAN0mGXbe63tWmwaBlEbK8h2A8di6abW5x6YHTkTo2BRlHUSTU8dE3VqTnpSkne5n1SlEa4g1Bci3J45M0/pLmHV6yCxCM5BrVXS5ByaB61py/umSbpmdIBFV6TM1MaKK3lAucQrR+8To/vCbm8XqPyujJdOR+ENIuuDgEU/Yh5Hv5SAODekUYaCp4pjfGzFADHQWVNDxIOXrwBN4OfSiAvRc1x6HXndOmNI4QtOxheuCRFFthq8VZI="
|
||||
- GITHUB_BASE_URL=https://api.github.com/repos/pmd/pmd
|
||||
|
||||
jobs:
|
||||
fast_finish: true
|
||||
@@ -96,5 +97,5 @@ cache:
|
||||
# add the encrypted GPG keyring file to repo (https://docs.travis-ci.com/user/encrypting-files/#Automated-Encryption), decrypt it and install it at the beginning of .travis-deploy.sh
|
||||
#
|
||||
# GITHUB_OAUTH_TOKEN - the token used to upload the binaries to github releases
|
||||
# GITHUB_BASE_URL - the api url to use for github releases - does not need to be secure (https://api.github.com/repos/pmd/pmd)
|
||||
#
|
||||
|
||||
|
@@ -1,9 +1,10 @@
|
||||
#
|
||||
# The functions here require the following scripts:
|
||||
# .travis/logger.sh
|
||||
# logger.sh
|
||||
#
|
||||
# The functions here require the following environment variables:
|
||||
# GITHUB_OAUTH_TOKEN
|
||||
# GITHUB_BASE_URL
|
||||
#
|
||||
|
||||
#
|
||||
@@ -30,13 +31,13 @@ function gh_releases_createDraftRelease() {
|
||||
EOF
|
||||
)
|
||||
|
||||
log_debug "POST https://api.github.com/repos/pmd/pmd/releases"
|
||||
log_debug "POST $GITHUB_BASE_URL/releases"
|
||||
log_info "Creating github draft release"
|
||||
RESULT=$(curl --fail -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
--data "${request}" \
|
||||
"https://api.github.com/repos/pmd/pmd/releases")
|
||||
"$GITHUB_BASE_URL/releases")
|
||||
log_debug " -> response: $RESULT"
|
||||
|
||||
log_success "Created draft release with id $(echo $RESULT | jq --raw-output ".url")"
|
||||
@@ -53,9 +54,9 @@ function gh_releases_createDraftRelease() {
|
||||
#
|
||||
function gh_releases_getLatestDraftRelease() {
|
||||
log_debug "$FUNCNAME"
|
||||
log_debug "GET https://api.github.com/repos/pmd/pmd/releases?per_page=1"
|
||||
log_debug "GET $GITHUB_BASE_URL/releases?per_page=1"
|
||||
RESULT=$(curl --fail -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" \
|
||||
"https://api.github.com/repos/pmd/pmd/releases?per_page=1" | jq ".[0]")
|
||||
"$GITHUB_BASE_URL/releases?per_page=1" | jq ".[0]")
|
||||
log_debug " -> response: $RESULT"
|
||||
local draft=$(echo $RESULT | jq ".draft")
|
||||
if [ "$draft" != "true" ]; then
|
||||
@@ -77,12 +78,12 @@ function gh_release_deleteRelease() {
|
||||
gh_release_getIdFromData "$release"
|
||||
local releaseId="$RESULT"
|
||||
log_debug "$FUNCNAME id=$releaseId"
|
||||
log_debug "DELETE https://api.github.com/repos/pmd/pmd/releases/$releaseId"
|
||||
log_debug "DELETE $GITHUB_BASE_URL/releases/$releaseId"
|
||||
log_info "Deleting github release $releaseId"
|
||||
local response
|
||||
response=$(curl --fail -s -H "Authorization: token ${GITHUB_OAUTH_TOKEN}" \
|
||||
-X DELETE \
|
||||
"https://api.github.com/repos/pmd/pmd/releases/$releaseId")
|
||||
"$GITHUB_BASE_URL/releases/$releaseId")
|
||||
log_debug " -> response: $response"
|
||||
log_success "Deleted release with id $releaseId"
|
||||
}
|
||||
@@ -98,6 +99,17 @@ function gh_release_getIdFromData() {
|
||||
RESULT=$(echo $release | jq --raw-output ".id")
|
||||
}
|
||||
|
||||
#
|
||||
# Determines the tag_name from the given JSON release data.
|
||||
#
|
||||
# RESULT = "the tag name"
|
||||
#
|
||||
function gh_release_getTagNameFromData() {
|
||||
local release="$1"
|
||||
|
||||
RESULT=$(echo $release | jq --raw-output ".tag_name")
|
||||
}
|
||||
|
||||
#
|
||||
# Uploads a asset to an existing release.
|
||||
#
|
||||
@@ -141,7 +153,9 @@ function gh_release_updateRelease() {
|
||||
|
||||
gh_release_getIdFromData "$release"
|
||||
local releaseId="$RESULT"
|
||||
log_debug "$FUNCNAME releaseId=$releaseId name=$name"
|
||||
gh_release_getTagNameFromData "$release"
|
||||
local tagName="$RESULT"
|
||||
log_debug "$FUNCNAME releaseId=$releaseId name=$name tag_name=$tagName"
|
||||
|
||||
body="${body//'\'/\\\\}"
|
||||
body="${body//$'\r'/}"
|
||||
@@ -150,13 +164,14 @@ function gh_release_updateRelease() {
|
||||
|
||||
local request=$(cat <<-EOF
|
||||
{
|
||||
"tag_name": "${tagName}",
|
||||
"name": "${name}",
|
||||
"body": "${body}"
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
log_debug "PATCH https://api.github.com/repos/pmd/pmd/releases/${releaseId}"
|
||||
log_debug "PATCH $GITHUB_BASE_URL/releases/${releaseId}"
|
||||
log_debug " -> request: $request"
|
||||
log_info "Updating github release $releaseId"
|
||||
local response
|
||||
@@ -164,7 +179,7 @@ function gh_release_updateRelease() {
|
||||
-H "Content-Type: application/json" \
|
||||
--data "${request}" \
|
||||
-X PATCH \
|
||||
"https://api.github.com/repos/pmd/pmd/releases/${releaseId}")
|
||||
"$GITHUB_BASE_URL/releases/${releaseId}")
|
||||
log_debug " -> response: $response"
|
||||
log_success "Updated release with id=$releaseId"
|
||||
}
|
||||
@@ -184,7 +199,7 @@ function gh_release_publishRelease() {
|
||||
log_debug "$FUNCNAME releaseId=$releaseId"
|
||||
|
||||
local request='{"draft":false}'
|
||||
log_debug "PATCH https://api.github.com/repos/pmd/pmd/releases/${releaseId}"
|
||||
log_debug "PATCH $GITHUB_BASE_URL/releases/${releaseId}"
|
||||
log_debug " -> request: $request"
|
||||
log_info "Publishing github release $releaseId"
|
||||
local response
|
||||
@@ -192,9 +207,8 @@ function gh_release_publishRelease() {
|
||||
-H "Content-Type: application/json" \
|
||||
--data "${request}" \
|
||||
-X PATCH \
|
||||
"https://api.github.com/repos/pmd/pmd/releases/${releaseId}")
|
||||
"$GITHUB_BASE_URL/releases/${releaseId}")
|
||||
log_debug " -> response: $response"
|
||||
local htmlUrl=$(echo "$response" | jq --raw-output ".html_url")
|
||||
log_success "Published release with id=$releaseId at $htmlUrl"
|
||||
}
|
||||
|
||||
|
@@ -204,6 +204,16 @@ echo "$NEW_RELEASE_NOTES"
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
tweet="PMD ${RELEASE_VERSION} released: https://github.com/pmd/pmd/releases/tag/pmd_releases/${RELEASE_VERSION} #PMD"
|
||||
tweet="${tweet// /%20}"
|
||||
tweet="${tweet//:/%3A}"
|
||||
tweet="${tweet//#/%23}"
|
||||
tweet="${tweet//\//%2F}"
|
||||
tweet="${tweet//$'\r'//}"
|
||||
tweet="${tweet//$'\n'//%0A}"
|
||||
echo "* Tweet about this release on https://twitter.com/pmd_analyzer:"
|
||||
echo " <https://twitter.com/intent/tweet?text=$tweet>"
|
||||
echo
|
||||
echo "------------------------------------------"
|
||||
echo "Done."
|
||||
echo "------------------------------------------"
|
||||
|
@@ -26,16 +26,26 @@ For the changes, see [PMD Designer Changelog](https://github.com/pmd/pmd-designe
|
||||
|
||||
### Fixed Issues
|
||||
|
||||
* java
|
||||
* [#2268](https://github.com/pmd/pmd/issues/2268): \[java] Improve TypeHelper resilience
|
||||
* java-errorprone
|
||||
* [#2250](https://github.com/pmd/pmd/issues/2250): \[java] InvalidLogMessageFormat flags logging calls using a slf4j-Marker
|
||||
* java-performance
|
||||
* [#2275](https://github.com/pmd/pmd/issues/2275): \[java] AppendCharacterWithChar flags literals in an expression
|
||||
|
||||
### API Changes
|
||||
|
||||
#### Deprecated API
|
||||
|
||||
* {% jdoc core::lang.dfa.DFAGraphRule %} and its implementations
|
||||
* {% jdoc core::lang.dfa.DFAGraphMethod %}
|
||||
|
||||
### External Contributions
|
||||
|
||||
* [#2251](https://github.com/pmd/pmd/pull/2251): \[java] FP for InvalidLogMessageFormat when using slf4j-Markers - [Kris Scheibe](https://github.com/kris-scheibe)
|
||||
* [#2253](https://github.com/pmd/pmd/pull/2253): \[modelica] Remove duplicated dependencies - [Piotrek Żygieło](https://github.com/pzygielo)
|
||||
* [#2256](https://github.com/pmd/pmd/pull/2256): \[doc] Corrected XML attributes in release notes - [Maikel Steneker](https://github.com/maikelsteneker)
|
||||
* [#2276](https://github.com/pmd/pmd/pull/2276): \[java] AppendCharacterWithCharRule ignore literals in expressions - [Kris Scheibe](https://github.com/kris-scheibe)
|
||||
|
||||
{% endtocmaker %}
|
||||
|
||||
|
@@ -6,6 +6,10 @@ package net.sourceforge.pmd.lang.dfa;
|
||||
|
||||
import net.sourceforge.pmd.lang.ast.Node;
|
||||
|
||||
/**
|
||||
* @deprecated Only used by the deprecated designer
|
||||
*/
|
||||
@Deprecated
|
||||
public interface DFAGraphMethod extends Node {
|
||||
|
||||
String getName();
|
||||
|
@@ -8,6 +8,10 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.pmd.Rule;
|
||||
|
||||
/**
|
||||
* @deprecated Only used by the deprecated designer
|
||||
*/
|
||||
@Deprecated
|
||||
public interface DFAGraphRule extends Rule {
|
||||
List<DFAGraphMethod> getMethods();
|
||||
}
|
||||
|
@@ -13,6 +13,10 @@ import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
|
||||
|
||||
/**
|
||||
* @deprecated Only used by the deprecated designer
|
||||
*/
|
||||
@Deprecated
|
||||
public class JavaDFAGraphRule extends AbstractJavaRule implements DFAGraphRule {
|
||||
|
||||
private List<DFAGraphMethod> methods;
|
||||
|
@@ -6,6 +6,8 @@ package net.sourceforge.pmd.lang.java.rule.performance;
|
||||
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTBlockStatement;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTLiteral;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTPrimaryExpression;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTPrimarySuffix;
|
||||
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
|
||||
|
||||
/**
|
||||
@@ -34,6 +36,13 @@ public class AppendCharacterWithCharRule extends AbstractJavaRule {
|
||||
if (!InefficientStringBufferingRule.isInStringBufferOperation(node, 8, "append")) {
|
||||
return data;
|
||||
}
|
||||
|
||||
// ignore, if the literal is part of an expression, such as "X".repeat(5)
|
||||
final ASTPrimaryExpression primaryExpression = (ASTPrimaryExpression) node.getNthParent(2);
|
||||
if (primaryExpression != null && primaryExpression.getFirstChildOfType(ASTPrimarySuffix.class) != null) {
|
||||
return data;
|
||||
}
|
||||
|
||||
addViolation(data, node);
|
||||
}
|
||||
return data;
|
||||
|
@@ -6,6 +6,11 @@ package net.sourceforge.pmd.lang.java.typeresolution;
|
||||
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceType;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTEnumDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTImplementsList;
|
||||
import net.sourceforge.pmd.lang.java.ast.TypeNode;
|
||||
import net.sourceforge.pmd.lang.java.symboltable.TypedNameDeclaration;
|
||||
|
||||
@@ -35,7 +40,45 @@ public final class TypeHelper {
|
||||
return isA(n, clazz);
|
||||
}
|
||||
|
||||
return clazzName.equals(n.getImage()) || clazzName.endsWith("." + n.getImage());
|
||||
return fallbackIsA(n, clazzName);
|
||||
}
|
||||
|
||||
private static boolean fallbackIsA(TypeNode n, String clazzName) {
|
||||
if (clazzName.equals(n.getImage()) || clazzName.endsWith("." + n.getImage())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (n instanceof ASTClassOrInterfaceDeclaration) {
|
||||
ASTClassOrInterfaceType superClass = ((ASTClassOrInterfaceDeclaration) n).getSuperClassTypeNode();
|
||||
if (superClass != null) {
|
||||
return isA(superClass, clazzName);
|
||||
}
|
||||
|
||||
for (ASTClassOrInterfaceType itf : ((ASTClassOrInterfaceDeclaration) n).getSuperInterfacesTypeNodes()) {
|
||||
if (isA(itf, clazzName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (n instanceof ASTEnumDeclaration) {
|
||||
|
||||
ASTImplementsList implemented = n.getFirstChildOfType(ASTImplementsList.class);
|
||||
if (implemented != null) {
|
||||
for (ASTClassOrInterfaceType itf : implemented) {
|
||||
if (isA(itf, clazzName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "java.lang.Enum".equals(clazzName)
|
||||
// supertypes of Enum
|
||||
|| "java.lang.Comparable".equals(clazzName)
|
||||
|| "java.io.Serializable".equals(clazzName);
|
||||
} else if (n instanceof ASTAnnotationTypeDeclaration) {
|
||||
return "java.lang.annotation.Annotation".equals(clazzName);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,8 +180,10 @@ public final class TypeHelper {
|
||||
|
||||
public static boolean subclasses(TypeNode n, Class<?> clazz) {
|
||||
Class<?> type = n.getType();
|
||||
if (type == null || clazz == null) {
|
||||
if (clazz == null) {
|
||||
return false; // If in auxclasspath, both should be resolvable, or are not the same
|
||||
} else if (type == null) {
|
||||
return fallbackIsA(n, clazz.getName());
|
||||
}
|
||||
|
||||
return clazz.isAssignableFrom(type);
|
||||
|
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.java.typeresolution;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTEnumDeclaration;
|
||||
import net.sourceforge.pmd.lang.java.symboltable.BaseNonParserTest;
|
||||
|
||||
public class TypeHelperTest extends BaseNonParserTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testIsAFallback() {
|
||||
|
||||
ASTClassOrInterfaceDeclaration klass =
|
||||
java.parse("package org; import java.io.Serializable; "
|
||||
+ "class FooBar implements Serializable {}")
|
||||
.getFirstDescendantOfType(ASTClassOrInterfaceDeclaration.class);
|
||||
|
||||
|
||||
Assert.assertNull(klass.getType());
|
||||
Assert.assertTrue(TypeHelper.isA(klass, "org.FooBar"));
|
||||
Assert.assertTrue(TypeHelper.isA(klass, "java.io.Serializable"));
|
||||
Assert.assertTrue(TypeHelper.isA(klass, Serializable.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testIsAFallbackEnum() {
|
||||
|
||||
ASTEnumDeclaration klass =
|
||||
java.parse("package org; "
|
||||
+ "enum FooBar implements Iterable {}")
|
||||
.getFirstDescendantOfType(ASTEnumDeclaration.class);
|
||||
|
||||
|
||||
Assert.assertNull(klass.getType());
|
||||
Assert.assertTrue(TypeHelper.isA(klass, "org.FooBar"));
|
||||
Assert.assertTrue(TypeHelper.isA(klass, "java.lang.Iterable"));
|
||||
Assert.assertTrue(TypeHelper.isA(klass, Iterable.class));
|
||||
Assert.assertTrue(TypeHelper.isA(klass, Enum.class));
|
||||
Assert.assertTrue(TypeHelper.isA(klass, Serializable.class));
|
||||
Assert.assertTrue(TypeHelper.isA(klass, Comparable.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAFallbackAnnotation() {
|
||||
|
||||
ASTAnnotationTypeDeclaration klass =
|
||||
java.parse("package org; import foo.Stuff;"
|
||||
+ "public @interface FooBar {}")
|
||||
.getFirstDescendantOfType(ASTAnnotationTypeDeclaration.class);
|
||||
|
||||
|
||||
Assert.assertNull(klass.getType());
|
||||
Assert.assertTrue(TypeHelper.isA(klass, "org.FooBar"));
|
||||
Assert.assertTrue(TypeHelper.isA(klass, Annotation.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -4,9 +4,7 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
appending single character string, should fail
|
||||
]]></description>
|
||||
<description>appending single character string, should fail</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -17,9 +15,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
appending single char, should be ok
|
||||
]]></description>
|
||||
<description>appending single char, should be ok</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -30,9 +26,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
this is probably wrong, but shouldn't fail
|
||||
]]></description>
|
||||
<description>this is probably wrong, but shouldn't fail</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -43,9 +37,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
concatenates a three character int
|
||||
]]></description>
|
||||
<description>concatenates a three character int</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -56,9 +48,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
concatenates a string explicitly set to 1 character, not explicitly checking right now
|
||||
]]></description>
|
||||
<description>concatenates a string explicitly set to 1 character, not explicitly checking right now</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -70,9 +60,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
for statement
|
||||
]]></description>
|
||||
<description>for statement</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -84,9 +72,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
concatenates an escaped character
|
||||
]]></description>
|
||||
<description>concatenates an escaped character</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -97,9 +83,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
concatenates all escaped characters
|
||||
]]></description>
|
||||
<description>concatenates all escaped characters</description>
|
||||
<expected-problems>8</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -117,9 +101,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
concatenates a single upper case
|
||||
]]></description>
|
||||
<description>concatenates a single upper case</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -130,9 +112,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
concatenates a single number
|
||||
]]></description>
|
||||
<description>concatenates a single number</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -143,9 +123,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
concatenates a single character &
|
||||
]]></description>
|
||||
<description>concatenates a single character &</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -156,9 +134,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
concatenates two characters
|
||||
]]></description>
|
||||
<description>concatenates two characters</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -169,9 +145,7 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
a single octal character
|
||||
]]></description>
|
||||
<description>a single octal character</description>
|
||||
<expected-problems>2</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
@@ -183,15 +157,24 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
octal character in longer string
|
||||
]]></description>
|
||||
<description>octal character in longer string</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public void bar(StringBuffer sb) {
|
||||
sb.append("\1234");
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>append a single character as part of an expression (#2275)</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public void bar(StringBuffer sb, int length) {
|
||||
sb.append("a".repeat(length));
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
@@ -16,6 +16,10 @@ import net.sourceforge.pmd.lang.plsql.ast.ASTTriggerUnit;
|
||||
import net.sourceforge.pmd.lang.plsql.ast.ASTTypeMethod;
|
||||
import net.sourceforge.pmd.lang.plsql.rule.AbstractPLSQLRule;
|
||||
|
||||
/**
|
||||
* @deprecated Only used by the deprecated designer
|
||||
*/
|
||||
@Deprecated
|
||||
public class DFAPLSQLGraphRule extends AbstractPLSQLRule implements DFAGraphRule {
|
||||
|
||||
private List<DFAGraphMethod> executables;
|
||||
|
Reference in New Issue
Block a user