Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2020-12-19 13:03:18 +0000
committerStephan Herrmann2020-12-19 13:03:18 +0000
commit69f9c9efac2bdae1db5bfc7fc7be0f49a288295c (patch)
tree29b2b542fba52731e38477a92e0cef71c22abf45
parent2629b6df1a73f1b7aa63a0f5f1a922446da662db (diff)
downloadorg.eclipse.objectteams-69f9c9efac2bdae1db5bfc7fc7be0f49a288295c.tar.gz
org.eclipse.objectteams-69f9c9efac2bdae1db5bfc7fc7be0f49a288295c.tar.xz
org.eclipse.objectteams-69f9c9efac2bdae1db5bfc7fc7be0f49a288295c.zip
Bug 569756 - Revisit field initialization in roles - discriminate final
/ non-final revert changes in smap tests due to bug 527743 and bug 528057
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumFlightbonusTest.java13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest002.java74
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest003.java4
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest006.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/workspace/JSR-045/src/org/eclipse/objectteams/example/fbapplication/FlightBonus/Subscriber.java4
5 files changed, 51 insertions, 56 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumFlightbonusTest.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumFlightbonusTest.java
index 5e856d1d9..c5a37ee8b 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumFlightbonusTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumFlightbonusTest.java
@@ -253,20 +253,23 @@ public class OTJStratumFlightbonusTest extends AbstractSourceMapGeneratorTest {
// copy-inherited methods
FileInfo fileInfo2 = stratum_role1.getOrCreateFileInfo("Bonus.java", "org/eclipse/objectteams/example/bonussystem/Bonus.java");
- LineInfo lineInfo4 = new LineInfo(39,21); // class header (e.g., _OT$getTeam())
- LineInfo lineInfo6 = new LineInfo(44,30); // method getCollectedCredits
- LineInfo lineInfo7 = new LineInfo(49,28); // method collectCredits
+ LineInfo lineInfo4 = new LineInfo(39,17); // class header (e.g., _OT$getTeam())
+ LineInfo lineInfo5 = new LineInfo(39,18); // method _OT$InitFields (class header and field decl)
+ lineInfo5.setRepeatCount(3);
+ LineInfo lineInfo6 = new LineInfo(44,29); // method getCollectedCredits
+ LineInfo lineInfo7 = new LineInfo(49,27); // method collectCredits
lineInfo7.setRepeatCount(2);
- LineInfo lineInfo8 = new LineInfo(58,22); // method buy
+ LineInfo lineInfo8 = new LineInfo(58,21); // method buy
lineInfo8.setRepeatCount(6);
fileInfo2.addLineInfo(lineInfo4);
+ fileInfo2.addLineInfo(lineInfo5);
fileInfo2.addLineInfo(lineInfo6);
fileInfo2.addLineInfo(lineInfo7);
fileInfo2.addLineInfo(lineInfo8);
LineInfo lineInfo1 = new LineInfo(7,7); // all lines of class Subscriber
- lineInfo1.setRepeatCount(14);
+ lineInfo1.setRepeatCount(10);
LineInfo lineInfo2 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
LineInfo lineInfo3 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest002.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest002.java
index 8d319e805..db465e5bf 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest002.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest002.java
@@ -83,7 +83,7 @@ public class OTJStratumGenerationTest002 extends AbstractSourceMapGeneratorTest
expectedStrata.put(TYPENAME, createExpectedRoleAStratum(true /*fullSource*/));
- HashMap<String, int[]> expectedMethodLineNumbers = createExpectedLines(11);
+ HashMap<String, int[]> expectedMethodLineNumbers = createExpectedLines(13);
try
{
@@ -94,7 +94,6 @@ public class OTJStratumGenerationTest002 extends AbstractSourceMapGeneratorTest
outputPath); // need this so that class files are actually written for next phase
expectedStrata.put(TYPENAME, createExpectedRoleAStratum(false /*not fullSource*/));
- expectedMethodLineNumbers = createExpectedLines(13);
// recompile SubTeam only to check usage of byte code information (CopyInheritanceSrc):
String [] classPaths = getDefaultClassPaths();
@@ -113,7 +112,7 @@ public class OTJStratumGenerationTest002 extends AbstractSourceMapGeneratorTest
}
private HashMap<String, int[]> createExpectedLines(int l) {
- // consecutive synth lines, different start in source/binary settings
+ // consecutive synth lines
HashMap<String, int[]> expectedMethodLineNumbers = new HashMap<String, int[]>();
expectedMethodLineNumbers.put("copyInheritance.SubTeam$__OT__RoleA.roleMethod0(LcopyInheritance/SubTeam$TSuper__OT__SuperTeam;)V", new int[]{l++,l++,l++});
expectedMethodLineNumbers.put("copyInheritance.SubTeam$__OT__RoleA.roleMethod0(LcopyInheritance/SuperTeam$TSuper__OT__SuperSuperTeam;)V", new int[]{l++,l++});
@@ -126,11 +125,39 @@ public class OTJStratumGenerationTest002 extends AbstractSourceMapGeneratorTest
// helper for testSimpleCopyInheritanceSmapRoleA.
//
List<SmapStratum> createExpectedRoleAStratum(boolean fullSource) {
+ // these two lines are swapped when reading super teams as binary:
+ int twelve = fullSource ? 12 : 11;
+ int eleven = fullSource ? 11 : 12;
SmapStratum stratum_role = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
FileInfo fileInfo2 = stratum_role.getOrCreateFileInfo("SubTeam.java", "copyInheritance/SubTeam.java");
-
- LineInfo lineInfo1_role2 = new LineInfo(5,5); // all original lines from SubTeam.RoleA
+ // letters (a) ... indicate the order in which lines are assigned
+ // class position is used by ctor, initFields and getTeam
+
+ FileInfo fileInfo0 = stratum_role.getOrCreateFileInfo("SuperSuperTeam.java", "copyInheritance/SuperSuperTeam.java");
+
+ LineInfo lineInfo1_role0 = new LineInfo(4,twelve); // (c) class position (4) mapped to synthetic line 12
+ LineInfo lineInfo2_role0 = new LineInfo(8,16); // (e) method roleMethod0 (8..) mapped to synthetic lines 16-17
+ lineInfo2_role0.setRepeatCount(2);
+ LineInfo lineInfo3_role0 = new LineInfo(12,18); // (f) method roleMethod1 (12,14,15) mapped to synthetic lines 18,20,21
+ lineInfo3_role0.setRepeatCount(4); // repeat 4 although line numbers have a "hole" at comment line 19
+
+ fileInfo0.addLineInfo(lineInfo1_role0);
+ fileInfo0.addLineInfo(lineInfo2_role0);
+ fileInfo0.addLineInfo(lineInfo3_role0);
+
+ FileInfo fileInfo1 = stratum_role.getOrCreateFileInfo("SuperTeam.java", "copyInheritance/SuperTeam.java");
+ LineInfo lineInfo1_role1 = new LineInfo(4,eleven); // (b) class position (4) mapped to synthetic line 11
+ LineInfo lineInfo2_role1 = new LineInfo(11,13); // (d) roleMethod0 (11..) mapped to synthetic lines 13-15
+ lineInfo2_role1.setRepeatCount(3);
+ LineInfo lineInfo3_role1 = new LineInfo(8,22); // (g) method roleMethod2 (8..) mapped to synthetic lines 22-23
+ lineInfo3_role1.setRepeatCount(2);
+
+ fileInfo1.addLineInfo(lineInfo1_role1);
+ fileInfo1.addLineInfo(lineInfo2_role1);
+ fileInfo1.addLineInfo(lineInfo3_role1);
+
+ LineInfo lineInfo1_role2 = new LineInfo(5,5); // (a) all original lines from SubTeam.RoleA
lineInfo1_role2.setRepeatCount(6);
LineInfo lineInfo2_role2 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
LineInfo lineInfo3_role2 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
@@ -139,37 +166,6 @@ public class OTJStratumGenerationTest002 extends AbstractSourceMapGeneratorTest
fileInfo2.addLineInfo(lineInfo2_role2);
fileInfo2.addLineInfo(lineInfo3_role2);
- FileInfo fileInfo0 = stratum_role.getOrCreateFileInfo("SuperSuperTeam.java", "copyInheritance/SuperSuperTeam.java");
- FileInfo fileInfo1 = stratum_role.getOrCreateFileInfo("SuperTeam.java", "copyInheritance/SuperTeam.java");
-
- int[][] lines = { // {line, repeat}
- // methods declared in SuperSuperTeam.java (fileInfo0):
- {4, 1}, // class position (4) (used by ctor and getTeam)
- {8, 2}, // method roleMethod0 (8..)
- {12,4}, // method roleMethod1 (12,14,15) (repeat 4 despite the hole)
- // methods declared in SuperTeam.java (fileInfo1):
- {4, 1}, // class position (4) (used by ctor and getTeam)
- {8, 2}, // method roleMethod2 (8..)
- {11,3} // method roleMethod0 (11..)
- };
- // depending on the compilation mode, synthetic lines are assigned in different orders:
- int[] order = fullSource ? new int[] {
- 5, 1, 2, 4, 0, 3
- } : new int[] {
- 0, 3, 5, 1, 2, 4
- };
-
- int line = 11;
- for (int idx : order) {
- LineInfo info = new LineInfo(lines[idx][0], line);
- info.setRepeatCount(lines[idx][1]);
- line += lines[idx][1];
- if (idx < 3)
- fileInfo0.addLineInfo(info);
- else
- fileInfo1.addLineInfo(info);
- }
-
stratum_role.optimize();
List <SmapStratum>strata_role1 = new ArrayList<SmapStratum>();
strata_role1.add(stratum_role);
@@ -219,11 +215,11 @@ public class OTJStratumGenerationTest002 extends AbstractSourceMapGeneratorTest
SmapStratum stratum_role = new SmapStratum(ISMAPConstants.OTJ_STRATUM_NAME);
FileInfo fileInfo0 = stratum_role.getOrCreateFileInfo("SuperTeam2.java", "copyInheritance/SuperTeam2.java");
- LineInfo lineInfo2_role0 = new LineInfo(8,4); // method (8) mapped to synthetic line 4..
+ LineInfo lineInfo1_role0 = new LineInfo(6,4); // class position (6) mapped to synthetic line 4
+ fileInfo0.addLineInfo(lineInfo1_role0);
+ LineInfo lineInfo2_role0 = new LineInfo(8,5); // method (8) mapped to synthetic line 5..
lineInfo2_role0.setRepeatCount(5);
fileInfo0.addLineInfo(lineInfo2_role0);
- LineInfo lineInfo1_role0 = new LineInfo(6,9); // class position (6) mapped to synthetic line 9
- fileInfo0.addLineInfo(lineInfo1_role0);
LineInfo lineInfo2_role1 = new LineInfo(65533,65533);
lineInfo2_role1.setRepeatCount(2);
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest003.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest003.java
index 9d966c8c7..be8f4b32d 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest003.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest003.java
@@ -98,9 +98,9 @@ public class OTJStratumGenerationTest003 extends AbstractSourceMapGeneratorTest
FileInfo fileInfo1 = stratum_role.getOrCreateFileInfo(
roleFileSourceName, _packagePath + "/" + "SuperTeam" + "/" + roleFileSourceName);
- LineInfo lineInfo2 = new LineInfo(9,1); // method roleMethod (9..) mapped to synthetic line 1.. (no own lines in SubTeam.RoleA).
+ LineInfo lineInfo1 = new LineInfo(5,1); // role (5..) mapped to synthetic line 1 (no own lines in SubTeam.RoleA).
+ LineInfo lineInfo2 = new LineInfo(9,2); // method roleMethod (9..) mapped to synthetic line 2..
lineInfo2.setRepeatCount(2);
- LineInfo lineInfo1 = new LineInfo(5,3); // role (5..) mapped to synthetic line 3
LineInfo lineInfo3 = new LineInfo(ISMAPConstants.STEP_INTO_LINENUMBER,ISMAPConstants.STEP_INTO_LINENUMBER);
LineInfo lineInfo4 = new LineInfo(ISMAPConstants.STEP_OVER_LINENUMBER,ISMAPConstants.STEP_OVER_LINENUMBER);
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest006.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest006.java
index 0fcabe402..65a36b9c2 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest006.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/smap/OTJStratumGenerationTest006.java
@@ -149,12 +149,12 @@ public class OTJStratumGenerationTest006 extends AbstractSourceMapGeneratorTest
FileInfo fileInfo2 = stratum_role1.getOrCreateFileInfo("SubTeam.java", "calloutOverride/SubTeam.java");
FileInfo fileInfo1 = stratum_role1.getOrCreateFileInfo("SuperTeam.java", "calloutOverride/SuperTeam.java");
- LineInfo lineInfo1 = new LineInfo(13,8); // roleMethod at synth line 8
- lineInfo1.setRepeatCount(2);
- LineInfo lineInfo2 = new LineInfo(8,10); // anotherRoleMethod at synth line 10
- lineInfo2.setRepeatCount(2);
- LineInfo lineInfo3 = new LineInfo(4,12); // role ctor at synth line 12
-
+ LineInfo lineInfo1 = new LineInfo(4,8); // role ctor at synth line 8
+ LineInfo lineInfo2 = new LineInfo(8,11); // anotherRoleMethod at synth line 11
+ lineInfo2.setRepeatCount(2);
+ LineInfo lineInfo3 = new LineInfo(13,9); // roleMethod at synth line 9
+ lineInfo3.setRepeatCount(2);
+
fileInfo1.addLineInfo(lineInfo1);
fileInfo1.addLineInfo(lineInfo2);
fileInfo1.addLineInfo(lineInfo3);
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/workspace/JSR-045/src/org/eclipse/objectteams/example/fbapplication/FlightBonus/Subscriber.java b/testplugins/org.eclipse.objectteams.otdt.tests/workspace/JSR-045/src/org/eclipse/objectteams/example/fbapplication/FlightBonus/Subscriber.java
index 3f5921b42..d05cd63b1 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/workspace/JSR-045/src/org/eclipse/objectteams/example/fbapplication/FlightBonus/Subscriber.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/workspace/JSR-045/src/org/eclipse/objectteams/example/fbapplication/FlightBonus/Subscriber.java
@@ -13,8 +13,4 @@ public class Subscriber playedBy Passenger
// Callout method binding
String getName() -> String getName();
-
- public Subscriber(Passenger pass) {
- tsuper();
- }
}

Back to the top