mirror of
https://github.com/github/codeql.git
synced 2026-04-19 05:54:00 +02:00
Java: Deprecate RefType.nestedName(), and add RefType.getNestedName()
This commit is contained in:
@@ -255,7 +255,7 @@ class Annotatable extends Element {
|
||||
*/
|
||||
predicate hasAnnotation(string package, string name) {
|
||||
exists(AnnotationType at | at = this.getAnAnnotation().getType() |
|
||||
at.nestedName() = name and at.getPackage().getName() = package
|
||||
at.getNestedName() = name and at.getPackage().getName() = package
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -592,7 +592,7 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
|
||||
* to the name of the enclosing type, which might be a nested type as well.
|
||||
*/
|
||||
predicate hasQualifiedName(string package, string type) {
|
||||
this.getPackage().hasName(package) and type = this.nestedName()
|
||||
this.getPackage().hasName(package) and type = this.getNestedName()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,7 +601,7 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
|
||||
override string getTypeDescriptor() {
|
||||
result =
|
||||
"L" + this.getPackage().getName().replaceAll(".", "/") + "/" +
|
||||
this.getSourceDeclaration().nestedName() + ";"
|
||||
this.getSourceDeclaration().getNestedName() + ";"
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -615,8 +615,8 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
|
||||
string getQualifiedName() {
|
||||
exists(string pkgName | pkgName = this.getPackage().getName() |
|
||||
if pkgName = ""
|
||||
then result = this.nestedName()
|
||||
else result = pkgName + "." + this.nestedName()
|
||||
then result = this.getNestedName()
|
||||
else result = pkgName + "." + this.getNestedName()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -627,12 +627,15 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
|
||||
* Otherwise the name of the nested type is prefixed with a `$` and appended to
|
||||
* the name of the enclosing type, which might be a nested type as well.
|
||||
*/
|
||||
string nestedName() {
|
||||
string getNestedName() {
|
||||
not this instanceof NestedType and result = this.getName()
|
||||
or
|
||||
this.(NestedType).getEnclosingType().nestedName() + "$" + this.getName() = result
|
||||
this.(NestedType).getEnclosingType().getNestedName() + "$" + this.getName() = result
|
||||
}
|
||||
|
||||
/** DEPRECATED: Alias for `getNestedName`. */
|
||||
deprecated string nestedName() { result = this.getNestedName() }
|
||||
|
||||
/**
|
||||
* Gets the source declaration of this type.
|
||||
*
|
||||
|
||||
@@ -422,10 +422,10 @@ private predicate elementSpec(
|
||||
private string getNestedName(Type t) {
|
||||
not t instanceof RefType and result = t.toString()
|
||||
or
|
||||
not t.(Array).getElementType() instanceof NestedType and result = t.(RefType).nestedName()
|
||||
not t.(Array).getElementType() instanceof NestedType and result = t.(RefType).getNestedName()
|
||||
or
|
||||
result =
|
||||
t.(Array).getElementType().(NestedType).getEnclosingType().nestedName() + "$" + t.getName()
|
||||
t.(Array).getElementType().(NestedType).getEnclosingType().getNestedName() + "$" + t.getName()
|
||||
}
|
||||
|
||||
private string getQualifiedName(Type t) {
|
||||
|
||||
Reference in New Issue
Block a user