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

Tracing code fails as of Java19 #2018

Open
TimLethbridge opened this issue Jan 16, 2023 · 2 comments
Open

Tracing code fails as of Java19 #2018

TimLethbridge opened this issue Jan 16, 2023 · 2 comments
Labels
Diffic-VEasy Should be obvious how to fix it, likely in just a few lines, and should take less than a day Priority-Low This problem is likely to have low impact or to relate to a rarely used detail or edge case tracing Related to the tracing feature of Umple

Comments

@TimLethbridge
Copy link
Member

TimLethbridge commented Jan 16, 2023

(see comments at the end ... this issue has to wait for several years ... a partial workaround was done in Feb 2023 through PR #2022)

Tests of Umple tracing code are failing as of Java 19, due to deprecations.

We need to make changes such that tracing works from Java 11 onwards (or at least Java 17 onwards)

The examples that fail from the build are:

[java]  /Users/tcl/unix/umple/temp/java/Tracers1.ump
 [java]  /Users/tcl/unix/umple/temp/java/Tracers2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAssociations1.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAssociations2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAssociations3.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAttributes1.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAttributes2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAttributes3.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAttributeswithConditions2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAttributeswithOccurrences1.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAttributeswithOccurrences2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAttributeswithtimeline1.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingAttributeswithtimeline2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingBasics1.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingBasics2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingConstraints1.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingConstraints2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingConstraints3.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingMethods1.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingMethods2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingStateMachines1.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingStateMachines2.ump
 [java]  /Users/tcl/unix/umple/temp/java/TracingStateMachines3.ump
 [java]  /Users/tcl/unix/umple/temp/java/W301TracingEntityNotFound2.ump __UMPLEc3RyaWN0bmVzcyBpZ25vcmUgMzAxOw==
 [java]  /Users/tcl/unix/umple/temp/java/W302TracerNotRecognized1.ump __UMPLEc3RyaWN0bmVzcyBpZ25vcmUgMzAyOw==
 [java]  /Users/tcl/unix/umple/temp/java/W302TracerNotRecognized2.ump __UMPLEc3RyaWN0bmVzcyBpZ25vcmUgMzAyOw==
@TimLethbridge TimLethbridge added Priority-High This problem or enhancement is likely to be highly visible and or impactful of users Diffic-Med A non-trivial problem that may take over a week or may not be obvious how to fix or require analysis tracing Related to the tracing feature of Umple labels Jan 16, 2023
@TimLethbridge
Copy link
Member Author

TimLethbridge commented Feb 7, 2023

This page says that getId is replaced by threadId in Java 19 so the change should be not hard.

See
https://bugs.openjdk.org/browse/JDK-8017617?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

The Umple code that uses thread getID is at cruise.umple/src/generators/Generator_CodeJava.ump line 3382 where it says

TraceLookupMap.put("thread","Thread.currentThread().getId()");

The only catch is that we need to know when this change will take over as it will restrict the applicability of generated code. If we roll it out it will force users to use Java 19

Java 19 doc is here
https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/Thread.html

As of the time of this issue Umple supports Long term stable versions 11 and 17

Possiblity A for interim solution is to add @SuppressWarnings("deprecation") to the methods that use Thread.getId. THen wait until Java 21 comes out in Fall 2025 (the next long term support release) and some time after that make the API change and require use of Java 19 to 25 (with either stable version 21 or stable version 25.

The challenge with that is ensuring the correct various generated methods that use tracing have the deprecation annotation added before them ... and then changing all the tests.

Possibility B is to fix the test code so it doesn't fail when run in Java 19.

@TimLethbridge
Copy link
Member Author

This pull request is being left open until likely 2025, when the cruise.umple/src/generators/Generator_CodeJava.ump can be changed to use the new API, at which time Java19 would be the lowest version that could be used.

@TimLethbridge TimLethbridge added Priority-Low This problem is likely to have low impact or to relate to a rarely used detail or edge case Diffic-VEasy Should be obvious how to fix it, likely in just a few lines, and should take less than a day and removed Priority-High This problem or enhancement is likely to be highly visible and or impactful of users Diffic-Med A non-trivial problem that may take over a week or may not be obvious how to fix or require analysis labels Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Diffic-VEasy Should be obvious how to fix it, likely in just a few lines, and should take less than a day Priority-Low This problem is likely to have low impact or to relate to a rarely used detail or edge case tracing Related to the tracing feature of Umple
Projects
None yet
Development

No branches or pull requests

1 participant