patch upper-case acronyms to be PascalCase

This commit is contained in:
Erik Krogh Kristensen
2022-03-11 11:10:33 +01:00
parent e3a15792fa
commit 69353bb014
422 changed files with 3532 additions and 2244 deletions

View File

@@ -3,7 +3,7 @@ import semmle.code.java.frameworks.spring.SpringXMLElement
import semmle.code.java.frameworks.spring.SpringBean
/** A common supertype of `SpringRef` and `SpringIdRef`. */
class SpringAbstractRef extends SpringXMLElement {
class SpringAbstractRef extends SpringXmlElement {
SpringAbstractRef() {
this.getName() = "idref" or
this.getName() = "ref"
@@ -29,7 +29,7 @@ class SpringAbstractRef extends SpringXMLElement {
}
/** Holds if `other` is also a reference and points to the same bean as this reference. */
override predicate isSimilar(SpringXMLElement other) {
override predicate isSimilar(SpringXmlElement other) {
exists(SpringAbstractRef otherRef |
otherRef = other and
this.getBean() = otherRef.getBean()

View File

@@ -3,7 +3,7 @@ import semmle.code.java.frameworks.spring.SpringXMLElement
import semmle.code.java.frameworks.spring.SpringBean
/** An `<alias>` element in Spring XML files. */
class SpringAlias extends SpringXMLElement {
class SpringAlias extends SpringXmlElement {
SpringAlias() { this.getName() = "alias" }
/** Gets the value of the `alias` attribute. */

View File

@@ -2,7 +2,7 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** An `<arg-type>` element in Spring XML files. */
class SpringArgType extends SpringXMLElement {
class SpringArgType extends SpringXmlElement {
SpringArgType() { this.getName() = "arg-type" }
/** Gets the value of the `match` attribute. */

View File

@@ -2,7 +2,7 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** An `<attribute>` element in Spring XML files. */
class SpringAttribute extends SpringXMLElement {
class SpringAttribute extends SpringXmlElement {
SpringAttribute() { this.getName() = "attribute" }
/** Gets the value of the `key` attribute. */

View File

@@ -58,8 +58,8 @@ class SpringBeanPropertySetterMethod extends Method {
*
* Confusingly, this is a different form of autowiring to the `@Autowired` annotation.
*/
class SpringBeanXMLAutowiredSetterMethod extends Method {
SpringBeanXMLAutowiredSetterMethod() {
class SpringBeanXmlAutowiredSetterMethod extends Method {
SpringBeanXmlAutowiredSetterMethod() {
// The bean as marked with some form of autowiring in the XML file.
exists(string xmlAutowire |
xmlAutowire = this.getDeclaringType().(SpringBeanRefType).getSpringBean().getAutowire()
@@ -100,6 +100,9 @@ class SpringBeanXMLAutowiredSetterMethod extends Method {
}
}
/** DEPRECATED: Alias for SpringBeanXmlAutowiredSetterMethod */
deprecated class SpringBeanXMLAutowiredSetterMethod = SpringBeanXmlAutowiredSetterMethod;
/**
* A callable that is annotated with `@Autowired`.
*

View File

@@ -12,7 +12,7 @@ import semmle.code.java.frameworks.spring.SpringReplacedMethod
*/
/** A `<bean>` element in a Spring XML file. */
class SpringBean extends SpringXMLElement {
class SpringBean extends SpringXmlElement {
SpringBean() {
this.getName() = "bean" and
// Do not capture Camel beans, which are different
@@ -268,7 +268,7 @@ class SpringBean extends SpringXMLElement {
/**
* Holds if this bean element has the same bean identifier as `other`.
*/
override predicate isSimilar(SpringXMLElement other) {
override predicate isSimilar(SpringXmlElement other) {
this.getBeanIdentifier() = other.(SpringBean).getBeanIdentifier()
}

View File

@@ -9,56 +9,71 @@ import semmle.code.java.frameworks.spring.SpringBean
/**
* An Apache Camel element in a Spring Beans file.
*/
class SpringCamelXMLElement extends SpringXMLElement {
SpringCamelXMLElement() { getNamespace().getURI() = "http://camel.apache.org/schema/spring" }
class SpringCamelXmlElement extends SpringXmlElement {
SpringCamelXmlElement() { getNamespace().getURI() = "http://camel.apache.org/schema/spring" }
}
/** DEPRECATED: Alias for SpringCamelXmlElement */
deprecated class SpringCamelXMLElement = SpringCamelXmlElement;
/**
* An element in a Spring beans file that defines an Apache Camel context.
*
* All Apache Camel Spring elements are nested within a `<camelContext>` or a `<routeContext>`.
*/
class SpringCamelXMLContext extends SpringCamelXMLElement {
SpringCamelXMLContext() { getName() = "camelContext" }
class SpringCamelXmlContext extends SpringCamelXmlElement {
SpringCamelXmlContext() { getName() = "camelContext" }
}
/** DEPRECATED: Alias for SpringCamelXmlContext */
deprecated class SpringCamelXMLContext = SpringCamelXmlContext;
/**
* An element in a Spring beans file that defines an Apache Camel route context.
*
* A `<routeContext>` is a fragment, containing route definitions, that can be included within a
* `<camelContext>`.
*/
class SpringCamelXMLRouteContext extends SpringCamelXMLElement {
SpringCamelXMLRouteContext() { getName() = "routeContext" }
class SpringCamelXmlRouteContext extends SpringCamelXmlElement {
SpringCamelXmlRouteContext() { getName() = "routeContext" }
}
/** DEPRECATED: Alias for SpringCamelXmlRouteContext */
deprecated class SpringCamelXMLRouteContext = SpringCamelXmlRouteContext;
/**
* An element in a Spring beans files that defines an Apache Camel route.
*
* A Camel `<route>` element defines how messages that match certain criteria are handled by Apache
* Camel.
*/
class SpringCamelXMLRoute extends SpringCamelXMLElement {
SpringCamelXMLRoute() {
class SpringCamelXmlRoute extends SpringCamelXmlElement {
SpringCamelXmlRoute() {
// A route must either be in a `<routeContext>` or a `<camelContext>`.
(
getParent() instanceof SpringCamelXMLRouteContext or
getParent() instanceof SpringCamelXMLContext
getParent() instanceof SpringCamelXmlRouteContext or
getParent() instanceof SpringCamelXmlContext
) and
getName() = "route"
}
}
/** DEPRECATED: Alias for SpringCamelXmlRoute */
deprecated class SpringCamelXMLRoute = SpringCamelXmlRoute;
/**
* An element in a Spring bean file that is logically contained in an Apache Camel route.
*/
class SpringCamelXMLRouteElement extends SpringCamelXMLElement {
SpringCamelXMLRouteElement() {
getParent() instanceof SpringCamelXMLRoute or
getParent() instanceof SpringCamelXMLRouteElement
class SpringCamelXmlRouteElement extends SpringCamelXmlElement {
SpringCamelXmlRouteElement() {
getParent() instanceof SpringCamelXmlRoute or
getParent() instanceof SpringCamelXmlRouteElement
}
}
/** DEPRECATED: Alias for SpringCamelXmlRouteElement */
deprecated class SpringCamelXMLRouteElement = SpringCamelXmlRouteElement;
/**
* A reference to a Spring bean in an Apache Camel route defined in a Spring beans file.
*
@@ -66,8 +81,8 @@ class SpringCamelXMLRouteElement extends SpringCamelXMLElement {
* specifies a Spring bean that should be called in response to messages that match the enclosing
* route.
*/
class SpringCamelXMLBeanRef extends SpringCamelXMLRouteElement {
SpringCamelXMLBeanRef() { getName() = "bean" }
class SpringCamelXmlBeanRef extends SpringCamelXmlRouteElement {
SpringCamelXmlBeanRef() { getName() = "bean" }
/**
* Gets the Spring bean that is referenced by this route bean definition, if any.
@@ -83,6 +98,9 @@ class SpringCamelXMLBeanRef extends SpringCamelXMLRouteElement {
RefType getBeanType() { result.getQualifiedName() = getAttribute("beanType").getValue() }
}
/** DEPRECATED: Alias for SpringCamelXmlBeanRef */
deprecated class SpringCamelXMLBeanRef = SpringCamelXmlBeanRef;
/**
* A declaration of a target in an Apache Camel route defined in a Spring beans file.
*
@@ -90,8 +108,8 @@ class SpringCamelXMLBeanRef extends SpringCamelXMLRouteElement {
* determines the type of the target. For example, if the scheme is "bean:" then the rest of the uri
* consists of a bean name and optional method name.
*/
class SpringCamelXMLToElement extends SpringCamelXMLRouteElement {
SpringCamelXMLToElement() { getName() = "to" }
class SpringCamelXmlToElement extends SpringCamelXmlRouteElement {
SpringCamelXmlToElement() { getName() = "to" }
/**
* Gets the URI attribute for this `<to>` element.
@@ -99,6 +117,9 @@ class SpringCamelXMLToElement extends SpringCamelXMLRouteElement {
string getURI() { result = getAttribute("uri").getValue() }
}
/** DEPRECATED: Alias for SpringCamelXmlToElement */
deprecated class SpringCamelXMLToElement = SpringCamelXmlToElement;
/**
* A declaration of a Apache Camel "method" expression defined in a Spring beans file.
*
@@ -107,8 +128,8 @@ class SpringCamelXMLToElement extends SpringCamelXMLRouteElement {
* (when the "ref" or "bean" attributes are used), or a type that should be instantiated as a bean
* (if "beanType" is used.
*/
class SpringCamelXMLMethodElement extends SpringCamelXMLElement {
SpringCamelXMLMethodElement() { getName() = "method" }
class SpringCamelXmlMethodElement extends SpringCamelXmlElement {
SpringCamelXmlMethodElement() { getName() = "method" }
/**
* Gets the `SpringBean` that this method expression refers to.
@@ -123,3 +144,6 @@ class SpringCamelXMLMethodElement extends SpringCamelXMLElement {
*/
RefType getBeanType() { result.getQualifiedName() = getAttribute("beanType").getValue() }
}
/** DEPRECATED: Alias for SpringCamelXmlMethodElement */
deprecated class SpringCamelXMLMethodElement = SpringCamelXmlMethodElement;

View File

@@ -8,8 +8,8 @@ import semmle.code.xml.WebXML
* An element in a Spring configuration file that configures which packages are considered to be
* "base" packages when performing the Spring component scan.
*/
class SpringXMLComponentScan extends SpringXMLElement {
SpringXMLComponentScan() {
class SpringXmlComponentScan extends SpringXmlElement {
SpringXmlComponentScan() {
this.getName() = "component-scan" and
this.getNamespace().getPrefix() = "context"
}
@@ -23,6 +23,9 @@ class SpringXMLComponentScan extends SpringXMLElement {
string getAProfileExpr() { result = this.getSpringBeanFile().getAProfileExpr() }
}
/** DEPRECATED: Alias for SpringXmlComponentScan */
deprecated class SpringXMLComponentScan = SpringXmlComponentScan;
/**
* An annotation of a class that configures which packages are considered to be "base" packages
* when performing the Spring component scan.
@@ -59,11 +62,11 @@ class SpringBasePackage extends string {
exists(string basePackages |
// Interpret the contexts of the `web.xml` "contextConfigLocation" parameter as a base package,
// but only if the appropriate context class is chosen.
exists(WebXMLFile webXML |
webXML.getContextParamValue("contextClass") =
exists(WebXmlFile webXml |
webXml.getContextParamValue("contextClass") =
"org.springframework.web.context.support.AnnotationConfigWebApplicationContext"
|
basePackages = webXML.getContextParamValue("contextConfigLocation")
basePackages = webXml.getContextParamValue("contextConfigLocation")
)
or
exists(SpringComponent c, Annotation componentScan |
@@ -75,7 +78,7 @@ class SpringBasePackage extends string {
c.isLive()
)
or
exists(SpringXMLComponentScan xmlComponentScan |
exists(SpringXmlComponentScan xmlComponentScan |
basePackages = xmlComponentScan.getBasePackages() and
// The component scan profile must be active, if one is specified.
(
@@ -110,7 +113,7 @@ class SpringComponentAnnotation extends AnnotationType {
* In order for Spring XML to be "enabled", XML must have been indexed into the snapshot, and that
* XML must contain the appropriate Spring configuration files.
*/
private predicate isSpringXMLEnabled() { exists(SpringXMLElement springXMLElement) }
private predicate isSpringXmlEnabled() { exists(SpringXmlElement springXmlElement) }
/**
* A Spring component class, identified by the presence of a particular annotation.
@@ -178,7 +181,7 @@ class SpringComponent extends RefType {
// only validate whether this class is ever picked up if XML indexing is enabled. If it's
// enabled, then the package of this class must belong in one of the packages defined as a base
// package.
not isSpringXMLEnabled()
not isSpringXmlEnabled()
or
exists(SpringBasePackage sbp |
this.getPackage().getName().prefix(sbp.length() + 1) = sbp + "." or

View File

@@ -5,7 +5,7 @@ import semmle.code.java.frameworks.spring.SpringAbstractRef
import semmle.code.java.frameworks.spring.SpringValue
/** A `<constructor-arg>` element in a Spring XML file. */
class SpringConstructorArg extends SpringXMLElement {
class SpringConstructorArg extends SpringXmlElement {
SpringConstructorArg() { this.getName() = "constructor-arg" }
/** Holds if this `constructor-arg` element has an `index` attribute. */

View File

@@ -6,6 +6,6 @@ import semmle.code.java.frameworks.spring.SpringXMLElement
*
* Its contents can be accessed using `SpringXMLElement.getContentString()`.
*/
class SpringDescription extends SpringXMLElement {
class SpringDescription extends SpringXmlElement {
SpringDescription() { this.getName() = "description" }
}

View File

@@ -6,7 +6,7 @@ import semmle.code.java.frameworks.spring.SpringKey
import semmle.code.java.frameworks.spring.SpringValue
/** An `<entry>` element in Spring XML files. */
class SpringEntry extends SpringXMLElement {
class SpringEntry extends SpringXmlElement {
SpringEntry() { this.getName() = "entry" }
/** Holds if this `entry` has a `key` attribute. */

View File

@@ -9,7 +9,7 @@ import semmle.code.java.frameworks.spring.SpringComponentScan
import semmle.code.java.frameworks.spring.SpringXMLElement
/** Represents a `<remoting-destination>` element in Spring XML files. */
class SpringRemotingDestination extends SpringXMLElement {
class SpringRemotingDestination extends SpringXmlElement {
SpringRemotingDestination() { this.getName() = "remoting-destination" }
/**
@@ -55,7 +55,12 @@ class SpringRemotingDestinationClass extends Class {
/**
* Gets the XML configuration of the remoting destination, if it was configured in XML.
*/
SpringRemotingDestination getRemotingDestinationXML() { this = result.getSpringBean().getClass() }
SpringRemotingDestination getRemotingDestinationXml() { this = result.getSpringBean().getClass() }
/** DEPRECATED: Alias for getRemotingDestinationXml */
deprecated SpringRemotingDestination getRemotingDestinationXML() {
result = getRemotingDestinationXml()
}
/**
* Holds if the class is operating on an "include" or "exclude" basis.
@@ -70,7 +75,7 @@ class SpringRemotingDestinationClass extends Class {
m.hasAnnotation("org.springframework.flex.remoting", "RemotingInclude")
)
or
exists(this.getRemotingDestinationXML().getAnIncludeMethod())
exists(this.getRemotingDestinationXml().getAnIncludeMethod())
}
/**
@@ -81,10 +86,10 @@ class SpringRemotingDestinationClass extends Class {
if this.isIncluding()
then
result.hasAnnotation("org.springframework.flex.remoting", "RemotingInclude") or
result.getName() = this.getRemotingDestinationXML().getAnIncludeMethod()
result.getName() = this.getRemotingDestinationXml().getAnIncludeMethod()
else (
not result.hasAnnotation("org.springframework.flex.remoting", "RemotingExclude") and
not result.getName() = this.getRemotingDestinationXML().getAnExcludeMethod()
not result.getName() = this.getRemotingDestinationXml().getAnExcludeMethod()
)
}
}

View File

@@ -2,7 +2,7 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** An `<import>` element in a Spring XML file. */
class SpringImport extends SpringXMLElement {
class SpringImport extends SpringXmlElement {
SpringImport() { this.getName() = "import" }
/** Gets the value of the `resource` attribute. */

View File

@@ -2,6 +2,6 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** A `<key>` element in Spring XML files. */
class SpringKey extends SpringXMLElement {
class SpringKey extends SpringXmlElement {
SpringKey() { this.getName() = "key" }
}

View File

@@ -3,7 +3,7 @@ import semmle.code.java.frameworks.spring.SpringXMLElement
import semmle.code.java.frameworks.spring.SpringBean
/** A `<lookup-method>` element in a Spring XML file. */
class SpringLookupMethod extends SpringXMLElement {
class SpringLookupMethod extends SpringXmlElement {
SpringLookupMethod() { this.getName() = "lookup-method" }
/** Gets the value of the `bean` attribute. */

View File

@@ -4,7 +4,7 @@ import semmle.code.java.frameworks.spring.SpringXMLElement
/**
* A common superclass for mergeable Spring XML elements (`list`, `map`).
*/
/*abstract*/ class SpringMergable extends SpringXMLElement {
/*abstract*/ class SpringMergable extends SpringXmlElement {
string getMergeRaw() { result = this.getAttributeValueWithDefault("merge") }
/** Holds if this element is merged, taking `default-merged` values in `<beans>` into account. */

View File

@@ -2,7 +2,7 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** A `<meta>` element in Spring XML files. */
class SpringMeta extends SpringXMLElement {
class SpringMeta extends SpringXmlElement {
SpringMeta() { this.getName() = "meta" }
/** Gets the value of the `key` attribute. */

View File

@@ -2,6 +2,6 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** A `<null>` element in Spring XML files. */
class SpringNull extends SpringXMLElement {
class SpringNull extends SpringXmlElement {
SpringNull() { this.getName() = "null" }
}

View File

@@ -2,7 +2,7 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** A `<prop>` element in Spring XML files. */
class SpringProp extends SpringXMLElement {
class SpringProp extends SpringXmlElement {
SpringProp() { this.getName() = "prop" }
/** Gets the value of the `key` attribute. */

View File

@@ -6,7 +6,7 @@ import semmle.code.java.frameworks.spring.SpringList
import semmle.code.java.frameworks.spring.SpringValue
/** A `<property>` element in Spring XML files. */
class SpringProperty extends SpringXMLElement {
class SpringProperty extends SpringXmlElement {
SpringProperty() { this.getName() = "property" }
override string toString() { result = this.getPropertyName() }
@@ -55,7 +55,7 @@ class SpringProperty extends SpringXMLElement {
* Holds if this property is similar to another property.
* Currently only checks the property name and references to beans.
*/
override predicate isSimilar(SpringXMLElement element) {
override predicate isSimilar(SpringXmlElement element) {
exists(SpringProperty other |
other = element and this.getPropertyName() = other.getPropertyName()
|

View File

@@ -2,7 +2,7 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** A `<qualifier>` element in a Spring XML file. */
class SpringQualifier extends SpringXMLElement {
class SpringQualifier extends SpringXmlElement {
SpringQualifier() { this.getName() = "qualifier" }
/** Gets the name of the Java class of this qualifier. */

View File

@@ -3,7 +3,7 @@ import semmle.code.java.frameworks.spring.SpringXMLElement
import semmle.code.java.frameworks.spring.SpringBean
/** A `<replaced-method>` element in a Spring XML file. */
class SpringReplacedMethod extends SpringXMLElement {
class SpringReplacedMethod extends SpringXmlElement {
SpringReplacedMethod() { this.getName() = "replaced-method" }
/** Gets the value of the `name` attribute. */

View File

@@ -2,7 +2,7 @@ import java
import semmle.code.java.frameworks.spring.SpringXMLElement
/** A `<value>` element in a Spring XML file. */
class SpringValue extends SpringXMLElement {
class SpringValue extends SpringXmlElement {
SpringValue() { this.getName() = "value" }
/** Gets the value of the `type` attribute. */

View File

@@ -3,11 +3,11 @@ import semmle.code.java.frameworks.spring.SpringBeanFile
import semmle.code.java.frameworks.spring.SpringBean
/** A common superclass for all Spring XML elements. */
class SpringXMLElement extends XMLElement {
SpringXMLElement() { this.getFile() instanceof SpringBeanFile }
class SpringXmlElement extends XMLElement {
SpringXmlElement() { this.getFile() instanceof SpringBeanFile }
/** Gets a child of this Spring XML element. */
SpringXMLElement getASpringChild() { result = this.getAChild() }
SpringXmlElement getASpringChild() { result = this.getAChild() }
/** Gets the bean file of this XML element. */
SpringBeanFile getSpringBeanFile() { result = this.getFile() }
@@ -27,13 +27,16 @@ class SpringXMLElement extends XMLElement {
SpringBean getEnclosingBean() {
if this instanceof SpringBean
then result = this
else result = this.getParent().(SpringXMLElement).getEnclosingBean()
else result = this.getParent().(SpringXmlElement).getEnclosingBean()
}
/**
* Overridden by subclasses. Used to match `value`, `property` and `ref` elements for similarity.
*/
predicate isSimilar(SpringXMLElement other) { none() }
predicate isSimilar(SpringXmlElement other) { none() }
string getContentString() { result = this.allCharactersString() }
}
/** DEPRECATED: Alias for SpringXmlElement */
deprecated class SpringXMLElement = SpringXmlElement;

View File

@@ -2,7 +2,7 @@ import semmle.code.java.frameworks.spring.SpringBean
import semmle.code.java.frameworks.spring.SpringBeanFile
import semmle.code.java.frameworks.spring.SpringEntry
predicate springDepends(SpringBean b1, SpringBean b2, SpringXMLElement cause) {
predicate springDepends(SpringBean b1, SpringBean b2, SpringXmlElement cause) {
b1 != b2 and
b1.getBeanParent() = b2 and
cause = b1
@@ -63,7 +63,7 @@ class MetricSpringBean extends SpringBean {
this.getSpringBeanFile() = result.getSpringBeanFile()
}
SpringXMLElement getBeanDependencyCause(SpringBean dependency) {
SpringXmlElement getBeanDependencyCause(SpringBean dependency) {
springDepends(this, dependency, result)
}
}