@@ -517,7 +517,12 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
517517 /** Holds if this is a top-level type, which is not nested inside any other types. */
518518 predicate isTopLevel ( ) { this instanceof TopLevelType }
519519
520- /** Holds if this type is declared in a specified package with the specified name. */
520+ /**
521+ * Holds if this type is declared in a specified package with the specified name.
522+ *
523+ * For nested types the name of the nested type is prefixed with a `$` and appended
524+ * to the name of the enclosing type, which might be a nested type as well.
525+ */
521526 predicate hasQualifiedName ( string package , string type ) {
522527 this .getPackage ( ) .hasName ( package ) and type = this .nestedName ( )
523528 }
@@ -532,15 +537,26 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
532537 }
533538
534539 /**
535- * Gets the qualified name of this type.
540+ * Gets the qualified name of this type, consisting of the package name followed by
541+ * a `.` and the name of this type.
542+ *
543+ * For nested types the name of the nested type is prefixed with a `$` and appended
544+ * to the name of the enclosing type, which might be a nested type as well. For example:
545+ * `java.lang.Thread$State`.
536546 */
537547 string getQualifiedName ( ) {
538548 exists ( string pkgName | pkgName = getPackage ( ) .getName ( ) |
539549 if pkgName = "" then result = nestedName ( ) else result = pkgName + "." + nestedName ( )
540550 )
541551 }
542552
543- /** Gets the nested name of this type. */
553+ /**
554+ * Gets the nested name of this type.
555+ *
556+ * If this type is not a nested type, the result is the same as `getName()`.
557+ * Otherwise the name of the nested type is prefixed with a `$` and appended to
558+ * the name of the enclosing type, which might be a nested type as well.
559+ */
544560 string nestedName ( ) {
545561 not this instanceof NestedType and result = this .getName ( )
546562 or
@@ -788,6 +804,21 @@ class NestedType extends RefType {
788804 }
789805}
790806
807+ /**
808+ * A nested type which is a direct member of the enclosing type,
809+ * that is, neither an anonymous nor local class.
810+ */
811+ class MemberType extends NestedType , Member {
812+ /**
813+ * Gets the qualified name of this member type.
814+ *
815+ * The qualified name consists of the package name, a `.`, the name of the declaring
816+ * type (which might be a nested or member type as well), followed by a `$` and the
817+ * name of this member type. For example: `java.lang.Thread$State`.
818+ */
819+ override string getQualifiedName ( ) { result = NestedType .super .getQualifiedName ( ) }
820+ }
821+
791822/**
792823 * A class declared within another type.
793824 *
@@ -797,8 +828,9 @@ class NestedType extends RefType {
797828class NestedClass extends NestedType , Class { }
798829
799830/**
800- * An inner class is a nested class that is neither
801- * explicitly nor implicitly declared static.
831+ * An inner class is a nested class that is neither explicitly nor
832+ * implicitly declared static. This includes anonymous and local
833+ * classes.
802834 */
803835class InnerClass extends NestedClass {
804836 InnerClass ( ) { not this .isStatic ( ) }
0 commit comments