Skip to content

Commit

Permalink
Merge pull request #2022 from umple/java19Prep
Browse files Browse the repository at this point in the history
Adding deprecation suppression to tracing examples issue #2018
  • Loading branch information
TimLethbridge committed Feb 7, 2023
2 parents 86e26c6 + e6e8db4 commit 203714d
Show file tree
Hide file tree
Showing 27 changed files with 34 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cruise.umple/src/generators/Generator_CodeJava.ump
Expand Up @@ -3379,6 +3379,8 @@ the if(parent.getHasProxyPattern()) is neccessary to check if the parent's real
TraceLookupMap.put("templatelttng","LTTngUst.{0}( {1} );");
TraceLookupMap.put("timestamp","System.currentTimeMillis()");
TraceLookupMap.put("identifier","System.identityHashCode({0})");
// The following is deprecated as of Java 19; as of Java 19 threadId should be used
// But we need to wait at least 3 years after intro of Java 19 ... see issue #2018
TraceLookupMap.put("thread","Thread.currentThread().getId()");
TraceLookupMap.put("self","this");
TraceLookupMap.put("increment","{0}++;");
Expand Down
5 changes: 5 additions & 0 deletions umpleonline/umplibrary/manualexamples/Tracers1.ump
@@ -1,11 +1,16 @@
// this example generates traces using the
// File tracer

tracer File;

@SuppressWarnings("deprecation")
class Student
{
Integer id;
trace id;
}

// The suppressWarnings annotation allows this example
// to keep working as of Java 19 as per Umple issue £2018
//$?[End_of_model]$?
// @@@skipphpcompile - Skipped due to issue 698
1 change: 1 addition & 0 deletions umpleonline/umplibrary/manualexamples/Tracers2.ump
Expand Up @@ -2,6 +2,7 @@
// native logging API
tracer JavaAPI;

@SuppressWarnings("deprecation")
class Student
{
Integer id;
Expand Down
Expand Up @@ -5,6 +5,7 @@ class Student {
Integer id;
}

@SuppressWarnings("deprecation")
class Professor {
1 -- * Student supervisor;

Expand Down
Expand Up @@ -5,6 +5,7 @@ class Student {
Integer id;
}

@SuppressWarnings("deprecation")
class Professor {
1 -- * Student supervisor;

Expand Down
Expand Up @@ -5,6 +5,7 @@ class Student {
Integer id;
}

@SuppressWarnings("deprecation")
class Professor {
1 -- * Student supervisor;

Expand Down
@@ -1,4 +1,5 @@
// This traces setId() and setName()
@SuppressWarnings("deprecation")
class Student
{
Integer id;
Expand Down
@@ -1,4 +1,5 @@
// This traces getId() method
@SuppressWarnings("deprecation")
class Student
{
Integer id;
Expand Down
@@ -1,4 +1,5 @@
// This example traces getId() and setId()
@SuppressWarnings("deprecation")
class Student
{
Integer id;
Expand Down
Expand Up @@ -2,6 +2,7 @@
// this example injects trace code in attribute
// setter with specified postcondition

@SuppressWarnings("deprecation")
class Student
{
name;
Expand Down
Expand Up @@ -2,6 +2,7 @@
// this example traces attribute name whenever
// its value is changed for 5 times

@SuppressWarnings("deprecation")
class Student
{
name;
Expand Down
Expand Up @@ -2,6 +2,7 @@
// this example traces attribute name whenever
// its value is accessed for 5 times

@SuppressWarnings("deprecation")
class Student
{
name;
Expand Down
@@ -1,3 +1,4 @@
@SuppressWarnings("deprecation")
class Student
{
name;
Expand Down
Expand Up @@ -2,6 +2,7 @@
// attribute name until condition becomes true
// and then always continue tracing

@SuppressWarnings("deprecation")
class Student
{
name;
Expand Down
2 changes: 1 addition & 1 deletion umpleonline/umplibrary/manualexamples/TracingBasics1.ump
@@ -1,4 +1,4 @@

@SuppressWarnings("deprecation")
class Student
{
Integer id;
Expand Down
2 changes: 1 addition & 1 deletion umpleonline/umplibrary/manualexamples/TracingBasics2.ump
@@ -1,4 +1,4 @@

@SuppressWarnings("deprecation")
class Student
{
lazy Integer id;
Expand Down
2 changes: 2 additions & 0 deletions umpleonline/umplibrary/manualexamples/TracingConstraints1.ump
@@ -1,3 +1,4 @@
@SuppressWarnings("deprecation")
class Student
{
name;
Expand All @@ -16,6 +17,7 @@ class Student
trace name for 5;
}

@SuppressWarnings("deprecation")
class Professor {
name;
1 -- * Student supervisor;
Expand Down
@@ -1,3 +1,4 @@
@SuppressWarnings("deprecation")
class Student
{
name;
Expand Down
@@ -1,3 +1,4 @@
@SuppressWarnings("deprecation")
class Student
{
name;
Expand Down
1 change: 1 addition & 0 deletions umpleonline/umplibrary/manualexamples/TracingMethods1.ump
@@ -1,6 +1,7 @@
// this example shows how to trace
// non-generated method entry

@SuppressWarnings("deprecation")
class JavaMethod
{
trace method();
Expand Down
1 change: 1 addition & 0 deletions umpleonline/umplibrary/manualexamples/TracingMethods2.ump
Expand Up @@ -3,6 +3,7 @@
// statement, trace code is injected before
// the return

@SuppressWarnings("deprecation")
class JavaMethod
{
trace exit method();
Expand Down
@@ -1,3 +1,4 @@
@SuppressWarnings("deprecation")
class LightBulb
{
Integer v = 0;
Expand Down
@@ -1,3 +1,4 @@
@SuppressWarnings("deprecation")
class LightBulb
{
status
Expand Down
@@ -1,6 +1,7 @@
// this example will trace all states of
// State machine GarageDoor

@SuppressWarnings("deprecation")
class GarageDoor
{
// UML state machine digram for a Garage door,
Expand Down
@@ -1,6 +1,7 @@
//The warning is resolved
//by correcting the name of the
//attribute to be traced
@SuppressWarnings("deprecation")
class A {
Integer identifier;

Expand Down
@@ -1,7 +1,9 @@

//The tracer used is not recognized,
//the Console tracer will be used
tracer OtherTracer;

@SuppressWarnings("deprecation")
class A {
Integer id;

Expand Down
Expand Up @@ -2,6 +2,7 @@
//the warning
tracer File;

@SuppressWarnings("deprecation")
class A {
Integer id;

Expand Down

0 comments on commit 203714d

Please sign in to comment.