The Type of is erroneous error in netbeans

前端 未结 9 1654
梦如初夏
梦如初夏 2021-01-11 11:26

I have defined two classes for a java program I am writing, call them Class1 and Class2. In the body of the constructor for Class1, I call the constructor for class 2. Howev

相关标签:
9条回答
  • 2021-01-11 12:09

    Make sure that you have entered correct package names in your classes.

    0 讨论(0)
  • 2021-01-11 12:10

    This is an addition to the answer of Grease. (I can't add a comment due to lack of reputation.)

    I sometimes run into the same issue and always deleted the complete folder, so NetBeans had to rebuild the maven-stuff which can take a few minutes.

    If someone uses maven and don't want NetBeans has to completely rebuild the maven repos and -index, don't delete the following folders in the NetBeans cache folder:

    • index
    • mavencachedirs
    • mavenindex

    Just tested it with NetBeans 11.3: Not deleting the three folders makes the error(s) go away but don't bothers maven. I could imagine that this is the same with older versions of NetBeans.

    0 讨论(0)
  • 2021-01-11 12:14

    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!

    0 讨论(0)
提交回复
热议问题