Type <METHOD_NAME> is erroneous

I get a weird compilation error in Netbeans.

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

    Experiment experiment=new Experiment();

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

The compiler complains that

The startup type (Maplayout, int, int, int, int, long, int) is erroneous.

My method signature looks fine:

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

I double-checked the parameters that I enter, and they all seem normal. If I pass:

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

I get the same run method compilation error.

Am I missing something? Too much javascript has damaged my brain?

+4
source share
6 answers

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

:
/ , .
, ( ).
" " , .
( )


, !

+6

NetBeans 8.0. , :

ClassA:

public interface ClassA {
}

ClassB:

import ClassA;

public class ClassB implements ClassA {
}

ClassC:

import ClassB;

public class ClassC extends ClassB {
}

ClassD:

import ClassC;
import ClassA;

public class ClassD {
  public ClassA getClassA() {
    return new ClassC(); // error here
  }
}

:

path\to\ClassC.java:7: error: The type of new ClassC() is erroneous
        return new ClassC();
               ^

ClassC ClassA, , . , ClassC ClassA, ClassB:

new ClassC:

import ClassA;
import ClassB;

public class ClassC extends ClassB implements ClassA {
}
+4

(Netbeans 8.0.2)

+1

. , Netbeans.

+1

Experiment.

, - .

0

I ran into this problem in Netbeans 7.4. Tried to reopen the IDE, clean and rebuild, but does not solve. In my case, there was a sentence in the erroneuos class implements. I deleted this sentence, declare it again, and so the error disappeared.

0
source

Source: https://habr.com/ru/post/1529757/


All Articles