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

Revised: Fix issues #97, #98, and #102, and improve time-aware patch tracking #105

Merged
merged 85 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
2231714
test main for vevos extraction
pmbittner Mar 9, 2023
bf96460
more debugging
pmbittner Mar 9, 2023
67d5d24
fix: do not ignore empty lines; do not collapse lines
pmbittner Mar 10, 2023
b25e9e4
feat: print and render patches
pmbittner Mar 10, 2023
bc65a6a
feat: inspect
pmbittner Mar 13, 2023
d7423c0
deps: added updated functional lib
AlexanderSchultheiss Mar 16, 2023
3df1f8b
feat: time-dependent file names for patches
AlexanderSchultheiss Mar 16, 2023
c0b575e
Fix invalid Javadoc references
ibbem Mar 17, 2023
1524545
dependencies: updated functjonal lib
AlexanderSchultheiss Mar 17, 2023
c2dd1b9
fix: diffs are now analyzed if they match a filter criterion either b…
AlexanderSchultheiss Apr 14, 2023
7a31eb4
dependencies: update functjonal library
AlexanderSchultheiss Jun 16, 2023
20df2ef
tests: update test case resources
AlexanderSchultheiss Jun 16, 2023
4019c3d
fix(#97): filter C-style comments spanning multiple lines
AlexanderSchultheiss Aug 30, 2023
780e30a
tests: update expected test results
AlexanderSchultheiss Aug 30, 2023
8fc2f1d
fix (#98): Adjust CPP annotation regex to correctly handle parenthesis
AlexanderSchultheiss Sep 14, 2023
11ff105
fix: some fixes after merge
AlexanderSchultheiss Sep 14, 2023
040bd8a
fix(#98): add handling of additional edge cases
AlexanderSchultheiss Sep 19, 2023
a51a22a
tests: add test case for `has_include` expressions
AlexanderSchultheiss Sep 19, 2023
51f321f
tests: add test case for unfixed edge case
AlexanderSchultheiss Sep 19, 2023
1f84372
tests(TDD): add test cases for parser revision
AlexanderSchultheiss Sep 22, 2023
390a51e
feat: Add ANTLR grammar
AlexanderSchultheiss Sep 22, 2023
4787e5d
refactor: update grammar name
AlexanderSchultheiss Sep 22, 2023
d36ecf6
feat: add C expression lexer and parser
AlexanderSchultheiss Sep 22, 2023
4c016ce
feat: add first draft of visitor that simplifies C expressions
AlexanderSchultheiss Sep 22, 2023
3460d8b
feat: add files generated by ANTLR
AlexanderSchultheiss Sep 22, 2023
cb2391e
feat: add visitor that abstracts formulas
AlexanderSchultheiss Sep 22, 2023
1119632
tests: update test cases
AlexanderSchultheiss Sep 22, 2023
4c854b5
fix: handle ternary operator
AlexanderSchultheiss Sep 22, 2023
243b586
tests: add tests for special operators
AlexanderSchultheiss Sep 22, 2023
826442b
feat: implement handling of special CPP operators
AlexanderSchultheiss Sep 22, 2023
5056de8
feat: implement handling generic macro calls
AlexanderSchultheiss Sep 25, 2023
2ff03f0
refactor: remove unused generated classes
AlexanderSchultheiss Sep 25, 2023
c40a445
fix: adjust handling of paths in '__has_include' operators
AlexanderSchultheiss Sep 25, 2023
7dcfa82
docs: update comment
AlexanderSchultheiss Sep 25, 2023
d763a21
refactor: improve integration of BooleanAbstraction class
AlexanderSchultheiss Sep 25, 2023
e7ddafb
tests: update broken tests
AlexanderSchultheiss Sep 25, 2023
18e4ea7
misc: commit current state of things
AlexanderSchultheiss Sep 25, 2023
f813205
misc: fix link to grammar
AlexanderSchultheiss Sep 26, 2023
5cc562f
feat: extend grammar to deal with more complex and broken formulas
AlexanderSchultheiss Sep 26, 2023
fa49f24
feat: robustness against ambiguity
AlexanderSchultheiss Sep 26, 2023
6c62f84
feat: Handle stringizing with '#'
AlexanderSchultheiss Sep 26, 2023
0eb2c69
feat: Handle additional whitespace
AlexanderSchultheiss Sep 26, 2023
a8a827e
fix: handle problems related to PathLiteral tokens
AlexanderSchultheiss Sep 27, 2023
c3ed4e2
feat: additional error handling and logging
AlexanderSchultheiss Oct 6, 2023
c44c589
tests: add commented out problematic case
AlexanderSchultheiss Oct 6, 2023
a08facf
fix: remove logging of parent commit id
AlexanderSchultheiss Oct 9, 2023
d60e8fa
feat: ignore dollar sign in formulas
AlexanderSchultheiss Oct 9, 2023
6bfc243
feat: improve performance of grammar
AlexanderSchultheiss Oct 10, 2023
93d7f1a
misc: remove import
AlexanderSchultheiss Oct 10, 2023
e9ef155
feat: abstract character literals
AlexanderSchultheiss Oct 11, 2023
dbf826f
misc: add TODO
AlexanderSchultheiss Oct 12, 2023
c9daae8
tests: add test cases for multiline macros with inline comments
AlexanderSchultheiss Oct 12, 2023
e608d22
tests: extend test cases for multiline macros
AlexanderSchultheiss Oct 12, 2023
1aff331
tests(refactor): reuse existing test functionality for multiline macr…
AlexanderSchultheiss Oct 12, 2023
1a1ac6a
fix(#102): track multi-line comments for determining line completeness
AlexanderSchultheiss Oct 12, 2023
e19f6cc
misc: add additional error logging
AlexanderSchultheiss Oct 12, 2023
098c41b
fix(#102): handle nested comments
AlexanderSchultheiss Oct 12, 2023
c30a6ad
fix: handle identifiers starting with digits
AlexanderSchultheiss Oct 12, 2023
ae098d5
fix(#102): address another edge case of nested comments
AlexanderSchultheiss Oct 12, 2023
5a257c4
feat: add additional handling of errors during parsing
AlexanderSchultheiss Oct 13, 2023
39b0245
cleanup: remove deprecated debug file
AlexanderSchultheiss Oct 13, 2023
334ac63
docs: add comment for deploy-functjonal
AlexanderSchultheiss Oct 13, 2023
f367911
refactor: minor reformatting and toString adjustment for GitPatch
AlexanderSchultheiss Oct 13, 2023
1958516
refactor: cleaner interface for DiffParseExceptions due to parse prob…
AlexanderSchultheiss Oct 13, 2023
5a9677d
cleanup: removed unused methods
AlexanderSchultheiss Oct 13, 2023
e2ea2e3
docs: add small doc comments for new exceptions
AlexanderSchultheiss Oct 13, 2023
602149e
refactor: improve structure of CExpressionVisitors
AlexanderSchultheiss Oct 13, 2023
f668661
refactor: revise and document BooleanAbstraction
AlexanderSchultheiss Oct 13, 2023
9aec9e6
refactor: minor refactoring and documentation
AlexanderSchultheiss Oct 13, 2023
369fda4
docs: clarify documentation
AlexanderSchultheiss Oct 13, 2023
21ceed5
Update Maven dependency hash for the Nix CI pipeline
ibbem Oct 13, 2023
596901b
fix(docs): fix errors in JavaDocs
AlexanderSchultheiss Oct 13, 2023
e0ad845
refactor: make spelling consistent
AlexanderSchultheiss Oct 18, 2023
649398e
docs: add more documentation for abstracting logic
AlexanderSchultheiss Oct 18, 2023
55e2ac9
refactor: restructure and document token abstraction
AlexanderSchultheiss Oct 18, 2023
13463ec
tests: replace subject-specific names
AlexanderSchultheiss Oct 18, 2023
61eaa9d
misc: add script for generating ANTLR parser and lexer from grammar
AlexanderSchultheiss Oct 23, 2023
c3ff9de
fix(docs): fix Javadoc errors
AlexanderSchultheiss Oct 23, 2023
ad24520
misc: remove redundant jar file
AlexanderSchultheiss Oct 23, 2023
1ba5c19
docs: improve documentation of special operators
AlexanderSchultheiss Oct 23, 2023
9571dd6
docs: improve documentation of ANTL grammar
AlexanderSchultheiss Oct 23, 2023
bc5c580
misc: minor updates after cherry picking
AlexanderSchultheiss Oct 23, 2023
6e64da8
tests: minor fixes after cherry picking
AlexanderSchultheiss Oct 23, 2023
7699394
fix: treat empty lines as unchanged context line
AlexanderSchultheiss Oct 23, 2023
bf57d91
refactor: simplify and document handling of empty lines
AlexanderSchultheiss Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pkgs.stdenv.mkDerivation rec {
dontConfigure = true;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-qIKFqNwooJ0iqzkv6TTS5GM4bA6iYkVa35zqE+q5izY=";
outputHash = "sha256-Kc8kQiC7qzAk3SFmbuUFzoBqxImkHl7RjXMYMJ6SgCg=";
};

buildPhase = ''
Expand Down
3 changes: 3 additions & 0 deletions local-maven-repo/deploy-functjonal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# A simple script for deploying an update of the functjonal library to the local maven repository
mvn deploy:deploy-file -DgroupId=org.variantsync -DartifactId=functjonal -Dversion=1.0-SNAPSHOT -Durl=file:../local-maven-repo/ -DrepositoryId=local-maven-repo -DupdateReleaseInfo=true -Dfile=../src/main/resources/lib/functjonal-1.0-SNAPSHOT.jar
rm -rf ~/.m2/repository/org/variantsync/functjonal/

This file was deleted.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9c298528d8baeeccd664e5c06f881265
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
98de1b4bfa2aa9f4e9eaa8c547922f41c59e6e4f
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<metadata modelVersion="1.1.0">
<groupId>org.variantsync</groupId>
<artifactId>functjonal</artifactId>
<version>1.0-SNAPSHOT</version>
<versioning>
<lastUpdated>20230616172827</lastUpdated>
<snapshot>
<timestamp>20230308.125347</timestamp>
<buildNumber>1</buildNumber>
<timestamp>20230616.172827</timestamp>
<buildNumber>4</buildNumber>
</snapshot>
<lastUpdated>20230308125347</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>1.0-20230308.125347-1</value>
<updated>20230308125347</updated>
<value>1.0-20230616.172827-4</value>
<updated>20230616172827</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>1.0-20230308.125347-1</value>
<updated>20230308125347</updated>
<value>1.0-20230616.172827-4</value>
<updated>20230616172827</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
<version>1.0-SNAPSHOT</version>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cc732baa0478a9c6f2d21fdeb08f6a82
409dc289b1020047cbbd30802a354ba7
Original file line number Diff line number Diff line change
@@ -1 +1 @@
feb03041c908b3f11611fb2380e6bb9424ff2e63
7e20f40901ae2691c36c164a4306d0c3567d7edc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<versions>
<version>1.0-SNAPSHOT</version>
</versions>
<lastUpdated>20230308125347</lastUpdated>
<lastUpdated>20230616172827</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a9a0be7eec34faf063b51a34b7fed4a7
a374a3f90764d4507ada7e4ff0d8f0f6
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d53c3d14023e9052bda58ce2fdcc5580efda1a0b
834afd5cf8d0319105bad448138bf311e9734b1e
19 changes: 19 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@
</descriptorRefs>
</configuration>
</plugin>

<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.9.3</version>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -192,5 +205,11 @@
<artifactId>slf4j-simple</artifactId>
<version>2.0.5</version>
</dependency>

<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
<version>4.12.0</version>
</dependency>
</dependencies>
</project>
20 changes: 20 additions & 0 deletions scripts/generateANTLRClasses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# Call this script from the repository's root directory './scripts/generateANTLRClasses.sh'

# Define the paths and package information
GRAMMAR_DIR="src/main/resources/grammars"
GRAMMAR_FILE="CExpression.g4"
PACKAGE="org.variantsync.diffdetective.feature.antlr"
OUTPUT_DIR="$(pwd)/src/main/java/org/variantsync/diffdetective/feature/antlr"

cd $GRAMMAR_DIR

# Call ANTLR to generate the lexer and parser
antlr4 -o $OUTPUT_DIR -package "$PACKAGE" "$GRAMMAR_FILE"

# Provide feedback to the user
if [ $? -eq 0 ]; then
echo "ANTLR Lexer and Parser generated successfully in '$OUTPUT_DIR/$PACKAGE'."
else
echo "ANTLR generation and compilation failed."
fi
20 changes: 17 additions & 3 deletions src/main/java/org/variantsync/diffdetective/analysis/Analysis.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
import org.variantsync.diffdetective.diff.git.GitDiffer;
import org.variantsync.diffdetective.diff.git.PatchDiff;
import org.variantsync.diffdetective.diff.result.CommitDiffResult;
import org.variantsync.diffdetective.diff.result.DiffError;
import org.variantsync.diffdetective.metadata.Metadata;
import org.variantsync.diffdetective.parallel.ScheduledTasksIterator;
import org.variantsync.diffdetective.util.Assert;
import org.variantsync.diffdetective.util.Clock;
import org.variantsync.diffdetective.util.Diagnostics;
import org.variantsync.diffdetective.util.InvocationCounter;
import org.variantsync.diffdetective.variation.DiffLinesLabel;
import org.variantsync.diffdetective.variation.diff.Time;
import org.variantsync.diffdetective.variation.diff.VariationDiff;
import org.variantsync.functjonal.iteration.ClusteredIterator;
import org.variantsync.functjonal.iteration.MappedIterator;
Expand Down Expand Up @@ -204,11 +206,16 @@ default void initializeResults(Analysis analysis) {}
default void beginBatch(Analysis analysis) throws Exception {}
default boolean beginCommit(Analysis analysis) throws Exception { return true; }
/**
* Signals a parsing failure of some patch in the current commit.
* Signals a parsing failure of all patches in the current commit.
* Called at most once during the commit phase. If this hook is called {@link
* onParsedCommit} and the following patch phase invocations are skipped.
*/
default void onFailedCommit(Analysis analysis) throws Exception {}
/**
* Signals a parsing failure of some patch in the current commit.
* Called at most once during the commit phase.
*/
default void onFailedParse(Analysis analysis) throws Exception {}
/**
* Signals the completion of the commit diff extraction.
* Called exactly once during the commit phase before the patch phase begins.
Expand Down Expand Up @@ -316,7 +323,8 @@ public static void forSinglePatch(final String commitHash, final String fileName
final Hooks filterPatchHook = new Hooks() {
@Override
public boolean beginPatch(Analysis analysis) {
return fileName.equals(analysis.getCurrentPatch().getFileName());
return fileName.equals(analysis.getCurrentPatch().getFileName(Time.AFTER))
|| fileName.equals(analysis.getCurrentPatch().getFileName(Time.BEFORE));
}
};

Expand Down Expand Up @@ -496,6 +504,12 @@ protected void processCommit() throws Exception {

// report any errors that occurred and exit in case no VariationDiff could be parsed.
getResult().reportDiffErrors(commitDiffResult.errors());
if (!commitDiffResult.errors().isEmpty()) {
StringBuilder sb = new StringBuilder();
commitDiffResult.errors().forEach(e -> sb.append(e).append("\n"));
Logger.debug("found commit for which at least one patch could not be parsed because:\n{}", sb);
runHook(hooks.listIterator(), Hooks::onFailedParse);
}
if (commitDiffResult.diff().isEmpty()) {
Logger.debug("found commit that failed entirely because:\n{}", commitDiffResult.errors());
runHook(hooks.listIterator(), Hooks::onFailedCommit);
Expand All @@ -520,7 +534,7 @@ protected void processCommit() throws Exception {

processPatch();
} catch (Throwable t) {
Logger.error("error during {} {}", currentPatch.getFileName(), currentPatch.getCommitHash());
Logger.error("error during {} {}", currentPatch.getFileName(Time.AFTER), currentPatch.getCommitHash());
throw t;
} finally {
runReverseHook(patchHook, Hooks::endPatch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.variantsync.diffdetective.util.CSV;
import org.variantsync.diffdetective.util.FileUtils;
import org.variantsync.diffdetective.util.StringUtils;
import org.variantsync.diffdetective.variation.diff.Time;

public class EditClassOccurenceAnalysis implements Analysis.Hooks {
public static final String PATCH_STATISTICS_EXTENSION = ".patchStatistics.csv";
Expand Down Expand Up @@ -66,7 +67,7 @@ public boolean analyzeVariationDiff(Analysis analysis) throws IOException {
Stream.concat(
Stream.of(
analysis.getCurrentPatch().getCommitHash(),
analysis.getCurrentPatch().getFileName()
analysis.getCurrentPatch().getFileName(Time.AFTER)
),
editClassCounts.values().stream())
.map(Object::toString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ public void end() {

/**
* Appends the given linegraph string at the end of the given file.
* @param outputPath File to which the linegraph string should be appended.
* @param linegraph String to append to the given file.
*/
private void flush() {
try (var output = IO.newBufferedOutputStream(outputPath, StandardOpenOption.CREATE, StandardOpenOption.APPEND)) {
Expand Down
Loading