The Type of <class> is erroneous error in netbeans
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!
Make sure that you have entered correct package names in your classes.
I would have preferred to leave this as a comment but as I do not have the reputation I couldn't. I realise this is also a very late response but don't know if you have found the answer or not. I came across this while googling for an answer myself.
I also believe that this error is unrelated to the code but is rather an error created by NetBeans. I found the same code compiled and ran fine in NetBeans on one machine but not the on the other where I had first encountered the error.
The solution for me was to close NetBeans, clear the NetBeans cache and restart NetBeans. I was using version 8.0 and the location of the cache for me is:
~/.cache/netbeans/8.0/
I deleted everything in the folder and on the next run everything was fine.
For older versions I believe the cache may be in a different location which can be found by opening the about window from the help menu.