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.

Bug 106823 - Parameters of "generics" are not correctly understood
Summary: Parameters of "generics" are not correctly understood
Status: RESOLVED DUPLICATE of bug 101020
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 6.x
Hardware: Other Linux
: P3 blocker (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-15 15:11 UTC by izaera
Modified: 2007-09-26 09:14 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample POM file with 1.5 source and target levels (4.24 KB, text/xml)
2007-06-18 09:04 UTC, izaera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description izaera 2007-06-15 15:12:20 UTC
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
Comment 1 Vitezslav Stejskal 2007-06-18 01:38:16 UTC
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?
Comment 2 Milos Kleint 2007-06-18 05:02:12 UTC
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)
Comment 3 Vitezslav Stejskal 2007-06-18 05:29:18 UTC
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.
Comment 4 Milos Kleint 2007-06-18 07:24:00 UTC
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.
Comment 5 izaera 2007-06-18 09:04:41 UTC
Created attachment 43865 [details]
Sample POM file with 1.5 source and target levels
Comment 6 Milos Kleint 2007-06-18 09:19:27 UTC
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)
Comment 7 izaera 2007-06-18 09:22:23 UTC
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.
Comment 8 Milos Kleint 2007-06-18 09:26:12 UTC
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?

Comment 9 izaera 2007-06-18 09:44:22 UTC
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.

Comment 10 Milos Kleint 2007-06-18 10:59:04 UTC
Ok. closing as worksforme. If the 'cached' source level appears again, please reopen the issue.
Comment 11 izaera 2007-06-20 10:18:53 UTC
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?


Comment 12 Milos Kleint 2007-06-20 10:25:09 UTC
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". 
Comment 13 izaera 2007-06-20 10:32:58 UTC
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?
Comment 14 Milos Kleint 2007-06-20 10:42:34 UTC
reassigning to java functionality devs for evaluation.
Comment 15 Jan Lahoda 2007-06-22 14:47:11 UTC
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 ***
Comment 16 Quality Engineering 2007-09-20 11:58:46 UTC
Reorganization of java component