File tree Expand file tree Collapse file tree 5 files changed +24
-6
lines changed
scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb
semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac
semanticdb-java/src/main/java/com/sourcegraph/semanticdb_javac
minimized/src/main/java/minimized
snapshots/src/main/generated/tests/minimized/src/main/java/minimized Expand file tree Collapse file tree 5 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -470,6 +470,8 @@ private String formatTree(Tree tree) {
470
470
+ formatTree (tree .getAssignTree ().getRhs ());
471
471
} else if (tree .hasUnaryopTree ()) {
472
472
return formatUnaryOperation (tree .getUnaryopTree ());
473
+ } else if (tree .hasCastTree ()) {
474
+ return "FIX ME" ;
473
475
}
474
476
475
477
throw new IllegalArgumentException ("tree was of unexpected type " + tree );
Original file line number Diff line number Diff line change @@ -150,6 +150,11 @@ public static Semanticdb.Tree tree(Semanticdb.UnaryOperatorTree unaryOperatorTre
150
150
return Semanticdb .Tree .newBuilder ().setUnaryopTree (unaryOperatorTree ).build ();
151
151
}
152
152
153
+ public static Semanticdb .Tree tree (Semanticdb .CastTree castTree ) {
154
+ return Semanticdb .Tree .newBuilder ().setCastTree (castTree ).build ();
155
+ }
156
+
157
+
153
158
public static Semanticdb .UnaryOperatorTree unaryOpTree (
154
159
Semanticdb .UnaryOperator operator , Semanticdb .Tree rhs ) {
155
160
return Semanticdb .UnaryOperatorTree .newBuilder ().setOp (operator ).setTree (rhs ).build ();
Original file line number Diff line number Diff line change @@ -96,10 +96,11 @@ public Semanticdb.AnnotationTree annotationBuilder(AnnotationTree annotation) {
96
96
97
97
private TypeMirror getTreeType (Tree tree ) {
98
98
TreePath path = nodes .get (tree );
99
- System .out .println ("Path: " + path );
100
- Element sym = trees .getElement (path );
101
- System .out .println ("SYM: " + sym );
102
- return sym .asType ();
99
+ System .out .println ("Path: " + path .getLeaf ());
100
+ // System.out.println("TM:" + trees.getTypeMirror(path));
101
+ // Element sym = trees.getElement(path);
102
+ // System.out.println("SYM: " + sym);
103
+ return trees .getTypeMirror (path );
103
104
}
104
105
105
106
private Semanticdb .Tree annotationParameter (ExpressionTree expr ) {
@@ -164,14 +165,16 @@ private Semanticdb.Tree annotationParameter(ExpressionTree expr) {
164
165
} else if (expr instanceof TypeCastTree ) {
165
166
TypeCastTree tree = (TypeCastTree ) expr ;
166
167
System .out .println (typeVisitor .semanticdbType (getTreeType (tree .getType ())));
168
+ return tree (castTree (typeVisitor .semanticdbType (getTreeType (tree .getType ())), annotationParameter (tree .getExpression ())));
167
169
// tree.getType()
168
- }
170
+ } else {
169
171
throw new IllegalArgumentException (
170
172
semanticdbUri
171
173
+ ": annotation parameter rhs was of unexpected tree node type "
172
174
+ expr .getClass ()
173
175
+ "\n "
174
176
+ expr );
177
+ }
175
178
}
176
179
177
180
private Semanticdb .BinaryOperator semanticdbBinaryOperator (Tree .Kind kind ) {
Original file line number Diff line number Diff line change @@ -27,5 +27,5 @@ interface Foo {
27
27
Foo test4 ();
28
28
29
29
@ Bar ((double ) -1 )
30
- double test ();
30
+ double testCast ();
31
31
}
Original file line number Diff line number Diff line change @@ -80,4 +80,12 @@ interface Foo {
80
80
// display_name test4
81
81
// signature_documentation java @Nullable("what")\npublic abstract Foo test4()
82
82
// kind AbstractMethod
83
+
84
+ →@ Bar ((double ) -1 )
85
+ //^^^ reference semanticdb maven . . minimized/Bar#
86
+ →double testCast ();
87
+ // ^^^^^^^^ definition semanticdb maven . . minimized/Foo#testCast().
88
+ // display_name testCast
89
+ // signature_documentation java @Bar(FIX ME)\npublic abstract double testCast()
90
+ // kind AbstractMethod
83
91
}
You can’t perform that action at this time.
0 commit comments