Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
#32 extended documentation, upgraded ASM to 9.1 and fixed concept `ja…
Browse files Browse the repository at this point in the history
…va:MemberInheritedFrom`
  • Loading branch information
DirkMahler committed Jun 6, 2021
1 parent bb4eeca commit d99ec13
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 27 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<properties>
<jqa-xml-plugin.version>1.10.0-SNAPSHOT</jqa-xml-plugin.version>
<jqa-plugin-common.version>1.10.0-SNAPSHOT</jqa-plugin-common.version>
<org.ow2.asm.version>8.0</org.ow2.asm.version>
<org.ow2.asm.version>9.1</org.ow2.asm.version>
<asciidoctor.toplevelid>java-plugin</asciidoctor.toplevelid>
</properties>

Expand Down Expand Up @@ -173,4 +173,4 @@
</repository>
</repositories>

</project>
</project>
65 changes: 42 additions & 23 deletions src/main/asciidoc/scanner.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,18 @@ A Java type. Can be qualified by either `:Class`, `:Interface`, `:Enum` or `:Ann
.Relations of `:Java:Type`
[options="header"]
|====
| Name | Target label(s) | Cardinality | Description
| DECLARES | <<:Java:Type>> | 0..n | Declares an inner type of the type
| DECLARES | <<:Java:Method>> | 0..n | Declares a method of the type
| DECLARES | <<:Java:Field>> | 0..n | Declares a field of the type
| EXTENDS | <<:Java:Type>> | 0..1 | References a type this type extends from
| EXTENDS_GENERIC | <<:Java:Bound>> | 0..1 | References a generic type this type extends from
| IMPLEMENTS | <<:Java:Type>> | 0..1 | References an interface type this type implements
| IMPLEMENTS_GENERIC | <<:Java:Bound>> | 0..1 | References a generic interface type this type implements
| ANNOTATED_BY | <<:Java:Value:Annotation>> | 0..n | References an annotation which is present on the type
| DEPENDS_ON | <<:Java:Type>> | 0..n | References a type which this type depends on (i.e. every reference to another class)
| Name | Target label(s) | Cardinality | Description
| DECLARES_TYPE_PARAMETER | <<:Java:Bound:TypeVariable>> | 0..n | Declares a type variable
| REQUIRES_TYPE_PARAMETER | <<:Java:Bound:TypeVariable>> | 0..n | References a required type variable (in case of an inner class referencin a type parameter declared by an outer class)
| DECLARES | <<:Java:Type>> | 0..n | Declares an inner type of the type
| DECLARES | <<:Java:Method>> | 0..n | Declares a method of the type
| DECLARES | <<:Java:Field>> | 0..n | Declares a field of the type
| EXTENDS | <<:Java:Type>> | 0..1 | References a type this type extends from
| EXTENDS_GENERIC | <<:Java:Bound>> | 0..1 | References a generic type this type extends from
| IMPLEMENTS | <<:Java:Type>> | 0..1 | References an interface type this type implements
| IMPLEMENTS_GENERIC | <<:Java:Bound>> | 0..1 | References a generic interface type this type implements
| ANNOTATED_BY | <<:Java:Value:Annotation>> | 0..n | References an annotation which is present on the type
| DEPENDS_ON | <<:Java:Type>> | 0..n | References a type which this type depends on (i.e. every reference to another class)
|====

*NOTE* Types which are referenced by scanned classes but have not been scanned themselves
Expand All @@ -121,6 +123,13 @@ will only provide the property `fqn` and the relation `DECLARES`.
using `IMPLEMENTS` relations, i.e. queries must use
`(a:Type:Interface)-[:IMPLEMENTS]->(b:Type:Interface)` for pattern matching.

.Properties of `:DECLARES_TYPE_PARAMETER`
[options="header"]
|====
| Name | Description
| index | The index of the declared type parameter, starting with 0
|====

.Properties of `:DEPENDS_ON`
[options="header"]
|====
Expand Down Expand Up @@ -203,22 +212,30 @@ A method declared in a Java type.
.Relations of `:Java:Method`
[options="header"]
|====
| Name | Target label(s) | Cardinality | Description
| HAS | <<:Java:Parameter>> | 0..n | References a parameter of the method
| THROWS | <<:Java:Type>> | 0..n | References the exception types thrown by the method
| THROWS_GENERIC | <<:Java:Bound>> | 0..n | References the generic exception types thrown by the method
| RETURNS | <<:Java:Type>> | 0..n | References the return type of the method
| RETURNS_GENERIC | <<:Java:Bound>> | 0..n | References the generic return type of the method
| ANNOTATED_BY | <<:Java:Value:Annotation>> | 0..n | References an annotation which is present on the method declaration
| READS | <<:Java:Field>> | 0..n | References a field which is read by the method
| WRITES | <<:Java:Field>> | 0..n | References a field which is written by the method
| INVOKES | <<:Java:Method>> | 0..n | References a method which is invoked by the method
| DECLARES | <<:Java:Variable>> | 0..n | References a variable method which is declared by the method
| Name | Target label(s) | Cardinality | Description
| DECLARES_TYPE_PARAMETER | <<:Java:Bound:TypeVariable>> | 0..n | Declares a type variable
| HAS | <<:Java:Parameter>> | 0..n | References a parameter of the method
| THROWS | <<:Java:Type>> | 0..n | References the exception types thrown by the method
| THROWS_GENERIC | <<:Java:Bound>> | 0..n | References the generic exception types thrown by the method
| RETURNS | <<:Java:Type>> | 0..n | References the return type of the method
| RETURNS_GENERIC | <<:Java:Bound>> | 0..n | References the generic return type of the method
| ANNOTATED_BY | <<:Java:Value:Annotation>> | 0..n | References an annotation which is present on the method declaration
| READS | <<:Java:Field>> | 0..n | References a field which is read by the method
| WRITES | <<:Java:Field>> | 0..n | References a field which is written by the method
| INVOKES | <<:Java:Method>> | 0..n | References a method which is invoked by the method
| DECLARES | <<:Java:Variable>> | 0..n | References a variable method which is declared by the method
|====

*NOTE* Methods which are referenced by scanned classes but have not been
scanned themselves will only provide the property `signature`

.Properties of `:DECLARES_TYPE_PARAMETER`
[options="header"]
|====
| Name | Description
| index | The index of the declared type parameter, starting with 0
|====

=== Nodes labeled with `:Java:Method:Constructor`
Qualifies a method as constructor.

Expand Down Expand Up @@ -359,10 +376,12 @@ Represents a type variable, e.g.
.Relations of `:Java:Bound:TypeVariable`
[options="header"]
|====
| Name | Target label(s) | Cardinality | Description
| HAS_BOUND | <<:Java:Bound,:Java:Bound>> | 0..1 | References the bound of the type variable.
| Name | Target label(s) | Cardinality | Description
| HAS_BOUND | <<:Java:Bound,:Java:Bound>> | 0..1 | References the bound of the type variable.
|====

NOTE: `TypeVariable` nodes are declared by <<:Java:Type,:Java:Type>> or <<:Java:Method,:Java:Method>> nodes using `:DECLARES_TYPE_PARAMETER` relations. In this case the declaring nodes have an additional label `:GenericDeclaration`.

[[:Java:Bound:ParameterizedType]]
=== Nodes labeled with `:Java:Bound:ParameterizedType`
Represents a parameterized type, e.g.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
public class VisitorHelper {

public static final int ASM_OPCODES = Opcodes.ASM8;
public static final int ASM_OPCODES = Opcodes.ASM9;

/**
* The name of constructor methods.
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/jqassistant-rules/java.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
(superType:Java:Type)-[:DECLARES]->(superMember:Member),
path=shortestPath((type)-[:EXTENDS|IMPLEMENTS*]->(superType))
WHERE
not exists(member.name)
type <> superType
and not exists(member.name)
and exists(superMember.name)
and member.signature = superMember.signature
and superMember.visibility <> "private"
Expand Down

0 comments on commit d99ec13

Please sign in to comment.