This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I'm using Netbeans 6.0M9 and I'm getting the following error annotation when I use some class with generics (e.g: java.util.Map<String,Object>): "type java.util.Map does not take parameters". I don't get any auto-fix for the error. I have two JDKs installed: 1.5 and 1.4 but I have 1.5 set as default and I also open Netbeans with 1.5. The type of project I'm using is Maven (with Mevenide plugin) and pom.xml states that the project is 1.5 compliant (both for source and target). I can send more information if you need it. Regards, Ivan Zaera
It looks like if the source.level was not set to 1.5 for your project. I have no experience with maven projects at all, but Milos could probably help us out here. Milosi, any ideas?
maven's default source level (as defined by the maven-compiler-plugin) is 1.3. You need to reconfigure your pom to have source+target levels at 1.5. http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html the maven support in M9 (coming from the default update center - version 3.0.3) shall have a project customizer page named Sources that allows to set it from the UI. Unfortunately maven support doesn't currently understand what platforms you have defined in the IDE. MAven itself doesn't have a simple way of making sure all plugins use a certain jdk. That's a feature that will be probably added in the next version of maven (2.1)
Thanks, Milosi. Are those maven settings (-source, -target) somehow forwarded to the IDE's java infrastructure? IMO the default used by the IDE is source.level=1.4, which would of course generate error annotations in the editor for 1.5 code. I assume the project is built through maven, which has the right 1.5 settings from pom.xml and that's why it builds without problems.
Yup. Maven projects implement the SourceLevelQueryImplementation interface and that is populated from the pom.xml file. So this could be an error in maven integration. Izaera: can you please attach a sample pom.xml with the target/source level configuration that doesn't work? thanks.
Created attachment 43865 [details] Sample POM file with 1.5 source and target levels
the pom file seems to be very close to what I have for mevenide (http://fisheye.codehaus.org/browse/mevenide/branches/NB60COMPATIBLE/netbeans/pom.xml?r=4436)
I have removed my $HOME/.netbeans directory and started Netbeans again (creating a new configuration) and it works correctly. It seems that some cached information was wrong. If I put again my previous $HOME/.netbeans in place it fails again. ¿What else can I send you to diagnose the problem? Maybe I can look in some directory or file inside my $HOME/.netbeans directory.
maybe the var/log/messages.log file? but the information is not cached (at least in maven support itself) and is always dynamically retrieved.. maybe the .netbeans userdir contains some binaries of old version of mevenide?
I have maven plugin version 3.0.3 and Netbeans says there are no available updates. I also have a file under $HOME/.netbeans/var/cache with the same name as one of the Java files which are failing but with extension .err (instead of .java). This file contains the error string "type java.util.Map does not take parameters". I have removed directory $HOME/.netbeans/var/cache, started Netbeans again and the project is working right again. We can close this issue and, if it happens again, I'll reopen it and we can try to gather more information. Or, if you prefer, we can continue diagnosing the error. Just tell me what to do and I can send you more info.
Ok. closing as worksforme. If the 'cached' source level appears again, please reopen the issue.
It happened again. I'm not sure but I think it has something to do with changes in pom.xml files and restarting Netbeans. I cannot fully reproduce the error, but I think it started to happen again when I reopened Netbeans after changing some dependency in one of my projects (from Velocity 1.4 to Velocity 1.5). After that I removed /var/cache and errors disappeared. But then, I removed my maven repository ($HOME/.m2/repository) yesterday and it is failing today again. Could it be some problem in Maven's plug-in when it reloads the classpath?
if you remove the local repository, then the classpath artifacts are missing. But that's a different cause of error annotations in editor. I can't imagine how the missing artifacts could have influence on the source level of the project itself. That's taken directly from the pom.xml and is a simple token like "1.5".
Well. That was only a guess. The problem is I don't know how to reproduce the error because it doesn't fail instantly. The only relevant actions I made (from my point of view) before seeing the annotations appear again were changing a dependency in a pom and removing my whole maven repository. But I cannot assure that this caused the error. By the way, I have restored my Maven repository to avoid getting error annotations because of missing dependencies and the "Java 5 generics" error annotations are still here. Maybe I can send you my /var/cache directory if it helps. Or we can wait until I see how I can reproduce the error. But I think it is a true error because it has happened twice again since we closed this issue. Removing /var/cache helps for a while, but the annotations reappear after some time. What do you suggest?
reassigning to java functionality devs for evaluation.
Seems like issue #101020 - can be workarounded by deleting the caches (${userdir}/var/cache/index/0.3). Is fixed for M10 (please note that once the caches are broken, they will not correct themselves - you will need to clear them to get correct behavior in M10). Thanks and sorry. *** This issue has been marked as a duplicate of 101020 ***
Reorganization of java component