Skip to content

Commit

Permalink
Report initializer changes for attributes with modified signature
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Jul 2, 2024
1 parent e0e5b3c commit 8833fd8
Show file tree
Hide file tree
Showing 53 changed files with 861 additions and 53 deletions.
15 changes: 15 additions & 0 deletions src/main/java/org/codetracker/AttributeTrackerChangeHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.codetracker.api.Version;
import org.codetracker.change.Change;
import org.codetracker.change.ChangeFactory;
import org.codetracker.change.Change.Type;
import org.codetracker.element.Attribute;
import org.refactoringminer.api.Refactoring;
import org.refactoringminer.api.RefactoringType;
Expand All @@ -20,6 +21,7 @@
import gr.uom.java.xmi.UMLAttribute;
import gr.uom.java.xmi.UMLClass;
import gr.uom.java.xmi.UMLModel;
import gr.uom.java.xmi.decomposition.AbstractExpression;
import gr.uom.java.xmi.diff.AddAttributeAnnotationRefactoring;
import gr.uom.java.xmi.diff.AddAttributeModifierRefactoring;
import gr.uom.java.xmi.diff.ChangeAttributeAccessModifierRefactoring;
Expand Down Expand Up @@ -219,6 +221,19 @@ private boolean addAttributeChange(Version currentVersion, Version parentVersion
Attribute attributeBefore = Attribute.of(umlAttributeBefore, parentVersion);
attributeChangeHistory.addChange(attributeBefore, attributeAfter, ChangeFactory.forAttribute(changeType).refactoring(refactoring));
leftAttributeSet.add(attributeBefore);
AbstractExpression leftInitializer = umlAttributeBefore.getVariableDeclaration().getInitializer();
AbstractExpression rightInitializer = umlAttributeAfter.getVariableDeclaration().getInitializer();
if (leftInitializer != null && rightInitializer != null) {
if (!leftInitializer.getString().equals(rightInitializer.getString())) {
attributeChangeHistory.addChange(attributeBefore, attributeAfter, ChangeFactory.forAttribute(Type.INITIALIZER_CHANGE));
}
}
else if (leftInitializer == null && rightInitializer != null) {
attributeChangeHistory.addChange(attributeBefore, attributeAfter, ChangeFactory.forAttribute(Type.INITIALIZER_ADDED));
}
else if (leftInitializer != null && rightInitializer == null) {
attributeChangeHistory.addChange(attributeBefore, attributeAfter, ChangeFactory.forAttribute(Type.INITIALIZER_REMOVED));
}
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@
"elementNameAfter": "src/java/org.apache.commons.io.output.DemuxOutputStream@(private)m_streams:InheritableThreadLocal<OutputStream>(32)",
"comment": "Change Attribute Type m_streams : InheritableThreadLocal to m_streams : InheritableThreadLocal<OutputStream> in class org.apache.commons.io.output.DemuxOutputStream"
},
{
"parentCommitId": "a7628b03ac47459a47f2c340bb474afe50ea0a31",
"commitId": "a74a5a0c6ff41a4ca0a08caf740ebce1dc3c6d10",
"commitTime": 1202324477,
"changeType": "initializer change",
"elementFileBefore": "src/java/org/apache/commons/io/output/DemuxOutputStream.java",
"elementNameBefore": "src/java/org.apache.commons.io.output.DemuxOutputStream@(private)m_streams:InheritableThreadLocal(32)",
"elementFileAfter": "src/java/org/apache/commons/io/output/DemuxOutputStream.java",
"elementNameAfter": "src/java/org.apache.commons.io.output.DemuxOutputStream@(private)m_streams:InheritableThreadLocal<OutputStream>(32)",
"comment": "initializer change"
},
{
"parentCommitId": "d5e24a4f1a2ff0e5c565f5b78fc0691e639b876e",
"commitId": "c77a476ee86b107745267bdfc9fc210201e6d414",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
"elementNameAfter": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt@(protected)lastScheduledContainer:Map<SchedulerRequestKey,Long>(154)",
"comment": "Change Attribute Type lastScheduledContainer : Map<Priority,Long> to lastScheduledContainer : Map<SchedulerRequestKey,Long> in class org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt"
},
{
"parentCommitId": "d2cf8b54c546fad098307b771ffe40173700f5a8",
"commitId": "5aace38b748ba71aaadd2c4d64eba8dc1f816828",
"commitTime": 1469570043,
"changeType": "initializer change",
"elementFileBefore": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java",
"elementNameBefore": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt@(protected)lastScheduledContainer:Map<Priority,Long>(153)",
"elementFileAfter": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java",
"elementNameAfter": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt@(protected)lastScheduledContainer:Map<SchedulerRequestKey,Long>(154)",
"comment": "initializer change"
},
{
"parentCommitId": "b4eb963c3c3e0b123003d7b32cdf7c9202cfb441",
"commitId": "a45017a5f17ec11814db7e206d1e80aaa4dd8d8f",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
"elementNameAfter": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt@(private)schedulingOpportunities:ConcurrentHashMultiset<SchedulerRequestKey>(142)",
"comment": "Change Attribute Access Modifier package to private in attribute private schedulingOpportunities : ConcurrentHashMultiset<SchedulerRequestKey> from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt"
},
{
"parentCommitId": "ea29e3bc27f15516f4346d1312eef703bcd3d032",
"commitId": "b8a30f2f170ffbd590e7366c3c944ab4919e40df",
"commitTime": 1474276081,
"changeType": "initializer change",
"elementFileBefore": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java",
"elementNameBefore": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt@(package)schedulingOpportunities:Multiset<SchedulerRequestKey>(141)",
"elementFileAfter": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java",
"elementNameAfter": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt@(private)schedulingOpportunities:ConcurrentHashMultiset<SchedulerRequestKey>(142)",
"comment": "initializer change"
},
{
"parentCommitId": "d2cf8b54c546fad098307b771ffe40173700f5a8",
"commitId": "5aace38b748ba71aaadd2c4d64eba8dc1f816828",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@
"elementNameAfter": "src/java/org.apache.lucene.index.ConcurrentMergeScheduler@(protected)mergeThreads:List<MergeThread>(39)",
"comment": "Change Attribute Type mergeThreads : List to mergeThreads : List<MergeThread> in class org.apache.lucene.index.ConcurrentMergeScheduler"
},
{
"parentCommitId": "975ce67fb522b181e5737e60fb5e85a91b4571fe",
"commitId": "b22932be70380aaa85eb436c96b5908c0276618f",
"commitTime": 1255806907,
"changeType": "initializer change",
"elementFileBefore": "src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java",
"elementNameBefore": "src/java/org.apache.lucene.index.ConcurrentMergeScheduler@(protected)mergeThreads:List(39)",
"elementFileAfter": "src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java",
"elementNameAfter": "src/java/org.apache.lucene.index.ConcurrentMergeScheduler@(protected)mergeThreads:List<MergeThread>(39)",
"comment": "initializer change"
},
{
"parentCommitId": "3a24900ef522c28aff22990bab943e97167c70c1",
"commitId": "115faf7b5d169a353cd1bba6825624e5a3c06bb4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
"elementNameAfter": "lucene/core/src/java/org.apache.lucene.index.IndexWriter@(final)(private)readerPool:ReaderPool(326)",
"comment": "Change Attribute Access Modifier package to private in attribute private readerPool : ReaderPool from class org.apache.lucene.index.IndexWriter"
},
{
"parentCommitId": "4136fe0e65ac4394033d24840ac364943c7d89a2",
"commitId": "8975692953713923bd1cc67766cf92565183c2b8",
"commitTime": 1524472150,
"changeType": "initializer removed",
"elementFileBefore": "lucene/core/src/java/org/apache/lucene/index/IndexWriter.java",
"elementNameBefore": "lucene/core/src/java/org.apache.lucene.index.IndexWriter@(final)(package)readerPool:ReaderPool(327)",
"elementFileAfter": "lucene/core/src/java/org/apache/lucene/index/IndexWriter.java",
"elementNameAfter": "lucene/core/src/java/org.apache.lucene.index.IndexWriter@(final)(private)readerPool:ReaderPool(326)",
"comment": "initializer removed"
},
{
"parentCommitId": "2e5c6cdadc820220f8cb86e1b6e215da941649f9",
"commitId": "778d96752fa94636a2136ea2b4d58a3fcbe283ec",
Expand Down Expand Up @@ -51,6 +62,17 @@
"elementNameAfter": "lucene/src/java/org.apache.lucene.index.IndexWriter@(final)(package)readerPool:ReaderPool(252)",
"comment": "Change Attribute Type readerPool : IndexReaderPool to readerPool : ReaderPool in class org.apache.lucene.index.IndexWriter"
},
{
"parentCommitId": "683568df65717e2dc8d090834fed813d9c9b277b",
"commitId": "502e971a78dbb78a085fd0f74c1541230f19fcb8",
"commitTime": 1292920096,
"changeType": "initializer added",
"elementFileBefore": "lucene/src/java/org/apache/lucene/index/IndexWriter.java",
"elementNameBefore": "lucene/src/java/org.apache.lucene.index.IndexWriter@(final)(package)readerPool:IndexReaderPool(306)",
"elementFileAfter": "lucene/src/java/org/apache/lucene/index/IndexWriter.java",
"elementNameAfter": "lucene/src/java/org.apache.lucene.index.IndexWriter@(final)(package)readerPool:ReaderPool(252)",
"comment": "initializer added"
},
{
"parentCommitId": "4128a36c987d7f50c8fc4e8fe161fd1391c753d3",
"commitId": "8024f7f00a00fe4cac78f3f325532daf47cc364b",
Expand All @@ -62,6 +84,17 @@
"elementNameAfter": "lucene/src/java/org.apache.lucene.index.IndexWriter@(final)(package)readerPool:IndexReaderPool(306)",
"comment": "Change Attribute Type readerPool : ReaderPool to readerPool : IndexReaderPool in class org.apache.lucene.index.IndexWriter"
},
{
"parentCommitId": "4128a36c987d7f50c8fc4e8fe161fd1391c753d3",
"commitId": "8024f7f00a00fe4cac78f3f325532daf47cc364b",
"commitTime": 1280262785,
"changeType": "initializer removed",
"elementFileBefore": "lucene/src/java/org/apache/lucene/index/IndexWriter.java",
"elementNameBefore": "lucene/src/java/org.apache.lucene.index.IndexWriter@(final)(package)readerPool:ReaderPool(307)",
"elementFileAfter": "lucene/src/java/org/apache/lucene/index/IndexWriter.java",
"elementNameAfter": "lucene/src/java/org.apache.lucene.index.IndexWriter@(final)(package)readerPool:IndexReaderPool(306)",
"comment": "initializer removed"
},
{
"parentCommitId": "bb8b2e146291942f41ee6b6e9b91b4d1222022a1",
"commitId": "3c91517add263dcc2cada194f9545b573b920daf",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@
"elementNameAfter": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(package)multiTermRewriteMethod:MultiTermQuery.RewriteMethod(122)",
"comment": "Rename Attribute constantScoreRewrite : boolean to multiTermRewriteMethod : MultiTermQuery.RewriteMethod in class org.apache.lucene.queryParser.QueryParser"
},
{
"parentCommitId": "31a5f0edcc474f739e8392eac7261b9483fc60bf",
"commitId": "be66120dffb677ea4ce263282d6fd35956b84e78",
"commitTime": 1248480213,
"changeType": "initializer change",
"elementFileBefore": "src/java/org/apache/lucene/queryParser/QueryParser.java",
"elementNameBefore": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(package)constantScoreRewrite:boolean(121)",
"elementFileAfter": "src/java/org/apache/lucene/queryParser/QueryParser.java",
"elementNameAfter": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(package)multiTermRewriteMethod:MultiTermQuery.RewriteMethod(122)",
"comment": "initializer change"
},
{
"parentCommitId": "66c16c196dceb7a3bb377728fd5fbcf770cff378",
"commitId": "abe6ea0828bdc521f77bb07da3845186669d48d5",
Expand All @@ -106,6 +117,17 @@
"elementNameAfter": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(package)constantScoreRewrite:boolean(118)",
"comment": "Rename Attribute useOldRangeQuery : boolean to constantScoreRewrite : boolean in class org.apache.lucene.queryParser.QueryParser"
},
{
"parentCommitId": "66c16c196dceb7a3bb377728fd5fbcf770cff378",
"commitId": "abe6ea0828bdc521f77bb07da3845186669d48d5",
"commitTime": 1226364000,
"changeType": "initializer change",
"elementFileBefore": "src/java/org/apache/lucene/queryParser/QueryParser.java",
"elementNameBefore": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(package)useOldRangeQuery:boolean(120)",
"elementFileAfter": "src/java/org/apache/lucene/queryParser/QueryParser.java",
"elementNameAfter": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(package)constantScoreRewrite:boolean(118)",
"comment": "initializer change"
},
{
"parentCommitId": "d94dfccdbf44afdd3ed6096039f1070fc46e9673",
"commitId": "bb002479043e191235f0aecaeee4c5ded227ec42",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@
"elementNameAfter": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(private)operator:Operator(74)",
"comment": "Change Attribute Type operator : int to operator : Operator in class org.apache.lucene.queryParser.QueryParser"
},
{
"parentCommitId": "742417162a1a94605dee78728733be03dbb1fa4b",
"commitId": "197ad763d1a6320b60dfd21a5bfb13fa71144afa",
"commitTime": 1101251614,
"changeType": "initializer change",
"elementFileBefore": "src/java/org/apache/lucene/queryParser/QueryParser.java",
"elementNameBefore": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(private)operator:int(66)",
"elementFileAfter": "src/java/org/apache/lucene/queryParser/QueryParser.java",
"elementNameAfter": "src/java/org/apache/lucene/queryParser/org.apache.lucene.queryParser.QueryParser@(private)operator:Operator(74)",
"comment": "initializer change"
},
{
"parentCommitId": "798fc0f0ef9ae13a29f3271f49522a5e4ef23acf",
"commitId": "2af2d858774f7391f13341b8f588e75287868237",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@
"elementNameAfter": "src/org.mockito.internal.Stubber@(private)stubbed:LinkedList<StubbedInvocationMatcher>(10)",
"comment": "Change Attribute Type stubbed : LinkedList<StubbedInvocation> to stubbed : LinkedList<StubbedInvocationMatcher> in class org.mockito.internal.Stubber"
},
{
"parentCommitId": "363dce3b88179bb7b5ae6bd0580b19e1d0c15481",
"commitId": "554224f9cc39c4cbbcdaa0ff7e183a1cc416ce8e",
"commitTime": 1197326252,
"changeType": "initializer change",
"elementFileBefore": "src/org/mockito/internal/Stubber.java",
"elementNameBefore": "src/org.mockito.internal.Stubber@(private)stubbed:LinkedList<StubbedInvocation>(10)",
"elementFileAfter": "src/org/mockito/internal/Stubber.java",
"elementNameAfter": "src/org.mockito.internal.Stubber@(private)stubbed:LinkedList<StubbedInvocationMatcher>(10)",
"comment": "initializer change"
},
{
"parentCommitId": "b874832634a8a31693dbce7ccec9390bb2bf7dce",
"commitId": "15f3bb0ac999bbb5c3e8b28e332c02113d2534d5",
Expand All @@ -85,4 +96,4 @@
"comment": "added with new class"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
"elementNameAfter": "src/main/java/org.mockito.internal.configuration.plugins.PluginLoader@(final)(private)plugins:DefaultMockitoPlugins(19)",
"comment": "Change Attribute Type plugins : MockitoPlugins to plugins : DefaultMockitoPlugins in class org.mockito.internal.configuration.plugins.PluginLoader"
},
{
"parentCommitId": "ee61b29ee31ac7060196312b7ae5e2328e647a1d",
"commitId": "c316879c0b67adb643fb9cb7b6b2dcc995bec830",
"commitTime": 1503864044,
"changeType": "initializer change",
"elementFileBefore": "src/main/java/org/mockito/internal/configuration/plugins/PluginLoader.java",
"elementNameBefore": "src/main/java/org.mockito.internal.configuration.plugins.PluginLoader@(final)(private)plugins:MockitoPlugins(23)",
"elementFileAfter": "src/main/java/org/mockito/internal/configuration/plugins/PluginLoader.java",
"elementNameAfter": "src/main/java/org.mockito.internal.configuration.plugins.PluginLoader@(final)(private)plugins:DefaultMockitoPlugins(19)",
"comment": "initializer change"
},
{
"parentCommitId": "210f8f61265b49278f8bcb08cac4b78bccb6a5d7",
"commitId": "6cb43b930814d8fa20e74ba2f29e37da9dfc1fc8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
"elementNameAfter": "src/main/java/org.mockito.internal.stubbing.StubberImpl@(final)(private)answers:List<Answer<?>>(25)",
"comment": "Change Attribute Access Modifier package to private in attribute private answers : List<Answer<?>> from class org.mockito.internal.stubbing.StubberImpl"
},
{
"parentCommitId": "2ed01d44abfa8fc1ca45b1ba16d4fc11c3897ab6",
"commitId": "2f92126a765bbb6f5e6551fa50e007f9c8a14acc",
"commitTime": 1466371837,
"changeType": "initializer change",
"elementFileBefore": "src/main/java/org/mockito/internal/stubbing/StubberImpl.java",
"elementNameBefore": "src/main/java/org.mockito.internal.stubbing.StubberImpl@(final)(package)answers:List<Answer>(25)",
"elementFileAfter": "src/main/java/org/mockito/internal/stubbing/StubberImpl.java",
"elementNameAfter": "src/main/java/org.mockito.internal.stubbing.StubberImpl@(final)(private)answers:List<Answer<?>>(25)",
"comment": "initializer change"
},
{
"parentCommitId": "9d3124ae8768ec9fb60ff5b8a176b060491f9770",
"commitId": "fe7bbabb82ce3d1000c13d39d6355c134e94ac27",
Expand Down
Loading

0 comments on commit 8833fd8

Please sign in to comment.