Bug 250440 - Build OSGi Bundle with java API level 8
Build OSGi Bundle with java API level 8
Status: RESOLVED FIXED
Product: apisupport
Classification: Unclassified
Component: Harness
8.0.2
PC Linux
: P1 (vote)
: Dev
Assigned To: pgebauer
issues@apisupport
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-02-16 09:24 UTC by heithecker
Modified: 2017-02-15 07:49 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description heithecker 2015-02-16 09:24:02 UTC
When i try to run "osgi-suite" i get the following exception:

/home/xxxxx/netbeans-8.0.1/harness/osgi.xml:63: Could not prescan /home/xxxx/NetBeansProjects/Betula/build/cluster/modules/org-xxxxx-xxxx.jar: 
java.io.IOException: Unrecognized constant pool tag 18 at index 42; running UTF-8 strings: [null ...... null]
	at org.netbeans.nbbuild.VerifyClassLinkage.dependencies(VerifyClassLinkage.java:347)
	at org.netbeans.nbbuild.MakeOSGi.scanClasses(MakeOSGi.java:707)
	at org.netbeans.nbbuild.MakeOSGi.prescan(MakeOSGi.java:211)
	at org.netbeans.nbbuild.MakeOSGi.execute(MakeOSGi.java:164)

My module org-xxxxx-xxxx.jar is set to api level 8.

I understand that the constant byte tag of value 18 is "CONSTANT_InvokeDynamic" a java 8 feature. Am I right? Should this be fixed? 

Thanks,
Boris
Comment 1 frgomes 2015-06-19 12:17:49 UTC
I can see the same issue :-(
Comment 2 frgomes 2015-06-19 12:51:50 UTC
The message tells us that something related to JavaFX does not look right.

[error] Exception in thread "main" /opt/developer/netbeans-8.0/harness/suite.xml:545: The following error occurred while executing this line:
[error] /opt/developer/netbeans-8.0/harness/osgi.xml:63: Could not prescan /opt/developer/netbeans-8.0/platform/modules/org-netbeans-libs-javafx.jar: java.io.IOException: Unrecognized constant pool tag 18 at index 18; running UTF-8 strings: blah blah blah ...

One way to circumvent the trouble is by disabling "JavaFX wrapper" (i.e: not including it!) as part of platform libraries.

Projects/Feed Runner Application
  -> Properties
    -> Libraries
      -> (platform)
        -> (JavaFX wraper)   [ ] included  (i.e: not included!)
Comment 3 heithecker 2015-06-24 19:12:49 UTC
Module JavaFXWrapper (org.netbeans.libs.javafx) is excluded in our platform app. The error keeps coming up when i try to build an OSGi bundle. As far as I've found out the issue is related to java 8 features, we can see that from "Unrecognized constant pool tag 18 at index 42" in the error message. However, I don't how to fix this. 

Boris
Comment 4 pgebauer 2016-08-31 09:58:14 UTC
Once I have excluded the JavaFX wraper module in the platform of my test application the issue disappeared. It can be used as a workaround for most affected applications.I'm downgrading the issue to P2.
Comment 5 heithecker 2016-09-02 20:02:50 UTC
Not true. It won't compile with any piece of Java 8 code. 

How to reproduce: 

1. Open the Felix OSGi Sample project.
2. Remove "platform/JavaFX Wrapper" from its platform modules. 
3. In the suite's "Show OSGi Bundle" module, set the source level to 1.8.
4. Run "osgi-suite", it won't fail now.
5. Anywhere in the sample module, add some Java 8 feature (lambda exp., method reference). For example, I added:

    private void java8Code() {
        Stream.of("a", "b").forEach(System.out::println);
    }

6. Run "osgi-suite". It fails. 

This must be fixed. It's not a minor issue. Lots of applications use Java 8 code now.
Comment 6 Tomas Hurka 2017-02-15 07:49:33 UTC
Fixed by:

changeset:   302134:cf0e59156e65
user:        Tomas Zezula <tzezula@netbeans.org>
date:        Tue Jan 10 16:12:28 2017 +0100
summary:     Java8, Java9 constant pool constants.


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