!unknownSymbol! is returned while trying to find the variable symbol type

Hi ,

I am trying to write a java custom rule ,to fine whether the variable is declared from subclass.
Ex: I have created a class subCLASS by extended SuperClass.
and declared the object using subclass from custom java.project.
but i am unable to get type of a object.

@Override
public void visitVariable(VariableTree tree) {

	 Type type = tree.symbol().type();
	System.out.println(tree.symbol().name()+":::"+type.fullyQualifiedName());

Thanks,
Vijaya

Hi,

make sure you have project dependecies on classpath when runing analyze (identify the real type of the uknow symbol variable and check if its on claspath) .
If you are getting uknow symbol during test and your plugin is maven project, use maven dependecny plugin to copy required packages into a test jars.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>...</version>
    <executions>
        <execution>
            <id>copy</id>
            <phase>test-compile</phase>
            <goals>
                <goal>copy</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>...</groupId>
                        <artifactId>...</artifactId>
                        <version>..</version>
                        <type>..</type>
                    </artifactItem>
                </artifactItems>
                <outputDirectory>${project.build.directory}/test-jars</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>