Skip to content

Commit ee290b5

Browse files
committed
Link Java identifiers of length=1 per Lubos
1 parent 8fb299c commit ee290b5

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/org/opensolaris/opengrok/analysis/java/JavaXref.lex

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,7 @@ ParamName = {Identifier} | "<" {Identifier} ">"
7676

7777
{Identifier} {
7878
String id = yytext();
79-
// For historical reasons, JavaXref does not link identifiers of length=1
80-
if (id.length() > 1) {
81-
writeSymbol(id, Consts.kwd, yyline);
82-
} else {
83-
out.write(id);
84-
}
79+
writeSymbol(id, Consts.kwd, yyline);
8580
}
8681

8782
"<" ({File}|{FPath}) ">" {

test/org/opensolaris/opengrok/analysis/java/sample_xref.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
<a class="l" name="35" href="#35">35</a><span class='fold-space'>&nbsp;</span>
4444
<a class="l" name="36" href="#36">36</a><span class='fold-space'>&nbsp;</span> <a class="d intelliWindow-symbol" href="#res" data-definition-place="defined-in-file">res</a> += <a class="d intelliWindow-symbol" href="#arg" data-definition-place="defined-in-file">arg</a>&#59;
4545
<a class="l" name="37" href="#37">37</a><span class='fold-space'>&nbsp;</span>
46-
<a class="l" name="38" href="#38">38</a><span class='fold-space'>&nbsp;</span> <a class="d intelliWindow-symbol" href="#InnerClass" data-definition-place="defined-in-file">InnerClass</a> i = <b>new</b> <a class="d intelliWindow-symbol" href="#InnerClass" data-definition-place="defined-in-file">InnerClass</a>()&#59;
46+
<a class="l" name="38" href="#38">38</a><span class='fold-space'>&nbsp;</span> <a class="d intelliWindow-symbol" href="#InnerClass" data-definition-place="defined-in-file">InnerClass</a> <a class="xl" name="i"/><a href="/source/s?refs=i" class="xl intelliWindow-symbol" data-definition-place="def">i</a> = <b>new</b> <a class="d intelliWindow-symbol" href="#InnerClass" data-definition-place="defined-in-file">InnerClass</a>()&#59;
4747
<a class="l" name="39" href="#39">39</a><span class='fold-space'>&nbsp;</span>
48-
<a class="hl" name="40" href="#40">40</a><span class='fold-space'>&nbsp;</span> <b>return</b> i.<a class="d intelliWindow-symbol" href="#InnerMethod" data-definition-place="defined-in-file">InnerMethod</a>().<a href="/source/s?defs=length" class="intelliWindow-symbol" data-definition-place="undefined-in-file">length</a>() * <a class="d intelliWindow-symbol" href="#res" data-definition-place="defined-in-file">res</a>&#59;
48+
<a class="hl" name="40" href="#40">40</a><span class='fold-space'>&nbsp;</span> <b>return</b> <a class="d intelliWindow-symbol" href="#i" data-definition-place="defined-in-file">i</a>.<a class="d intelliWindow-symbol" href="#InnerMethod" data-definition-place="defined-in-file">InnerMethod</a>().<a href="/source/s?defs=length" class="intelliWindow-symbol" data-definition-place="undefined-in-file">length</a>() * <a class="d intelliWindow-symbol" href="#res" data-definition-place="defined-in-file">res</a>&#59;
4949
<a class="l" name="41" href="#41">41</a><span class='fold-space'>&nbsp;</span> &#125;
5050
</span><a class="l" name="42" href="#42">42</a><span class='fold-space'>&nbsp;</span>
5151
<span id='scope_id_bedfb0c0' class='scope-head'><span class='scope-signature'>AbstractMethod(int test)</span><a class="l" name="43" href="#43">43</a><a style='cursor:pointer;' onclick='fold(this.parentNode.id)' id='scope_id_bedfb0c0_fold_icon'><span class='fold-icon'>&nbsp;</span></a> <b>public</b> <b>int</b> <a class="xmt" name="AbstractMethod"/><a href="/source/s?refs=AbstractMethod" class="xmt intelliWindow-symbol" data-definition-place="def">AbstractMethod</a>(<b>int</b> <a class="xa" name="test"/><a href="/source/s?refs=test" class="xa intelliWindow-symbol" data-definition-place="def">test</a>) &#123;</span>
@@ -74,7 +74,7 @@
7474
<a class="l" name="66" href="#66">66</a><span class='fold-space'>&nbsp;</span> <a class="d intelliWindow-symbol" href="#num1" data-definition-place="defined-in-file">num1</a> = <span class="n">0</span>&#59;
7575
<a class="l" name="67" href="#67">67</a><span class='fold-space'>&nbsp;</span> <a class="d intelliWindow-symbol" href="#num2" data-definition-place="defined-in-file">num2</a> = <span class="n">62</span> * <span class="n">0xFFFF</span> / <a class="d intelliWindow-symbol" href="#num1" data-definition-place="defined-in-file">num1</a>&#59;
7676
<a class="l" name="68" href="#68">68</a><span class='fold-space'>&nbsp;</span> <a href="/source/s?defs=System" class="intelliWindow-symbol" data-definition-place="undefined-in-file">System</a>.<a href="/source/s?defs=out" class="intelliWindow-symbol" data-definition-place="undefined-in-file">out</a>.<a href="/source/s?defs=println" class="intelliWindow-symbol" data-definition-place="undefined-in-file">println</a>(<span class="s">&quot;Try block message&quot;</span>)&#59;
77-
<a class="l" name="69" href="#69">69</a><span class='fold-space'>&nbsp;</span> &#125; <b>catch</b> (<a href="/source/s?defs=ArithmeticException" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ArithmeticException</a> e) &#123;
77+
<a class="l" name="69" href="#69">69</a><span class='fold-space'>&nbsp;</span> &#125; <b>catch</b> (<a href="/source/s?defs=ArithmeticException" class="intelliWindow-symbol" data-definition-place="undefined-in-file">ArithmeticException</a> <a href="/source/s?defs=e" class="intelliWindow-symbol" data-definition-place="undefined-in-file">e</a>) &#123;
7878
<a class="hl" name="70" href="#70">70</a><span class='fold-space'>&nbsp;</span> <span class="c">// This block is to catch divide-by-zero error</span>
7979
<a class="l" name="71" href="#71">71</a><span class='fold-space'>&nbsp;</span> <a href="/source/s?defs=System" class="intelliWindow-symbol" data-definition-place="undefined-in-file">System</a>.<a href="/source/s?defs=out" class="intelliWindow-symbol" data-definition-place="undefined-in-file">out</a>.<a href="/source/s?defs=println" class="intelliWindow-symbol" data-definition-place="undefined-in-file">println</a>(<span class="s">&quot;Error: Don&apos;t divide a number by zero&quot;</span>)&#59;
8080
<a class="l" name="72" href="#72">72</a><span class='fold-space'>&nbsp;</span> &#125;

0 commit comments

Comments
 (0)