Create an Abstract Syntax Tree

Hello,

I am trying to create a custom rule for java, which checks if a method is invoked multiple times on an object. My problem is, that I don´t understand the structure of the Abstract Syntax Tree (AST) Sonarqube is building. I want to understand what i get when i call for example the methods symbol(), symbolType() or methodSelect() on my trees.(Compared to an AST, https://astexplorer.net/ or the ASTView in Eclipse is giving me) Or better: How do I traverse the tree, by calling these methods.
I read that i can use the sslr toolkit to show me the tree, but i do not found any tutorials which would help me to create a tree in eclipse (java).

For example how would i get the information of the package of every “get”-Method of this class. (It should be javax.persistence.criteria.Path)

package com.example.test;

import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Root;

import com.example.test.AbstractRepository;

public class TestClass extends AbstractRepository<TestDbo>
{
	public void TestMethod()
	{
		CriteriaQuery<TestDbo> query = getCriteriaBuilder().createQuery(TestDbo.class);
		Root<TestDbo> root = query.from(TestDbo.class);
		Path<Object> path = root.get("1").get("3").get("2"); // Noncompliant
	}

}

I hope i could explain my problem clear enough, if not please ask for further informations.

My version:

  <properties>
    <sonarqube.version>8.9.0.43852</sonarqube.version>
    <sonarjava.version>6.15.1.26025</sonarjava.version>
    <jacoco.version>0.8.7</jacoco.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>8</maven.compiler.release>
  </properties>

Greetings
Johannes