Skip to content

Commit

Permalink
Remove uses of the @bridge annotation in compiler.
Browse files Browse the repository at this point in the history
Because I can't remove the annotation until reSTARR
  • Loading branch information
hrhino committed Jan 17, 2018
1 parent 3545196 commit 1eb0fba
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/compiler/scala/tools/nsc/typechecker/Infer.scala
Expand Up @@ -58,7 +58,6 @@ trait Infer extends Checkable {
def improves(sym1: Symbol, sym2: Symbol) = (
(sym2 eq NoSymbol)
|| sym2.isError
|| (sym2 hasAnnotation BridgeClass)
|| isBetter(sym1, sym2)
)

Expand Down
5 changes: 2 additions & 3 deletions src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
Expand Up @@ -550,7 +550,7 @@ abstract class RefChecks extends Transform {
}

def checkOverrideDeprecated() {
if (other.hasDeprecatedOverridingAnnotation && !(member.hasDeprecatedOverridingAnnotation || member.ownerChain.exists(x => x.isDeprecated || x.hasBridgeAnnotation))) {
if (other.hasDeprecatedOverridingAnnotation && !(member.hasDeprecatedOverridingAnnotation || member.ownerChain.exists(_.isDeprecated))) {
val version = other.deprecatedOverridingVersion.getOrElse("")
val since = if (version.isEmpty) version else s" (since $version)"
val message = other.deprecatedOverridingMessage map (msg => s": $msg") getOrElse ""
Expand Down Expand Up @@ -1235,8 +1235,7 @@ abstract class RefChecks extends Transform {
private def checkUndesiredProperties(sym: Symbol, pos: Position) {
// If symbol is deprecated, and the point of reference is not enclosed
// in either a deprecated member or a scala bridge method, issue a warning.
// TODO: x.hasBridgeAnnotation doesn't seem to be needed here...
if (sym.isDeprecated && !currentOwner.ownerChain.exists(x => x.isDeprecated || x.hasBridgeAnnotation))
if (sym.isDeprecated && !currentOwner.ownerChain.exists(x => x.isDeprecated))
currentRun.reporting.deprecationWarning(pos, sym)

// Similar to deprecation: check if the symbol is marked with @migration
Expand Down
5 changes: 2 additions & 3 deletions src/compiler/scala/tools/nsc/typechecker/Typers.scala
Expand Up @@ -1751,7 +1751,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
val sameSourceFile = context.unit.source.file == psym.sourceFile

if (!isPastTyper && psym.hasDeprecatedInheritanceAnnotation &&
!sameSourceFile && !context.owner.ownerChain.exists(x => x.isDeprecated || x.hasBridgeAnnotation)) {
!sameSourceFile && !context.owner.ownerChain.exists(_.isDeprecated)) {
val version = psym.deprecatedInheritanceVersion.getOrElse("")
val since = if (version.isEmpty) version else s" (since $version)"
val message = psym.deprecatedInheritanceMessage.map(msg => s": $msg").getOrElse("")
Expand Down Expand Up @@ -3147,8 +3147,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
&& (inBlock || !(sym.isMethod || sym1.isMethod) || (sym.tpe matches sym1.tpe))
// default getters are defined twice when multiple overloads have defaults.
// The error for this is deferred until RefChecks.checkDefaultsInOverloaded
&& (!sym.isErroneous && !sym1.isErroneous && !sym.hasDefault &&
!sym.hasAnnotation(BridgeClass) && !sym1.hasAnnotation(BridgeClass))) {
&& !sym.isErroneous && !sym1.isErroneous && !sym.hasDefault) {
log("Double definition detected:\n " +
((sym.getClass, sym.info, sym.ownerChain)) + "\n " +
((sym1.getClass, sym1.info, sym1.ownerChain)))
Expand Down
1 change: 0 additions & 1 deletion src/reflect/scala/reflect/internal/Definitions.scala
Expand Up @@ -1119,7 +1119,6 @@ trait Definitions extends api.StandardDefinitions {
lazy val AnnotationRetentionPolicyAttr = requiredClass[java.lang.annotation.RetentionPolicy]

// Annotations
lazy val BridgeClass = requiredClass[scala.annotation.bridge]
lazy val ElidableMethodClass = requiredClass[scala.annotation.elidable]
lazy val ImplicitNotFoundClass = requiredClass[scala.annotation.implicitNotFound]
lazy val ImplicitAmbiguousClass = getClassIfDefined("scala.annotation.implicitAmbiguous")
Expand Down
1 change: 0 additions & 1 deletion src/reflect/scala/reflect/internal/Symbols.scala
Expand Up @@ -900,7 +900,6 @@ trait Symbols extends api.Symbols { self: SymbolTable =>

def isStrictFP = hasAnnotation(ScalaStrictFPAttr) || (enclClass hasAnnotation ScalaStrictFPAttr)
def isSerializable = info.baseClasses.exists(p => p == SerializableClass || p == JavaSerializableClass)
def hasBridgeAnnotation = hasAnnotation(BridgeClass)
def isDeprecated = hasAnnotation(DeprecatedAttr)
def deprecationMessage = getAnnotation(DeprecatedAttr) flatMap (_ stringArg 0)
def deprecationVersion = getAnnotation(DeprecatedAttr) flatMap (_ stringArg 1)
Expand Down
1 change: 0 additions & 1 deletion src/reflect/scala/reflect/runtime/JavaUniverseForce.scala
Expand Up @@ -378,7 +378,6 @@ trait JavaUniverseForce { self: runtime.JavaUniverse =>
definitions.StaticAnnotationClass
definitions.AnnotationRetentionAttr
definitions.AnnotationRetentionPolicyAttr
definitions.BridgeClass
definitions.ElidableMethodClass
definitions.ImplicitNotFoundClass
definitions.ImplicitAmbiguousClass
Expand Down

0 comments on commit 1eb0fba

Please sign in to comment.