dcaoyuan / nbscala

NetBeans Plugin for Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaStubGenerator.dotCleanup overzealously replaces '.' with '$'

akochnev opened this issue · comments

This should be pretty easy to reproduce when opening up the latest source tree with the latest plugin version. In it, ScalaLanguage.java:103:106 is :
@OverRide
public Language getLexerLanguage() {
return ScalaTokenId.language();
}

.. and has an error highlight "The type of language() is erroneous". Making the IDE show the return type of ScalaTokenId.language() it shows as "Language<org$netbeans$api$lexer$TokenId> ". In actuality, it should be Language<org.netbeans.lexer.TokenId>

The culprit seems to be JavaStubGenerator.dotCleanup, invoked on JavaStubGenerator:496 inside of classSig function . Its own documentation states the following :
// Ensure every '.' in the generated signature immediately follows
// a close angle bracket '>'. Any which do not are replaced with '$'.
// This arises due to multiply nested classes in the face of the
// rewriting explained at rebindInnerClass. This should be done in a
// more rigorous way up front rather than catching it after the fact,
// but that will be more involved.

I'm not sure I fully understand the explanation above with the nested classes in result types, but in this case it seems to behave incorrectly as it encodes the periods parameter in the response type with dollar signs.