Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 210244

Summary: Cannot compile core.netigso or netbinox tests using JDK 7
Product: platform Reporter: Jesse Glick <jglick>
Component: NetigsoAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3 Keywords: TEST
Version: 7.2   
Target Milestone: 7.2   
Hardware: All   
OS: All   
Whiteboard:
Issue Type: DEFECT Exception Report:
Bug Depends on: 208666    
Bug Blocks: 207199    

Description Jesse Glick 2012-03-28 09:02:26 UTC
nbbuild/netbeans/platform/modules/ext/osgi.core-4.3.jar(org/osgi/framework/Bundle.class): warning: [classfile] Signature attribute introduced in version 49.0 class files is ignored in version 48.0 class files
core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java:462: error: name clash: <S>registerService(Class<S>,S,Dictionary<String,?>) in MockFramework and registerService(Class,Object,Dictionary) in BundleContext have the same erasure, yet neither overrides the other
        public <S> ServiceRegistration<S> registerService(Class<S> type, S s, Dictionary<String, ?> dctnr) {
                                          ^
  where S is a type-variable:
    S extends Object declared in method <S>registerService(Class<S>,S,Dictionary<String,?>)

And so on. Except for the period between the fix of bug #208464 and the fix of bug #209239, javac from Ant's JDK is used for compilation, even if nbjdk.home is JDK 6, so this means that you cannot develop Netigso/Netbinox tests from the IDE running on JDK 7 except by running Ant from the CLI.

I tried to fix the problems by using raw types. That solved most of the errors, but there was a problem with Comparable vs. Comparable<Bundle> - I could make the sources compile either in JDK 6 or in JDK 7 but not both. Not sure if there is some trick that addresses this. (It is the JDK 6 javac which is buggy.)

Is there a version of the OSGi framework JAR available that does not contain malformed class files?
Comment 1 Jaroslav Tulach 2012-03-28 11:23:21 UTC
I thought I have already fixed that! Probably the code is laying in some lost local repository. We need to remove the generics from the code.
Comment 2 Jaroslav Tulach 2012-03-28 12:50:36 UTC
The other bug was about Netbinox: bug 208666.
Comment 3 Jesse Glick 2012-03-28 20:09:27 UTC
#208666 seems to have been about main sources, whereas this is about test sources.
Comment 4 Jaroslav Tulach 2012-04-01 09:30:50 UTC
ergonomics#826348ecffb6
Comment 5 Quality Engineering 2012-04-04 10:11:22 UTC
Integrated into 'main-golden', will be available in build *201204040400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/826348ecffb6
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #210244: Using raw types, as the generic types in OSGi are not properly defined according to most recent JavaC implementations
Comment 6 Jesse Glick 2012-05-10 01:00:07 UTC
Not working for me using 7u4 to compile (6u32 bootcp):

core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java:200: error: MockFramework is not abstract and does not override abstract method compareTo(Object) in Comparable
    public static final class MockFramework 
core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java:457: error: method does not override or implement a method from a supertype
        @Override
core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java:484: error: MockBundle is not abstract and does not override abstract method compareTo(Object) in Comparable
    private static final class MockBundle implements Bundle, BundleContent, Comparable<Bundle> {
core.netigso/test/unit/src/org/netbeans/core/netigso/NetigsoSelfQueryTest.java:661: error: method does not override or implement a method from a supertype
        @Override
Comment 7 Jaroslav Tulach 2012-05-18 14:43:19 UTC
On my work laptop, I can compile even with JDK1.7.0_04. On my other home laptop, I don't seem to be able to do so. Strange. Probably safer to replace with Proxy...
Comment 8 Jesse Glick 2012-05-18 15:03:42 UTC
Remember that the value of nbjdk.home is irrelevant, it is what version of the JDK you run Ant with that counts here. (Unless Ant's JDK is _older_ than nbjdk.home, in which case compilation gets forked.)

Using Proxy seems like a good plan, since I think these are all interfaces.
Comment 9 Jaroslav Tulach 2012-05-19 22:06:38 UTC
ergonomics#dc7bb5e79da1 - now core.netigso and netbinox tests compile on my computer.
Comment 10 Quality Engineering 2012-05-23 08:53:12 UTC
Integrated into 'main-golden', will be available in build *201205230300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/dc7bb5e79da1
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #210244: To eliminate never ending problems with different javac behavior on different JDKs, let us use Proxy for all mock implementations of OSGi interfaces
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo