Skip to content

Commit 51fa199

Browse files
committed
wip
1 parent dcb3cbb commit 51fa199

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbSignatures.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public final class SemanticdbSignatures {
1515
private final GlobalSymbolsCache cache;
1616
private final LocalSymbolsCache locals;
1717

18-
private static final Semanticdb.Type UnresolvedTypeRef =
18+
private static final Semanticdb.Type UNRESOLVED_TYPE_REF =
1919
Semanticdb.Type.newBuilder()
20-
.setTypeRef(TypeRef.newBuilder().setSymbol("[unresolved]"))
20+
.setTypeRef(TypeRef.newBuilder().setSymbol("unresolved_type#"))
2121
.build();
2222

2323
public SemanticdbSignatures(GlobalSymbolsCache cache, LocalSymbolsCache locals) {
@@ -46,14 +46,14 @@ private Signature generateClassSignature(Symbol.ClassSymbol sym) {
4646
if (sym.getSuperclass() != Type.noType) {
4747
Semanticdb.Type superType = generateType(sym.getSuperclass());
4848
if (superType == null) {
49-
superType = UnresolvedTypeRef;
49+
superType = UNRESOLVED_TYPE_REF;
5050
}
5151
builder.addParents(superType);
5252
}
5353
for (Type iType : sym.getInterfaces()) {
5454
Semanticdb.Type type = generateType(iType);
5555
if (type == null) {
56-
type = UnresolvedTypeRef;
56+
type = UNRESOLVED_TYPE_REF;
5757
}
5858
builder.addParents(type);
5959
}
@@ -85,7 +85,7 @@ private Signature generateMethodSignature(Symbol.MethodSymbol sym) {
8585
private Signature generateFieldSignature(Symbol.VarSymbol sym) {
8686
Semanticdb.Type generateType = generateType(sym.type);
8787
if (generateType == null) {
88-
generateType = UnresolvedTypeRef;
88+
generateType = UNRESOLVED_TYPE_REF;
8989
}
9090
return Signature.newBuilder()
9191
.setValueSignature(ValueSignature.newBuilder().setTpe(generateType))
@@ -99,7 +99,7 @@ private Signature generateTypeSignature(Symbol.TypeVariableSymbol sym) {
9999

100100
Semanticdb.Type upperBound = generateType(sym.type.getUpperBound());
101101
if (upperBound != null) builder.setUpperBound(upperBound);
102-
else builder.setUpperBound(UnresolvedTypeRef);
102+
else builder.setUpperBound(UNRESOLVED_TYPE_REF);
103103

104104
return Signature.newBuilder().setTypeSignature(builder).build();
105105
}
@@ -137,7 +137,7 @@ public Semanticdb.Type visitDeclared(DeclaredType t, Void unused) {
137137
for (TypeMirror type : t.getTypeArguments()) {
138138
Semanticdb.Type visited = super.visit(type);
139139
if (visited == null) {
140-
visited = UnresolvedTypeRef;
140+
visited = UNRESOLVED_TYPE_REF;
141141
}
142142
typeParams.add(visited);
143143

@@ -189,7 +189,7 @@ public Semanticdb.Type visitDeclared(DeclaredType t, Void unused) {
189189
public Semanticdb.Type visitArray(ArrayType t, Void unused) {
190190
Semanticdb.Type arrayComponentType = super.visit(t.getComponentType());
191191
if (arrayComponentType == null) {
192-
arrayComponentType = UnresolvedTypeRef;
192+
arrayComponentType = UNRESOLVED_TYPE_REF;
193193
}
194194
return Semanticdb.Type.newBuilder()
195195
.setTypeRef(

semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbVisitor.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import java.util.Iterator;
2222
import java.util.Optional;
2323

24-
import static com.sourcegraph.semanticdb_javac.Debugging.pprint;
25-
2624
/** Walks the AST of a typechecked compilation unit and generates a SemanticDB TextDocument. */
2725
public class SemanticdbVisitor extends TreePathScanner<Void, Void> {
2826

@@ -56,7 +54,6 @@ public SemanticdbVisitor(
5654
}
5755

5856
public Semanticdb.TextDocument buildTextDocument(CompilationUnitTree tree) {
59-
pprint(semanticdbUri());
6057
this.scan(tree, null); // Trigger recursive AST traversal to collect SemanticDB information.
6158

6259
return Semanticdb.TextDocument.newBuilder()

0 commit comments

Comments
 (0)