Skip to content

Commit c3320ee

Browse files
Java: Improve getAPrimaryQlClass
Implement it for more types Fix typos
1 parent 908f025 commit c3320ee

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

java/ql/src/semmle/code/java/Expr.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ class URShiftExpr extends BinaryExpr, @urshiftexpr {
764764
class AndBitwiseExpr extends BinaryExpr, @andbitexpr {
765765
override string getOp() { result = " & " }
766766

767-
override string getAPrimaryQlClass() { result = "AddBitwiseExpr" }
767+
override string getAPrimaryQlClass() { result = "AndBitwiseExpr" }
768768
}
769769

770770
/** A binary expression using the `|` operator. */
@@ -778,7 +778,7 @@ class OrBitwiseExpr extends BinaryExpr, @orbitexpr {
778778
class XorBitwiseExpr extends BinaryExpr, @xorbitexpr {
779779
override string getOp() { result = " ^ " }
780780

781-
override string getAPrimaryQlClass() { result = "?XorBitwiseExpr" }
781+
override string getAPrimaryQlClass() { result = "XorBitwiseExpr" }
782782
}
783783

784784
/** A binary expression using the `&&` operator. */
@@ -1647,7 +1647,7 @@ class ArrayTypeAccess extends Expr, @arraytypeaccess {
16471647
/** Gets a printable representation of this expression. */
16481648
override string toString() { result = "...[]" }
16491649

1650-
override string getAPrimaryQlClass() { result = "ArrayTypeAccss" }
1650+
override string getAPrimaryQlClass() { result = "ArrayTypeAccess" }
16511651
}
16521652

16531653
/**

java/ql/src/semmle/code/java/Generics.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ class Wildcard extends BoundedType, @wildcard {
250250
not hasLowerBound() and
251251
wildcards(this, "?", _)
252252
}
253+
254+
override string getAPrimaryQlClass() { result = "Wildcard" }
253255
}
254256

255257
/**

java/ql/src/semmle/code/java/Member.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ class Field extends Member, ExprParent, @field, Variable {
622622

623623
/** Cast this field to a class that provides access to metrics information. */
624624
MetricField getMetrics() { result = this }
625+
626+
override string getAPrimaryQlClass() { result = "Field" }
625627
}
626628

627629
/** An instance field. */

java/ql/src/semmle/code/java/Statement.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ class SynchronizedStmt extends Stmt, @synchronizedstmt {
523523
/** This statement's Halstead ID (used to compute Halstead metrics). */
524524
override string getHalsteadID() { result = "SynchronizedStmt" }
525525

526-
override string getAPrimaryQlClass() { result = "SynchonizedStmt" }
526+
override string getAPrimaryQlClass() { result = "SynchronizedStmt" }
527527
}
528528

529529
/** A `return` statement. */
@@ -683,7 +683,7 @@ class ContinueStmt extends Stmt, @continuestmt {
683683
/** This statement's Halstead ID (used to compute Halstead metrics). */
684684
override string getHalsteadID() { result = "ContinueStmt" }
685685

686-
override string getAPrimaryQlClass() { result = "ContinusStmt" }
686+
override string getAPrimaryQlClass() { result = "ContinueStmt" }
687687
}
688688

689689
/** The empty statement. */

java/ql/src/semmle/code/java/Type.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ class Array extends RefType, @array {
318318
* Gets the JVM descriptor for this type, as used in bytecode.
319319
*/
320320
override string getTypeDescriptor() { result = "[" + this.getComponentType().getTypeDescriptor() }
321+
322+
override string getAPrimaryQlClass() { result = "Array" }
321323
}
322324

323325
/**
@@ -877,11 +879,15 @@ class PrimitiveType extends Type, @primitive {
877879
getName().regexpMatch("(float|double|int|short|byte|long)") and
878880
result.getLiteral().regexpMatch("0(\\.0)?+[lLfFdD]?+")
879881
}
882+
883+
override string getAPrimaryQlClass() { result = "PrimitiveType" }
880884
}
881885

882886
/** The type of the `null` literal. */
883887
class NullType extends Type, @primitive {
884888
NullType() { this.hasName("<nulltype>") }
889+
890+
override string getAPrimaryQlClass() { result = "NullType" }
885891
}
886892

887893
/** The `void` type. */
@@ -892,6 +898,8 @@ class VoidType extends Type, @primitive {
892898
* Gets the JVM descriptor for this type, as used in bytecode.
893899
*/
894900
override string getTypeDescriptor() { result = "V" }
901+
902+
override string getAPrimaryQlClass() { result = "VoidType" }
895903
}
896904

897905
/**

0 commit comments

Comments
 (0)