I've noticed eclipse JDT uses void
as a primitive type. Can this be considered correct?
I find that, in cases like this, you can't beat going to the Java Language Specification. It is pretty clear about the fact that void
is not a primitive.
First off, void
is not in the list of primitive types. Later on, the JLS explicitly states:
the Java programming language does not allow a "cast to void" — void is not a type http://java.sun.com/docs/books/jls/third_edition/html/statements.html#5989 (emphasis mine)
Furthermore, void
appears in the list of keywords, not the list of literals.
The reason that you saw what you did was explained nicely by Michael Borgwardt.
So, to answer your title: no. In Java, void
cannot be considered a primitive. To answer your body: yes, the Eclipse JDT code is correct for what it needs to do.