aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java10
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/batch/source/DeprecatedDefaultSymbolTable.java12
2 files changed, 22 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java
index 04c7f560e9e..a2a380c71e6 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java
@@ -41,6 +41,11 @@ public class DefaultSymbolizable implements Symbolizable {
}
@Override
+ public Symbol newSymbol(int startLine, int startLineOffset, int endLine, int endLineOffset) {
+ return NO_OP_SYMBOL;
+ }
+
+ @Override
public void newReference(Symbol symbol, int fromOffset) {
// Do nothing
}
@@ -51,6 +56,11 @@ public class DefaultSymbolizable implements Symbolizable {
}
@Override
+ public void newReference(Symbol symbol, int startLine, int startLineOffset, int endLine, int endLineOffset) {
+ // Do nothing
+ }
+
+ @Override
public SymbolTable build() {
return NO_OP_SYMBOL_TABLE;
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DeprecatedDefaultSymbolTable.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DeprecatedDefaultSymbolTable.java
index a902b017e8c..78ab4ec11ff 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DeprecatedDefaultSymbolTable.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/source/DeprecatedDefaultSymbolTable.java
@@ -60,6 +60,13 @@ public class DeprecatedDefaultSymbolTable implements Symbolizable.SymbolTable {
}
@Override
+ public Symbol newSymbol(int startLine, int startLineOffset, int endLine, int endLineOffset) {
+ // This is wrong in case of multiline symbol bu I assume references will be added using start and end offsets so length is useless.
+ int length = endLineOffset - startLineOffset;
+ return new DeprecatedDefaultSymbol(symbolTable.newSymbol(startLine, startLineOffset, endLine, endLineOffset), length);
+ }
+
+ @Override
public void newReference(Symbol symbol, int fromOffset) {
((DeprecatedDefaultSymbol) symbol).getWrapped().newReference(fromOffset, fromOffset + ((DeprecatedDefaultSymbol) symbol).getLength());
}
@@ -70,6 +77,11 @@ public class DeprecatedDefaultSymbolTable implements Symbolizable.SymbolTable {
}
@Override
+ public void newReference(Symbol symbol, int startLine, int startLineOffset, int endLine, int endLineOffset) {
+ ((DeprecatedDefaultSymbol) symbol).getWrapped().newReference(startLine, startLineOffset, endLine, endLineOffset);
+ }
+
+ @Override
public Symbolizable.SymbolTable build() {
return new DeprecatedDefaultSymbolTable(symbolTable);
}