Skip to content

Commit

Permalink
Fixed red code example from our sources. Mixing type parameters from …
Browse files Browse the repository at this point in the history
…Java with the same name.
  • Loading branch information
Alefas committed Jan 21, 2014
1 parent 3262e70 commit 410cf64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/org/jetbrains/plugins/scala/lang/psi/ScalaPsiUtil.scala
Expand Up @@ -740,7 +740,15 @@ object ScalaPsiUtil {
try {
elem match {
case tp: ScTypeParam => tp.getPsiElementId
case p: PsiTypeParameter => " in: Java" //Two parameters from Java can't be used with same name in same place
case p: PsiTypeParameter =>
val containingFile = Option(p.getContainingFile).map(_.getName).getOrElse("NoFile")
val containingClass =
(for {
owner <- Option(p.getOwner)
clazz <- Option(owner.getContainingClass)
name <- Option(clazz.getName)
} yield name).getOrElse("NoClass")
s" in:$containingFile:$containingClass" //Two parameters from Java can't be used with same name in same place
case _ =>
val containingFile: PsiFile = elem.getContainingFile
" in:" + (if (containingFile != null) containingFile.name else "NoFile") + ":" +
Expand Down
Expand Up @@ -31,7 +31,7 @@ trait ScTypeParam extends ScalaPsiElement with ScPolymorphicElement with PsiType
def typeParameterText: String

def getPsiElementId: String = {
" in:" + getContainingFileName + ":" + getOffsetInFile
s" in:$getContainingFileName:$getOffsetInFile"
}
}

Expand Down

0 comments on commit 410cf64

Please sign in to comment.