Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type of <METHOD_NAME> is erroneous

Tags:

java

netbeans

I am getting a strange compile error in Netbeans.

I am creating an Experiment object and calling a run method on it.

    Experiment experiment=new Experiment();

    Result result = experiment.run(t, steps, trials, breadth, depth, seed, distribution);

The compiler complains that

The type of run(Maplayout, int, int , int, int, long, int) is erroneous.

My method signature looks normal :

public Result run(MapLayout t, int steps, int trials, 
                        int breadth, int depth, long seed, int distribution)

I have double checked the paramaters I am passing in and they all seem normal. If I pass in :

    experiment.run(null, 1,1,1,1,1l,1);

I get the same compile error on the run method.

Am i missing something obvious? Has too much Javascript damaged my brain?

like image 818
Oliver Watkins Avatar asked Dec 16 '22 00:12

Oliver Watkins


1 Answers

I had the same issue and the solution was very simple in my case.

The case:
I copy/paste some classes from another project in a package of the project i am working in.
Some of them had the old package declaration and the compiler didn't complained (for his reasons).
When i used a method with return type one of the 'wrong packaged' classes this error appeared.
(The Type of is erroneous)

The solution
To solve the issue, I changed the package declaration to be the correct one!

like image 124
Georgios Syngouroglou Avatar answered Dec 30 '22 19:12

Georgios Syngouroglou