From cd53ac7dab20b75a7df4de27d30ba3837a93ec7c Mon Sep 17 00:00:00 2001 From: Maxime Arthaud Date: Tue, 17 Sep 2024 10:25:15 -0700 Subject: [PATCH] Small documentation adjustment Summary: It seems slightly better to mention that `this` is `Argument(0)` in the section about access paths. This seems to be a common source of confusion for newcomers. Reviewed By: anwesht Differential Revision: D62852455 fbshipit-source-id: da60a26f68d3934636442d89ee5c77cfa6618c14 --- documentation/website/documentation/models.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/documentation/website/documentation/models.md b/documentation/website/documentation/models.md index 5d56969d..c8586720 100644 --- a/documentation/website/documentation/models.md +++ b/documentation/website/documentation/models.md @@ -73,11 +73,7 @@ For the parameters and return types use the following table to pick the correct - F - float - D - double (64 bits) -Classes take the form `Lpackage/name/ClassName;` - where the leading `L` indicates that it is a class type, `package/name/` is the package that the class is in. A nested class will take the form `Lpackage/name/ClassName$NestedClassName` (the `$` will need to be double escaped `\\$` in json regex). - -> **NOTE 1:** Instance (i.e, non-static) method parameters are indexed starting from 1! The 0th parameter is the `this` parameter in dalvik byte-code. For static method parameters, indices start from 0. - -> **NOTE 2:** In a constructor (\ method), parameters are also indexed starting from 1. The 0th parameter refers to the instance being constructed, similar to the `this` reference. +Classes take the form `Lpackage/name/ClassName;` - where the leading `L` indicates that it is a class type, `package/name/` is the package that the class is in. A nested class will take the form `Lpackage/name/ClassName$NestedClassName;` (the `$` will need to be double escaped `\\$` in json regex). ### Access path format @@ -88,7 +84,7 @@ An access path is composed of a root and a path. The root is either: - `Return`, representing the returned value; -- `Argument(x)` (where `x` is an integer), representing the parameter number `x`; +- `Argument(x)` (where `x` is an integer), representing the parameter number `x`. **Note** that `Argument(0)` represents the implicit `this` parameter for instance methods; The path is a (possibly empty) list of path elements. A path element can be any of the following kinds: @@ -106,6 +102,10 @@ Examples: - `Return` corresponds to the returned value; - `Return.x` corresponds to the field `x` of the returned value; +> **NOTE 1:** Instance (i.e, non-static) method parameters are indexed starting from 1! The 0th parameter is the `this` parameter in Dalvik byte-code. For static method parameters, indices start from 0. + +> **NOTE 2:** In a constructor (`` method), parameters are also indexed starting from 1. The 0th parameter refers to the instance being constructed, similar to the `this` reference. + ### Kinds A source has a **kind** that describes its content (e.g, user input, file system, etc). A sink also has a **kind** that describes the operation the method performs (e.g, execute a command, read a file, etc.). Kinds can be arbitrary strings (e.g, `UserInput`). We usually avoid whitespaces.