Skip to content

Commit

Permalink
Pushing ClassfileParser toward a new day.
Browse files Browse the repository at this point in the history
Removed JacoMetaATTR.

Removed MetaParser.
  • Loading branch information
paulp committed May 4, 2012
1 parent de5aaf4 commit 043ce6d
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 329 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ object ClassfileConstants {
} }
def methodFlags(jflags: Int): Long = { def methodFlags(jflags: Int): Long = {
initFields(jflags) initFields(jflags)
translateFlags(jflags, 0) translateFlags(jflags, if ((jflags & JAVA_ACC_BRIDGE) != 0) BRIDGE else 0)
} }
} }
object FlagTranslation extends FlagTranslation { } object FlagTranslation extends FlagTranslation { }
Expand Down
22 changes: 22 additions & 0 deletions src/compiler/scala/reflect/internal/JvmClassInfo.scala
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import scala.tools.nsc.io.{ Directory }
import scala.reflect.NameTransformer.decode import scala.reflect.NameTransformer.decode
import scala.tools.util.StringOps.trimTrailingSpace import scala.tools.util.StringOps.trimTrailingSpace
import ConstantPool._ import ConstantPool._
import ClassfileConstants._


abstract class JvmInfo(attributes: Array[JvmAttributeInfo]) { abstract class JvmInfo(attributes: Array[JvmAttributeInfo]) {
// def flags: Short // def flags: Short
Expand Down Expand Up @@ -78,6 +79,27 @@ class JvmMemberInfo(
val descriptor: String, val descriptor: String,
attributes: Array[JvmAttributeInfo] attributes: Array[JvmAttributeInfo]
) extends JvmInfo(attributes) { ) extends JvmInfo(attributes) {

final def isAbstract = (flags & JAVA_ACC_ABSTRACT) != 0
final def isAnnotated = (flags & JAVA_ACC_ANNOTATION) != 0
final def isFinal = (flags & JAVA_ACC_FINAL) != 0
final def isPrivate = (flags & JAVA_ACC_PRIVATE) != 0
final def isProtected = (flags & JAVA_ACC_PROTECTED) != 0
final def isPublic = (flags & JAVA_ACC_PUBLIC) != 0
final def isStatic = (flags & JAVA_ACC_STATIC) != 0
final def isSynthetic = (flags & JAVA_ACC_SYNTHETIC) != 0
final def isVarargs = (flags & JAVA_ACC_VARARGS) != 0

// method only
final def isBridge = (flags & JAVA_ACC_BRIDGE) != 0

// field only
final def isEnum = (flags & JAVA_ACC_ENUM) != 0
final def isTransient = (flags & JAVA_ACC_TRANSIENT) != 0

def isMethod = descriptor startsWith "(" // )
def isField = !isMethod
def scalaFlags = toScalaMethodFlags(flags)
def decodedName = decode(name) def decodedName = decode(name)
def hasSignature = signature != "" def hasSignature = signature != ""
def toErasedString = "%-30s %s".format(decodedName, descriptor) def toErasedString = "%-30s %s".format(decodedName, descriptor)
Expand Down
1 change: 0 additions & 1 deletion src/compiler/scala/reflect/internal/StdNames.scala
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ trait StdNames {
final val DeprecatedATTR: NameType = "Deprecated" final val DeprecatedATTR: NameType = "Deprecated"
final val ExceptionsATTR: NameType = "Exceptions" final val ExceptionsATTR: NameType = "Exceptions"
final val InnerClassesATTR: NameType = "InnerClasses" final val InnerClassesATTR: NameType = "InnerClasses"
final val JacoMetaATTR: NameType = "JacoMeta"
final val LineNumberTableATTR: NameType = "LineNumberTable" final val LineNumberTableATTR: NameType = "LineNumberTable"
final val LocalVariableTableATTR: NameType = "LocalVariableTable" final val LocalVariableTableATTR: NameType = "LocalVariableTable"
final val RuntimeAnnotationATTR: NameType = "RuntimeVisibleAnnotations" // RetentionPolicy.RUNTIME final val RuntimeAnnotationATTR: NameType = "RuntimeVisibleAnnotations" // RetentionPolicy.RUNTIME
Expand Down
Loading

0 comments on commit 043ce6d

Please sign in to comment.