Comments (5)
//ClassOrInterfaceDeclaration
[pmd-java:typeIs('java.lang.Exception')] (: extends Exception class :)
[
not(
./ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/ConstructorDeclaration/FormalParameters[
(: Ctor(Throwable, String, Object...) :)
(./FormalParameter[1]/Type/ReferenceType/ClassOrInterfaceType[pmd-java:typeIs('java.lang.Throwable')]
and
./FormalParameter[2]/Type/ReferenceType/ClassOrInterfaceType[pmd-java:typeIs('java.lang.String')]
and
./FormalParameter[3][@Varargs=true()]/Type/ReferenceType/ClassOrInterfaceType[pmd-java:typeIsExactly('java.lang.Object')])
or
(: Ctor(String, Object...) :)
(./FormalParameter[1]/Type/ReferenceType/ClassOrInterfaceType[pmd-java:typeIs('java.lang.String')]
and
./FormalParameter[2][@Varargs=true()]/Type/ReferenceType/ClassOrInterfaceType[pmd-java:typeIsExactly('java.lang.Object')])] (: typeIs('java.lang.Object') can accept any class :)
)
]
from arch4u-pmd.
@dgroup , should the rule throw violation for the following case?
class MyException extends Exception {
public MyException(Exception cause, String pattern, Object... args) {
}
}
Here we have Exception as a first constructor param, not Throwable
from arch4u-pmd.
@dgroup , also should these constructors have strictly public
modifier?
from arch4u-pmd.
Not sure about public, let's do not check it so far
from arch4u-pmd.
@dgroup, so i suggest to check for non-private modifier?
from arch4u-pmd.
Related Issues (20)
- New rule: return empty collection, empty array or optional instead of null
- New rule: entity creation endpoints with putmapping/postmapping without response status 201
- New rule: Do not pass `cause.getMessage()` if you already passed the `cause` to a new exception
- AtLeastOneConstructor false-positives
- New rule: Avoid String.valueOf(arg) where arg is a String
- UseUtilityClass false-positives
- JUnitAssertionsShouldIncludeMessage false-positives
- ShortClassName should has minimum 3 symbols
- ImmutableField false positive HOT 6
- Same method invocation within a chain of invocation (fluent interface)
- Add how to exclude java package using java/gradle config
- AvoidUsingObjectMapperAsALocalVariable is allowed in methods with annotation org.springframework.context.annotation.Bean
- Set maximum variable name = 25 to support Spring/Quarkus naming HOT 3
- Use Apache Camel .bean method instead of @Autowired+.processor
- New rule: AvoidMixingJunit4AndJunit5
- DepShield Deprecation Notice
- Merge all rules to single ruleset `arch4u-pmd.xml`
- Remove todoformat as its not covering the non-java source files
- Remove cactoos from project
- Exclusion of deleted BeanMembersShouldSerialize rule gives warning in logs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arch4u-pmd.