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) {
470470 + formatTree (tree .getAssignTree ().getRhs ());
471471 } else if (tree .hasUnaryopTree ()) {
472472 return formatUnaryOperation (tree .getUnaryopTree ());
473+ } else if (tree .hasCastTree ()) {
474+ return "FIX ME" ;
473475 }
474476
475477 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
150150 return Semanticdb .Tree .newBuilder ().setUnaryopTree (unaryOperatorTree ).build ();
151151 }
152152
153+ public static Semanticdb .Tree tree (Semanticdb .CastTree castTree ) {
154+ return Semanticdb .Tree .newBuilder ().setCastTree (castTree ).build ();
155+ }
156+
157+
153158 public static Semanticdb .UnaryOperatorTree unaryOpTree (
154159 Semanticdb .UnaryOperator operator , Semanticdb .Tree rhs ) {
155160 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) {
9696
9797 private TypeMirror getTreeType (Tree tree ) {
9898 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 );
103104 }
104105
105106 private Semanticdb .Tree annotationParameter (ExpressionTree expr ) {
@@ -164,14 +165,16 @@ private Semanticdb.Tree annotationParameter(ExpressionTree expr) {
164165 } else if (expr instanceof TypeCastTree ) {
165166 TypeCastTree tree = (TypeCastTree ) expr ;
166167 System .out .println (typeVisitor .semanticdbType (getTreeType (tree .getType ())));
168+ return tree (castTree (typeVisitor .semanticdbType (getTreeType (tree .getType ())), annotationParameter (tree .getExpression ())));
167169// tree.getType()
168- }
170+ } else {
169171 throw new IllegalArgumentException (
170172 semanticdbUri
171173 + ": annotation parameter rhs was of unexpected tree node type "
172174 + expr .getClass ()
173175 + "\n "
174176 + expr );
177+ }
175178 }
176179
177180 private Semanticdb .BinaryOperator semanticdbBinaryOperator (Tree .Kind kind ) {
Original file line number Diff line number Diff line change @@ -27,5 +27,5 @@ interface Foo {
2727 Foo test4 ();
2828
2929 @ Bar ((double ) -1 )
30- double test ();
30+ double testCast ();
3131}
Original file line number Diff line number Diff line change @@ -80,4 +80,12 @@ interface Foo {
8080// display_name test4
8181// signature_documentation java @Nullable("what")\npublic abstract Foo test4()
8282// 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
8391}
You can’t perform that action at this time.
0 commit comments