Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 571533 - tycho-compiler-plugin with useJDK=BREE and BREE==JavaSE-1.8 fails to find some EE packages #51

Closed
ind1go opened this issue Apr 11, 2021 · 12 comments
Assignees
Labels
🚨 regression Regression compared to previous release - blocks upcoming release and other merges sponsored The bugfix or feature was gently sponsored by an individual or company
Milestone

Comments

@ind1go
Copy link

ind1go commented Apr 11, 2021

Was: https://bugs.eclipse.org/bugs/show_bug.cgi?id=571533

Hi all!

I have a bundle that uses JAXB, i.e. the javax.xml.bind packages that came with Java up until their removal in Java 11.

The build itself runs Java 11 and Maven 3.6.3.

The tycho-compiler-plugin is configured to useJDK=BREE, and the plugin BREE is Java 8. I have toolchains set up for JDK 8 and JDK 11.

At Tycho 2.1.0, this build succeeds. However, upgrading to Tycho 2.2.0, the build now fails - error at the bottom. It looks like it may be attempting to find the class in JDK 11 instead of JDK 8.

There's a minimal reproduce of this bug at:

https://github.com/ind1go/tycho.bug.reproduce.1/tree/with-tycho-2.1.0 (the working case)
vs
https://github.com/ind1go/tycho.bug.reproduce.1/tree/with-tycho-2.2.0 (the failure case)

The only thing I've changed is the Tycho version (comparison at ind1go/tycho.bug.reproduce.1@with-tycho-2.1.0...with-tycho-2.2.0).

Error:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.2.0:compile (default-compile) on project tycho.bug.reproduce.1: Compilation failure: Compilation failure:
[ERROR] .../tycho.bug.reproduce.1/src/main/java/dev/bencox/tychobugreproduce1/ClassUsingJAXB.java:[3]
[ERROR] import javax.xml.bind.JAXBException;
[ERROR] ^^^^^^^^^^^^^^
[ERROR] The import javax.xml.bind cannot be resolved
[ERROR] .../tycho.bug.reproduce.1/src/main/java/dev/bencox/tychobugreproduce1/ClassUsingJAXB.java:[9]
[ERROR] new JAXBException("Constructing this exception purely so there's a usage of javax.xml.bind in this class.");
[ERROR] ^^^^^^^^^^^^^
[ERROR] JAXBException cannot be resolved to a type

Still the case trying with 2.4.0-SNAPSHOT today.

@Dufgui
Copy link
Contributor

Dufgui commented Jul 16, 2021

I think i have the same problem. Here is a reproducer
https://github.com/Dufgui/tycho-demo/tree/toolchain/itp04-rcp

ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.3.0:compile (default-compile) on project example-bundle: Compilation failure: Compilation failure:
[ERROR] C:\Users\gdufour\git\github\eclipse\tycho-demo\itp04-rcp\example-bundle\src\example\bundle\Application.java:[21]
[ERROR]         import javax.xml.bind.annotation.XmlEnum;
[ERROR]                ^^^^^^^^^^^^^^

@laeubi
Copy link
Member

laeubi commented Jul 16, 2021

@Dufgui can you create a PR that adds a new integrationtest for this case derived from the example?

@Dufgui
Copy link
Contributor

Dufgui commented Jul 16, 2021

I try but all my test are working on IT. i will check my product build if I miss some alignment because it seems working.

https://github.com/Dufgui/tycho/tree/571533_breeJava8

here is my branch
#188

@Dufgui
Copy link
Contributor

Dufgui commented Jul 16, 2021

it's work on my mac, and the same repo last week on my windows fail. Maybe i miss the path on my windows laptop.
I will check next week (when i go back to work) to check.

@cipresso
Copy link

cipresso commented Oct 28, 2021

Hi. I'm having the same issue with javax.xml.bind* classes not being resolved. For me, versions later than 2.1.0 of tycho-compiler-plugin show the problem.

            <plugin>
              <groupId>org.eclipse.tycho</groupId>
              <artifactId>target-platform-configuration</artifactId>
              <version>${tycho.version}</version>
              <configuration>
                <executionEnvironment>JavaSE-1.8</executionEnvironment>
                ...

          <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-compiler-plugin</artifactId>
            <version>${tycho.version}</version>
            <configuration>
              <compilerArgument>-warn:+discouraged,forbidden</compilerArgument>
              <source>1.8</source>
              <target>1.8</target>
              <useJDK>BREE</useJDK>
            </configuration>
          </plugin>
<toolchains>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>JavaSE-1.8</id>
      <version>1.8</version>
      <vendor>ibm</vendor>
    </provides>
    <configuration>
      <jdkHome>/home/jenkins/.../ibm-java-x86_64-80/</jdkHome>
    </configuration>
  </toolchain>
</toolchains>

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.5.0:compile (default-compile) on project com.ibm.zosconnect.ui.common: Compilation failure: Compilation failure:
[ERROR] /home/jenkins/.../com.ibm.###removed###.java:[30]
[ERROR] import javax.xml.bind.JAXBContext;
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^

@laeubi
Copy link
Member

laeubi commented Oct 28, 2021

@cipresso can you provide an simple reproducer project for thsi issue?

@laeubi laeubi self-assigned this Mar 29, 2022
@laeubi
Copy link
Member

laeubi commented Apr 1, 2022

@akurtakov I debugged this a bit and get the feeling that this is probably caused due to removed JavaSE1.8 profile, what do you think would it harm to add this back (and simply not manage it any further) for 2.7.x ?

@akurtakov
Copy link
Member

Where is the JavaSE-1.8 profile removed?

@laeubi
Copy link
Member

laeubi commented Apr 1, 2022

Where is the JavaSE-1.8 profile removed?

Good question, I though it was part of Tycho but seems be part of org.eclipse.ogi I just noticed its not in tcho-core so I assumed we have removed it.

Maybe I'm on the wrong track but if I have Jdk8 should it not resolve+compile without any additional adding for javax. stuff? Sadly the only jdk8 test we have do not use such imports thats why this regression was not discovered..

@laeubi laeubi added the 🚨 regression Regression compared to previous release - blocks upcoming release and other merges label Apr 1, 2022
@akurtakov
Copy link
Member

I personally don't have time to spend on Java 8 issues, there is enough on my plate with Java 18 which is far more important IMHO.

@laeubi laeubi added the sponsored The bugfix or feature was gently sponsored by an individual or company label Apr 6, 2022
@laeubi
Copy link
Member

laeubi commented Apr 6, 2022

This issue is a regression of Bug 561363.
To restore old behavior one needs to set <deriveReleaseCompilerArgumentFromTargetLevel>false<deriveReleaseCompilerArgumentFromTargetLevel>.

@laeubi
Copy link
Member

laeubi commented Apr 6, 2022

I summarized the important parts here: https://github.com/eclipse/tycho/wiki/Compiling-code-for-older-java-releases

@laeubi laeubi closed this as completed in 755d2dd Apr 6, 2022
laeubi added a commit that referenced this issue Apr 6, 2022
@laeubi laeubi added this to the 3.0 milestone Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 regression Regression compared to previous release - blocks upcoming release and other merges sponsored The bugfix or feature was gently sponsored by an individual or company
Projects
None yet
Development

No branches or pull requests

5 participants