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 128361 - Compilation against jdk 6 broken....
Summary: Compilation against jdk 6 broken....
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Jump To (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Pavel Flaska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-25 21:52 UTC by Vince Kraemer
Modified: 2008-09-02 14:13 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Demo class illustrating the problem (443 bytes, text/plain)
2008-02-27 10:28 UTC, Pavel Flaska
Details
Workarounds in java.source and jumpto (1.32 KB, text/plain)
2008-02-29 20:18 UTC, Torbjorn Norbye
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vince Kraemer 2008-02-25 21:52:06 UTC
I just did a pull from main.

I set up my build environment to use jdk6 update 3 on Solaris 10 x86.

> java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)


I entered the command:

/export/home/vbk/ant-1.7.0/bin/ant -Dpermit.jdk6.builds=true | & tee ../../nbhg-build.txt

I get the following compilation failure....

compile:
    [mkdir] Created dir: /export/home/vbk/nbhg/main/jumpto/build/classes
    [javac] Compiling 19 source files to /export/home/vbk/nbhg/main/jumpto/build/classes
   [repeat] /export/home/vbk/nbhg/main/jumpto/src/org/netbeans/spi/jumpto/type/TypeProvider.java:216: reference to
addAll is ambiguous, both method addAll(java.util.Collection<? extends E>) in java.util.Collection<capture#760 of ?
super org.netbeans.spi.jumpto.type.TypeDescriptor> and method addAll(java.util.Collection<? extends E>) in
java.util.List<capture#760 of ? super org.netbeans.spi.jumpto.type.TypeDescriptor> match
   [repeat]             result.addAll(typeDescriptor);
   [repeat]                   ^
   [repeat] 1 error
  [nbmerge] Failed to build target: all-jumpto

BUILD FAILED
/export/home/vbk/nbhg/main/nbbuild/build.xml:709: The following error occurred while executing this line:
/export/home/vbk/nbhg/main/nbbuild/build.xml:704: The following error occurred while executing this line:
/export/home/vbk/nbhg/main/nbbuild/build.xml:754: The following error occurred while executing this line:
/export/home/vbk/nbhg/main/nbbuild/templates/common.xml:110: Compile failed; see the compiler error output for details.

Total time: 2 minutes 13 seconds

Filed as Jesse requested...
Comment 1 Vince Kraemer 2008-02-25 21:56:24 UTC
If I comment out the offending line from above, I encounter another compilation failure at....

   [repeat] /export/home/vbk/nbhg/main/java.source/src/org/netbeans/api/java/source/ClassIndex.java:605: reference to
addAll is ambiguous, both method addAll(java.util.Collection<? extends E>) in java.util.Collection<capture#693 of ?
super java.net.URL> and method addAll(java.util.Collection<? extends E>) in java.util.List<capture#693 of ? super
java.net.URL> match
   [repeat]             removedRoots.addAll(roots);;
   [repeat]                         ^
Comment 2 Vince Kraemer 2008-02-25 22:11:18 UTC
after I comment out the offending line for the previous build failure... I encounter 

   [repeat]
/export/home/vbk/nbhg/main/websvc.saas.services.strikeiron/src/com/strikeiron/search/SISearchService.java:108: cannot
find symbol
   [repeat] symbol  : method
getPort(javax.xml.namespace.QName,java.lang.Class<com.strikeiron.search.SISearchServiceSoap>,javax.xml.ws.WebServiceFeature[])
   [repeat] location: class javax.xml.ws.Service
   [repeat]         return super.getPort(new QName("http://www.strikeiron.com", "SISearchServiceSoap"),
SISearchServiceSoap.class, features);
   [repeat]                     ^
Comment 3 Jesse Glick 2008-02-25 23:04:05 UTC
The second problem should probably be filed separately in websvc.
Comment 4 Lukas Jungmann 2008-02-26 00:10:26 UTC
as for error in websvc.saas.services.strikeiron - problem is that it relies on JAX-WS 2.1, but you use some JDK 6 which
contains only JAX-WS 2.0 (so you have either JDK 6, 6u1, 6u2 or 6u3)

there are following options how to bypass it:

- update your JDK 6 to the latest official one (at least update 4)

or

-put jaxws-api.jar and jaxb-api.jar from either the IDE (websvc.jaxws21api module) or from JAX-WS 2.1 from
jax-ws.dev.java.net (or you can use webservices-api.jar from $GF_HOME/lib/endorsed) to $JRE/lib/endorsed

or you can try to set java.endorsed.dirs property so it points to the location which contains jaxws-api.jar and
jaxb-api.jar (or just webservices-api.jar) - I personally didn't check this, but it should work too
Comment 5 Petr Hrebejk 2008-02-26 13:38:39 UTC
Not my code.
Comment 6 Pavel Flaska 2008-02-27 10:26:44 UTC
Not Hrebejk's code! ;-)
I think it is compiler bug, jdk5 and jdk7 compiles it.

Comment 7 Pavel Flaska 2008-02-27 10:28:40 UTC
Created attachment 57337 [details]
Demo class illustrating the problem
Comment 8 Vince Kraemer 2008-02-27 17:35:59 UTC
pflaska: its isn't a jdk bug until it is filed as a jdk bug.  has that been done?
Comment 9 Pavel Flaska 2008-02-27 17:43:33 UTC
Workaround exists - build with recommended compiler.
Comment 10 Pavel Flaska 2008-02-27 17:45:24 UTC
> its isn't a jdk bug until it is filed as a jdk bug.  has that been done?

It is a bug, it is obvious. It is fixed in jdk7.
Comment 11 Vince Kraemer 2008-02-27 19:29:32 UTC
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6356673 was the jdk 5 manifestation of this issue.

there is a bug filed against jdk 6, for the same thing: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6507334.

There is a claim that this will be fixed in jdk 6... but I haven't found the real details....
Comment 12 Torbjorn Norbye 2008-02-29 20:17:15 UTC
So does anyone mind if I apply a patch to actually make it work on JDK6? It's a bit inconvenient that it doesn't work
now; I want to use JDK6 instead of JDK5 as my default Java environment but I regularly forget to modify my environment
before building the IDE which wastes time when I have to restart the build after running into this error.

This patch works for me:

java.source:
-            result.addAll(typeDescriptor);
+            // Workaround for JDK6 - see issue 128102
+            //result.addAll(typeDescriptor);
+            ((List)result).addAll(typeDescriptor);

jumpto:
-            removedRoots.addAll(roots);;
+            // Workaround for JDK6 - see issue 128102
+            //removedRoots.addAll(roots);;
+            ((List)removedRoots).addAll(roots);;

(I don't run into the websvc.saas issue since I don't build websvc in my clusters).
Comment 13 Torbjorn Norbye 2008-02-29 20:18:18 UTC
Created attachment 57582 [details]
Workarounds in java.source and jumpto
Comment 14 Vince Kraemer 2008-02-29 21:07:11 UTC
I would say thank you.
Comment 15 Pavel Flaska 2008-03-01 08:19:41 UTC
Honza Lahoda already talked to me about such a workaround. From my point of view, everyone who wants to build it with
1.6 can do the modifications in his local copy, they are really simple and obvious, if he looks to the code. But I
understand that now with Mercurial and working on whole source copy, it is boring to prevent committing it, so from my
point of view (in jumpto), do whatever you think. -- I have no strong opinion on it.

What is interesting on this problem, that it is a regression, which is already covered by test in jdk. -- Thought there
is a test which fails in jdk6. 

Note: Honza already talked directly to compiler guys about this problem, maybe he will be able to give you update.
Comment 16 Quality Engineering 2008-08-26 05:58:42 UTC
Integrated into 'main-golden', available in build *200808260201* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/532bad2bed7a
User: Tomas Zezula <tzezula@netbeans.org>
Log: #128361:Compilation against jdk 6 broken....
Comment 17 Pavel Flaska 2008-09-02 14:13:34 UTC
Tomas integrated the cast - workaround. Not sure about other modules, but definitely jumpto is compilable in 1.6.