Error in referencing function using package

26 views Asked by At

NetBeans 8.2 Patch 2 (Build 201705191307)

My package hierarchy is:

spider;
spider.ui;
spider.ui.output;

My classes w/functions are:

spider.ui.DisplayManager.stateMachine
spider.ui.output.DisplayManager.stateMachine

The duplication of class names and function names is deliberate. All stateMachine functions are static, that is,

public static stateMachine() { }

I attempt to reference the spider.ui.output.DisplayManager.stateMachine in the spider.ui.DisplayManager.stateMachine using:

import spider.ui.output.DisplayManager;
stateMachine() {
   spider.ui.output.DisplayManager.stateMachine()
}

and get a "ui" variable not found.

Cannot find symbol

symbol: variable ui

location: variable spider of type JFrame

I would have expected that if there was an error it would be in using duplicate names not in identifying the "ui" in spider.ui.output.DisplayManager.stateMachine() as being wrong.

It is not a great labor to change the names so that they are unique, but can anyone tell me why I get the error message I do?

1

There are 1 answers

0
lostbits On

I apologize and thank you all. This was most definitely an Operator ERROR, that is, it was created by me.

What was pointed out to me was that:

Spider spider; //variable and
   o o o 
spider.ui.*;   // collide

Once "Spider spider;" was removed, the error was cleared.

What mystified me was that the error message said that 'ui' in "spider.ui." was at fault because "ui" was a variable which could not be found. If I had given it an even moment of thought I would have guessed that the compiler was treating "spider" as an variable name and not a package name. But mystified or not, the error went pfft once "Spider spider;" was removed.

Thanks again and I am sorry to have wasted your time.

The good news is that I earned some StackOverflow brouwnie points for giving a faulty analysis about an error. So I am just wonderful.

art