diffparser
diffparser copied to clipboard
Parsing SVN Diff skips one class
I have a svn diff where parsing seems to miss the start of the second class.
Index: MyClass1.java
--- MyClass1.java (nonexistent) +++ MyClass1.java (working copy) @@ -0,0 +1,30 @@ +/*
- Copyright 2018 XXX
- All Rights Reserved
- */
+package com.xxx; + +/**
- */ +public class MyClass1 +{
- @Override
- public boolean equals(Object obj)
- {
- return super.equals(obj);
- }
- @Override
- public int hashCode()
- {
- return super.hashCode();
- }
- @Override
- public String toString()
- {
- return super.toString();
- } +} Index: MyClass2.java =================================================================== --- MyClass2.java (nonexistent) +++ MyClass2.java (working copy) @@ -0,0 +1,30 @@ +/*
- Copyright 2018 xxx
- All Rights Reserved
- */
+package com.xxx; + +/**
- */ +public class MyClass2 +{
- @Override
- public boolean equals(Object obj)
- {
- return super.equals(obj);
- }
- @Override
- public int hashCode()
- {
- return super.hashCode();
- }
- @Override
- public String toString()
- {
- return super.toString();
- } +}
When parsed the first hunk ends on the line:
+++ MyClass2.java (working copy)
Instead of the Index one.
MyClass2 is not returned from the parser.
Looks to be related to this assumption:
/** * The parser is in this state if it is currently parsing a line that is the delimiter between two Diffs. This line is always a new * line. */ END { @Override public ParserState nextState(ParseWindow window) { String line = window.getFocusLine(); logTransition(line, END, INITIAL); return INITIAL; }
In this case there's no end line between Diffs.