Skip to content

Commit

Permalink
shortening Name-String-Name-String conversions to just Name-String
Browse files Browse the repository at this point in the history
  • Loading branch information
magarciaEPFL committed Mar 9, 2012
1 parent cd62f52 commit 02a1522
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/compiler/scala/reflect/internal/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,8 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
)
/** These should be moved somewhere like JavaPlatform.
*/
def javaSimpleName: String = addModuleSuffix(nme.dropLocalSuffix(simpleName)).toString
def javaBinaryName: String = addModuleSuffix(fullNameInternal('/')).toString
def javaSimpleName: Name = addModuleSuffix(nme.dropLocalSuffix(simpleName))
def javaBinaryName: Name = addModuleSuffix(fullNameInternal('/'))
def javaClassName: String = addModuleSuffix(fullNameInternal('.')).toString

/** The encoded full path name of this symbol, where outer names and inner names
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
val StringBuilderClassName = javaName(definitions.StringBuilderClass)
val BoxesRunTime = "scala.runtime.BoxesRunTime"

val StringBuilderType = new JObjectType(StringBuilderClassName)
val toStringType = new JMethodType(JAVA_LANG_STRING, JType.EMPTY_ARRAY)
val StringBuilderType = new JObjectType(StringBuilderClassName) // TODO use ASMType.getObjectType
val toStringType = new JMethodType(JAVA_LANG_STRING, JType.EMPTY_ARRAY) // TODO use ASMType.getMethodType
val arrayCloneType = new JMethodType(JAVA_LANG_OBJECT, JType.EMPTY_ARRAY)
val MethodTypeType = new JObjectType("java.dyn.MethodType")
val JavaLangClassType = new JObjectType("java.lang.Class")
Expand Down
10 changes: 4 additions & 6 deletions src/compiler/scala/tools/nsc/backend/jvm/GenJVMUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@ trait GenJVMUtil {
*/
def javaName(sym: Symbol): String =
javaNameCache.getOrElseUpdate(sym, {
sym.name.newName(
if (sym.isClass || (sym.isModule && !sym.isMethod))
sym.javaBinaryName
else
sym.javaSimpleName
)
if (sym.isClass || (sym.isModule && !sym.isMethod))
sym.javaBinaryName
else
sym.javaSimpleName
}).toString

def javaType(t: TypeKind): JType = (t: @unchecked) match {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/transform/Erasure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ abstract class Erasure extends AddInterfaces
// Anything which could conceivably be a module (i.e. isn't known to be
// a type parameter or similar) must go through here or the signature is
// likely to end up with Foo<T>.Empty where it needs Foo<T>.Empty$.
def fullNameInSig(sym: Symbol) = "L" + beforeIcode(sym.javaBinaryName)
def fullNameInSig(sym: Symbol) = "L" + beforeIcode(sym.javaBinaryName.toString)

def jsig(tp0: Type, existentiallyBound: List[Symbol] = Nil, toplevel: Boolean = false, primitiveOK: Boolean = true): String = {
val tp = tp0.dealias
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/typechecker/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ trait Macros { self: Analyzer =>
sym.fullName + suffix
case sym =>
val separator = if (sym.owner.isModuleClass) "" else "$"
recur(sym.owner) + separator + sym.javaSimpleName
recur(sym.owner) + separator + sym.javaSimpleName.toString
}

if (sym.isClass || sym.isModule) recur(sym)
Expand Down

0 comments on commit 02a1522

Please sign in to comment.