Skip to content

Commit

Permalink
Better support for attribute comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Aug 9, 2024
1 parent 29451ac commit a752fb2
Show file tree
Hide file tree
Showing 8 changed files with 647 additions and 263 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.codetracker.element.Class;
import org.codetracker.element.Method;
import org.refactoringminer.api.Refactoring;
import org.refactoringminer.api.RefactoringMinerTimedOutException;

import gr.uom.java.xmi.LocationInfo.CodeElementType;
import gr.uom.java.xmi.UMLAnnotation;
Expand Down Expand Up @@ -118,7 +117,7 @@ public boolean isStartClass(Class clazz) {
clazz.getUmlClass().getLocationInfo().getEndLine() >= methodDeclarationLineNumber;
}

public boolean checkForExtractionOrInline(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Annotation rightAnnotation, List<Refactoring> refactorings) throws RefactoringMinerTimedOutException {
public boolean checkForExtractionOrInline(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Annotation rightAnnotation, List<Refactoring> refactorings) {
int extractMatches = 0;
for (Refactoring refactoring : refactorings) {
switch (refactoring.getRefactoringType()) {
Expand Down Expand Up @@ -221,7 +220,7 @@ public boolean checkForExtractionOrInline(Version currentVersion, Version parent
return false;
}

public boolean checkClassDiffForAnnotationChange(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Predicate<Annotation> equalAnnotation, UMLAbstractClassDiff umlClassDiff) throws RefactoringMinerTimedOutException {
public boolean checkClassDiffForAnnotationChange(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Predicate<Annotation> equalAnnotation, UMLAbstractClassDiff umlClassDiff) {
for (UMLOperationBodyMapper operationBodyMapper : umlClassDiff.getOperationBodyMapperList()) {
Method method2 = Method.of(operationBodyMapper.getContainer2(), currentVersion);
if (equalMethod.test(method2)) {
Expand Down Expand Up @@ -291,7 +290,7 @@ public void addedAttribute(Attribute rightAttribute, Annotation rightAnnotation,
annotationChangeHistory.connectRelatedNodes();
}

public boolean checkBodyOfMatchedOperations(Version currentVersion, Version parentVersion, Predicate<Annotation> equalOperator, UMLOperationBodyMapper umlOperationBodyMapper) throws RefactoringMinerTimedOutException {
public boolean checkBodyOfMatchedOperations(Version currentVersion, Version parentVersion, Predicate<Annotation> equalOperator, UMLOperationBodyMapper umlOperationBodyMapper) {
if (umlOperationBodyMapper == null)
return false;
// check if it is in the matched
Expand Down Expand Up @@ -351,7 +350,7 @@ private boolean isAdded(UMLOperationBodyMapper umlOperationBodyMapper, Version c
return false;
}

public boolean checkBodyOfMatchedClasses(Version currentVersion, Version parentVersion, Predicate<Annotation> equalOperator, UMLAbstractClassDiff classDiff) throws RefactoringMinerTimedOutException {
public boolean checkBodyOfMatchedClasses(Version currentVersion, Version parentVersion, Predicate<Annotation> equalOperator, UMLAbstractClassDiff classDiff) {
if (classDiff == null)
return false;
// check if it is in the matched
Expand Down Expand Up @@ -465,7 +464,7 @@ private boolean isAdded(Pair<VariableDeclarationContainer, VariableDeclarationCo
return false;
}

public boolean checkRefactoredMethod(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Annotation rightAnnotation, List<Refactoring> refactorings) throws RefactoringMinerTimedOutException {
public boolean checkRefactoredMethod(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Annotation rightAnnotation, List<Refactoring> refactorings) {
for (Refactoring refactoring : refactorings) {
UMLOperation operationBefore = null;
UMLOperation operationAfter = null;
Expand Down Expand Up @@ -513,7 +512,7 @@ public boolean checkRefactoredMethod(Version currentVersion, Version parentVersi
return false;
}

public boolean checkRefactoredAttribute(Version currentVersion, Version parentVersion, Predicate<Attribute> equalAttribute, Annotation rightAnnotation, List<Refactoring> refactorings) throws RefactoringMinerTimedOutException {
public boolean checkRefactoredAttribute(Version currentVersion, Version parentVersion, Predicate<Attribute> equalAttribute, Annotation rightAnnotation, List<Refactoring> refactorings) {
for (Refactoring refactoring : refactorings) {
UMLAttribute attributeBefore = null;
UMLAttribute attributeAfter = null;
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/org/codetracker/BlockTrackerChangeHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.codetracker.element.Block;
import org.codetracker.element.Method;
import org.refactoringminer.api.Refactoring;
import org.refactoringminer.api.RefactoringMinerTimedOutException;

import gr.uom.java.xmi.UMLOperation;
import gr.uom.java.xmi.UMLType;
Expand All @@ -42,8 +41,6 @@
import gr.uom.java.xmi.decomposition.VariableDeclaration;
import gr.uom.java.xmi.diff.ExtractOperationRefactoring;
import gr.uom.java.xmi.diff.InlineOperationRefactoring;
import gr.uom.java.xmi.diff.MergeCatchRefactoring;
import gr.uom.java.xmi.diff.MergeConditionalRefactoring;
import gr.uom.java.xmi.diff.MergeOperationRefactoring;
import gr.uom.java.xmi.diff.MoveOperationRefactoring;
import gr.uom.java.xmi.diff.PullUpOperationRefactoring;
Expand Down Expand Up @@ -109,7 +106,7 @@ public boolean isStartMethod(Method method) {
method.getUmlOperation().getLocationInfo().getEndLine() >= methodDeclarationLineNumber;
}

public boolean checkClassDiffForBlockChange(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Predicate<Block> equalBlock, UMLAbstractClassDiff umlClassDiff) throws RefactoringMinerTimedOutException {
public boolean checkClassDiffForBlockChange(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Predicate<Block> equalBlock, UMLAbstractClassDiff umlClassDiff) {
for (UMLOperationBodyMapper operationBodyMapper : umlClassDiff.getOperationBodyMapperList()) {
Method method2 = Method.of(operationBodyMapper.getContainer2(), currentVersion);
if (equalMethod.test(method2)) {
Expand All @@ -126,7 +123,7 @@ public boolean checkClassDiffForBlockChange(Version currentVersion, Version pare
return false;
}

public boolean checkForExtractionOrInline(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Block rightBlock, List<Refactoring> refactorings) throws RefactoringMinerTimedOutException {
public boolean checkForExtractionOrInline(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Block rightBlock, List<Refactoring> refactorings) {
int extractMatches = 0;
for (Refactoring refactoring : refactorings) {
switch (refactoring.getRefactoringType()) {
Expand Down Expand Up @@ -401,7 +398,7 @@ else if (mapping instanceof LeafMapping && mapping.getFragment1() instanceof Sta
return false;
}

public boolean checkBodyOfMatchedOperations(Version currentVersion, Version parentVersion, Predicate<Block> equalOperator, UMLOperationBodyMapper umlOperationBodyMapper) throws RefactoringMinerTimedOutException {
public boolean checkBodyOfMatchedOperations(Version currentVersion, Version parentVersion, Predicate<Block> equalOperator, UMLOperationBodyMapper umlOperationBodyMapper) {
if (umlOperationBodyMapper == null)
return false;
Set<Refactoring> refactorings = umlOperationBodyMapper.getRefactoringsAfterPostProcessing();
Expand Down Expand Up @@ -764,7 +761,7 @@ private boolean isAdded(UMLOperationBodyMapper umlOperationBodyMapper, Version c
return false;
}

public boolean checkRefactoredMethod(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Block rightBlock, List<Refactoring> refactorings) throws RefactoringMinerTimedOutException {
public boolean checkRefactoredMethod(Version currentVersion, Version parentVersion, Predicate<Method> equalMethod, Block rightBlock, List<Refactoring> refactorings) {
for (Refactoring refactoring : refactorings) {
UMLOperation operationBefore = null;
UMLOperation operationAfter = null;
Expand Down
Loading

0 comments on commit a752fb2

Please sign in to comment.