diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/GenericToken.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/GenericToken.java
index 9d4c4a6497..859cb1e1f8 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/GenericToken.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/GenericToken.java
@@ -22,15 +22,33 @@ public interface GenericToken {
*/
GenericToken getPreviousSpecialGenericToken();
- /**
- * Obtain the region where the token occupies in the source file.
- * @return the region
- */
- RegionByLine getRegionByLine();
-
/**
* Gets the token's text.
* @return the token's text
*/
String getImage();
+
+ /**
+ * Gets the line where the token's region begins
+ * @return a non-negative integer containing the begin line
+ */
+ int getBeginLine();
+
+ /**
+ * Gets the line where the token's region ends
+ * @return a non-negative integer containing the end line
+ */
+ int getEndLine();
+
+ /**
+ * Gets the column offset from the start of the begin line where the token's region begins
+ * @return a non-negative integer containing the begin column
+ */
+ int getBeginColumn();
+
+ /**
+ * Gets the column offset from the start of the end line where the token's region ends
+ * @return a non-negative integer containing the begin column
+ */
+ int getEndColumn();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/RegionByLine.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/RegionByLine.java
deleted file mode 100644
index e0418b3993..0000000000
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/RegionByLine.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.ast;
-
-/**
- * Represents a region in a source file bounded by a (beginLine, beginColumn) and (endLine, endColumn).
- */
-public interface RegionByLine {
-
- /**
- * Gets the line where the region begins
- * @return a non-negative integer containing the begin line
- */
- int getBeginLine();
-
- /**
- * Gets the line where the region ends
- * @return a non-negative integer containing the end line
- */
- int getEndLine();
-
- /**
- * Gets the column offset from the start of the begin line where the region begins
- * @return a non-negative integer containing the begin column
- */
- int getBeginColumn();
-
- /**
- * Gets the column offset from the start of the end line where the region ends
- * @return a non-negative integer containing the begin column
- */
- int getEndColumn();
-}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/RegionByLineImpl.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/RegionByLineImpl.java
deleted file mode 100644
index 190b8be540..0000000000
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/RegionByLineImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.ast;
-
-/**
- * Default immutable implementation for the RegionByLine interface which is used by {@link GenericToken}
- */
-public class RegionByLineImpl implements RegionByLine {
- private int beginLine;
- private int endLine;
- private int beginColumn;
- private int endColumn;
-
- /**
- * Create an immutable instance with all the corresponding fields. Every field requires to be non-negative
- * @param beginLine the line where the region begins
- * @param endLine the line where the region ends
- * @param beginColumn the column offset from the start of the begin line where the region begins
- * @param endColumn the column offset from the start of the end line where the region ends
- */
- public RegionByLineImpl(final int beginLine, final int endLine, final int beginColumn, final int endColumn) {
- setBeginLine(beginLine);
- setEndLine(endLine);
- setBeginColumn(beginColumn);
- setEndColumn(endColumn);
- }
-
- private void setBeginLine(final int beginLine) {
- this.beginLine = requireNonNegative(beginLine);
- }
-
- private void setEndLine(final int endLine) {
- this.endLine = requireNonNegative(endLine);
- }
-
- private void setBeginColumn(final int beginColumn) {
- this.beginColumn = requireNonNegative(beginColumn);
- }
-
- private void setEndColumn(final int endColumn) {
- this.endColumn = requireNonNegative(endColumn);
- }
-
- private int requireNonNegative(final int value) {
- if (value < 0) {
- throw new IllegalArgumentException("value = " + value + " must be non-negative");
- }
- return value;
- }
-
- @Override
- public int getBeginLine() {
- return beginLine;
- }
-
- @Override
- public int getEndLine() {
- return endLine;
- }
-
- @Override
- public int getBeginColumn() {
- return beginColumn;
- }
-
- @Override
- public int getEndColumn() {
- return endColumn;
- }
-}
diff --git a/pmd-cpp/src/main/ant/alljavacc.xml b/pmd-cpp/src/main/ant/alljavacc.xml
index de7a5f0955..6092c621e1 100644
--- a/pmd-cpp/src/main/ant/alljavacc.xml
+++ b/pmd-cpp/src/main/ant/alljavacc.xml
@@ -44,8 +44,6 @@
public class Token implements java.io.Serializable
@@ -65,15 +63,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
diff --git a/pmd-java/src/main/ant/alljavacc.xml b/pmd-java/src/main/ant/alljavacc.xml
index 2e6c73c31c..df3c24e40f 100644
--- a/pmd-java/src/main/ant/alljavacc.xml
+++ b/pmd-java/src/main/ant/alljavacc.xml
@@ -86,8 +86,6 @@ public class]]>
public class Token implements java.io.Serializable
@@ -107,15 +105,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
diff --git a/pmd-javascript/src/main/ant/alljavacc.xml b/pmd-javascript/src/main/ant/alljavacc.xml
index 1399f40f68..98266c3118 100644
--- a/pmd-javascript/src/main/ant/alljavacc.xml
+++ b/pmd-javascript/src/main/ant/alljavacc.xml
@@ -44,8 +44,6 @@
public class Token implements java.io.Serializable
@@ -65,15 +63,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
diff --git a/pmd-jsp/src/main/ant/alljavacc.xml b/pmd-jsp/src/main/ant/alljavacc.xml
index fb65d96335..677ed0ebeb 100644
--- a/pmd-jsp/src/main/ant/alljavacc.xml
+++ b/pmd-jsp/src/main/ant/alljavacc.xml
@@ -64,8 +64,6 @@ public class]]>
public class Token implements java.io.Serializable
@@ -85,15 +83,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
diff --git a/pmd-matlab/src/main/ant/alljavacc.xml b/pmd-matlab/src/main/ant/alljavacc.xml
index 76819e4e64..2841465fab 100644
--- a/pmd-matlab/src/main/ant/alljavacc.xml
+++ b/pmd-matlab/src/main/ant/alljavacc.xml
@@ -44,8 +44,6 @@
public class Token implements java.io.Serializable
@@ -65,15 +63,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
diff --git a/pmd-objectivec/src/main/ant/alljavacc.xml b/pmd-objectivec/src/main/ant/alljavacc.xml
index b2cddbfd39..60108b51e1 100644
--- a/pmd-objectivec/src/main/ant/alljavacc.xml
+++ b/pmd-objectivec/src/main/ant/alljavacc.xml
@@ -44,8 +44,6 @@
public class Token implements java.io.Serializable
@@ -65,15 +63,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
diff --git a/pmd-plsql/src/main/ant/alljavacc.xml b/pmd-plsql/src/main/ant/alljavacc.xml
index 62bcd25daa..e8eb9381cb 100644
--- a/pmd-plsql/src/main/ant/alljavacc.xml
+++ b/pmd-plsql/src/main/ant/alljavacc.xml
@@ -81,8 +81,6 @@ public class]]>
public class Token implements java.io.Serializable
@@ -102,15 +100,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
diff --git a/pmd-python/src/main/ant/alljavacc.xml b/pmd-python/src/main/ant/alljavacc.xml
index 4e1df8fd97..22cc3f93ac 100644
--- a/pmd-python/src/main/ant/alljavacc.xml
+++ b/pmd-python/src/main/ant/alljavacc.xml
@@ -44,8 +44,6 @@
public class Token implements java.io.Serializable
@@ -65,15 +63,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
diff --git a/pmd-visualforce/src/main/ant/alljavacc.xml b/pmd-visualforce/src/main/ant/alljavacc.xml
index 6bf811ea9d..f22d9bb72d 100644
--- a/pmd-visualforce/src/main/ant/alljavacc.xml
+++ b/pmd-visualforce/src/main/ant/alljavacc.xml
@@ -65,8 +65,6 @@ public class]]>
public class Token implements java.io.Serializable
@@ -86,14 +84,31 @@ public class Token implements GenericToken, java.io.Serializable]]>
+ public int getEndLine() {
+ return endLine;
+ }
+
+ @Override
+ public int getBeginColumn() {
+ return beginColumn;
+ }
+
+ @Override
+ public int getEndColumn() {
+ return endColumn;
+ }
+
+]]>
diff --git a/pmd-vm/src/main/ant/alljavacc.xml b/pmd-vm/src/main/ant/alljavacc.xml
index 2878476951..9a144d8703 100644
--- a/pmd-vm/src/main/ant/alljavacc.xml
+++ b/pmd-vm/src/main/ant/alljavacc.xml
@@ -77,8 +77,6 @@ public class]]>
public class Token implements java.io.Serializable
@@ -98,15 +96,31 @@ public class Token implements GenericToken, java.io.Serializable]]>