diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-07-01 15:53:42 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-08-19 17:52:20 +0200 |
commit | c3752d710eff34e348580bc093821a0a8170a325 (patch) | |
tree | 4048007b74bbcb4f377e3ead9cf4bb6694e04277 | |
parent | f73f026bf250e6eb3c22c2b1975d4fdc2f23eab6 (diff) | |
download | scala-c3752d710eff34e348580bc093821a0a8170a325.tar.gz scala-c3752d710eff34e348580bc093821a0a8170a325.tar.bz2 scala-c3752d710eff34e348580bc093821a0a8170a325.zip |
Add the ACC_DEPRECATED flag in javaFlags, instead of each call site.
3 files changed, 9 insertions, 25 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala index e61be7411b..5992a55ffa 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala @@ -923,10 +923,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters { innerClassBufferASM.clear() - val flags = GenBCode.mkFlags( - javaFlags(cls), - if (isDeprecated(cls)) asm.Opcodes.ACC_DEPRECATED else 0 // ASM pseudo access flag - ) + val flags = javaFlags(cls) val beanInfoName = (internalName(cls) + "BeanInfo") val beanInfoClass = new asm.tree.ClassNode diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala index 4639904145..35a9962620 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala @@ -141,10 +141,7 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { classBType.internalName } - val flags = GenBCode.mkFlags( - javaFlags(claszSymbol), - if (isDeprecated(claszSymbol)) asm.Opcodes.ACC_DEPRECATED else 0 // ASM pseudo access flag - ) + val flags = javaFlags(claszSymbol) val thisSignature = getGenericSignature(claszSymbol, claszSymbol.owner) cnode.visit(classfileVersion, flags, @@ -245,10 +242,7 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { */ for (f <- fieldSymbols(claszSymbol)) { val javagensig = getGenericSignature(f, claszSymbol) - val flags = GenBCode.mkFlags( - javaFieldFlags(f), - if (isDeprecated(f)) asm.Opcodes.ACC_DEPRECATED else 0 // ASM pseudo access flag - ) + val flags = javaFieldFlags(f) val jfield = new asm.tree.FieldNode( flags, @@ -571,8 +565,7 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { javaFlags(methSymbol), if (claszSymbol.isInterface) asm.Opcodes.ACC_ABSTRACT else 0, if (methSymbol.isStrictFP) asm.Opcodes.ACC_STRICT else 0, - if (isNative) asm.Opcodes.ACC_NATIVE else 0, // native methods of objects are generated in mirror classes - if (isDeprecated(methSymbol)) asm.Opcodes.ACC_DEPRECATED else 0 // ASM pseudo access flag + if (isNative) asm.Opcodes.ACC_NATIVE else 0 // native methods of objects are generated in mirror classes ) // TODO needed? for(ann <- m.symbol.annotations) { ann.symbol.initialize } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala index 4043ed47b6..783c9c56a1 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala @@ -106,10 +106,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes with CoreBTyp val interfaces = getSuperInterfaces(classSym).map(classBTypeFromSymbol) - val flags = GenBCode.mkFlags( - javaFlags(classSym), - if (isDeprecated(classSym)) asm.Opcodes.ACC_DEPRECATED else 0 // ASM pseudo access flag - ) + val flags = javaFlags(classSym) def classOrModuleClass(sym: Symbol): Symbol = { if (sym.isClass) sym @@ -286,8 +283,6 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes with CoreBTyp } } - final def isDeprecated(sym: Symbol): Boolean = sym.annotations exists (_ matches DeprecatedAttr) - // legacy, to be removed when the @remote annotation gets removed final def isRemote(s: Symbol) = (s hasAnnotation definitions.RemoteAttr) final def hasPublicBitSet(flags: Int) = ((flags & asm.Opcodes.ACC_PUBLIC) != 0) @@ -304,6 +299,8 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes with CoreBTyp * for methods: * - the same as for fields, plus: * - abstract, synchronized (not used), strictfp (not used), native (not used) + * for all: + * - deprecated * * (*) protected cannot be used, since inner classes 'see' protected members, * and they would fail verification after lifted. @@ -366,12 +363,9 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes with CoreBTyp if (sym.isClass && !sym.isInterface) ACC_SUPER else 0, if (sym.hasEnumFlag) ACC_ENUM else 0, if (sym.isVarargsMethod) ACC_VARARGS else 0, - if (sym.hasFlag(symtab.Flags.SYNCHRONIZED)) ACC_SYNCHRONIZED else 0 + if (sym.hasFlag(symtab.Flags.SYNCHRONIZED)) ACC_SYNCHRONIZED else 0, + if (sym.isDeprecated) asm.Opcodes.ACC_DEPRECATED else 0 ) - // TODO @lry should probably also check / add "deprectated" - // all call sites of "javaFlags" seem to check for deprecation rigth after. - // Exception: the call below in javaFieldFlags. However, the caller of javaFieldFlags then - // does the check. } def javaFieldFlags(sym: Symbol) = { |