Make code in sbt.classfile private[sbt]

git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@908 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
dmharrah 2009-07-27 19:38:09 +00:00
parent 1c3b2a1de2
commit d44f771125
3 changed files with 7 additions and 7 deletions

View File

@ -7,7 +7,7 @@ import scala.collection.mutable
import mutable.{ArrayBuffer, Buffer} import mutable.{ArrayBuffer, Buffer}
import java.io.File import java.io.File
object Analyze private[sbt] object Analyze
{ {
def apply[T](basePath: Path, outputDirectory: Path, sources: Iterable[Path], roots: Iterable[Path], log: Logger) def apply[T](basePath: Path, outputDirectory: Path, sources: Iterable[Path], roots: Iterable[Path], log: Logger)
(allProducts: => scala.collection.Set[Path], analysis: AnalysisCallback, loader: ClassLoader) (allProducts: => scala.collection.Set[Path], analysis: AnalysisCallback, loader: ClassLoader)

View File

@ -6,7 +6,7 @@ package sbt.classfile
import Constants._ import Constants._
import java.io.File import java.io.File
trait ClassFile private[sbt] trait ClassFile
{ {
val majorVersion: Int val majorVersion: Int
val minorVersion: Int val minorVersion: Int
@ -24,26 +24,26 @@ trait ClassFile
def stringValue(a: AttributeInfo): String def stringValue(a: AttributeInfo): String
} }
final case class Constant(tag: Byte, nameIndex: Int, typeIndex: Int, value: Option[AnyRef]) extends NotNull private[sbt] final case class Constant(tag: Byte, nameIndex: Int, typeIndex: Int, value: Option[AnyRef]) extends NotNull
{ {
def this(tag: Byte, nameIndex: Int, typeIndex: Int) = this(tag, nameIndex, typeIndex, None) def this(tag: Byte, nameIndex: Int, typeIndex: Int) = this(tag, nameIndex, typeIndex, None)
def this(tag: Byte, nameIndex: Int) = this(tag, nameIndex, -1) def this(tag: Byte, nameIndex: Int) = this(tag, nameIndex, -1)
def this(tag: Byte, value: AnyRef) = this(tag, -1, -1, Some(value)) def this(tag: Byte, value: AnyRef) = this(tag, -1, -1, Some(value))
def wide = tag == ConstantLong || tag == ConstantDouble def wide = tag == ConstantLong || tag == ConstantDouble
} }
final case class FieldOrMethodInfo(accessFlags: Int, name: Option[String], descriptor: Option[String], attributes: RandomAccessSeq[AttributeInfo]) extends NotNull private[sbt] final case class FieldOrMethodInfo(accessFlags: Int, name: Option[String], descriptor: Option[String], attributes: RandomAccessSeq[AttributeInfo]) extends NotNull
{ {
def isStatic = (accessFlags&ACC_STATIC)== ACC_STATIC def isStatic = (accessFlags&ACC_STATIC)== ACC_STATIC
def isPublic = (accessFlags&ACC_PUBLIC)==ACC_PUBLIC def isPublic = (accessFlags&ACC_PUBLIC)==ACC_PUBLIC
def isMain = isPublic && isStatic && descriptor.filter(_ == "([Ljava/lang/String;)V").isDefined def isMain = isPublic && isStatic && descriptor.filter(_ == "([Ljava/lang/String;)V").isDefined
} }
final case class AttributeInfo(name: Option[String], value: Array[Byte]) extends NotNull private[sbt] final case class AttributeInfo(name: Option[String], value: Array[Byte]) extends NotNull
{ {
def isNamed(s: String) = name.filter(s == _).isDefined def isNamed(s: String) = name.filter(s == _).isDefined
def isSignature = isNamed("Signature") def isSignature = isNamed("Signature")
def isSourceFile = isNamed("SourceFile") def isSourceFile = isNamed("SourceFile")
} }
object Constants private[sbt] object Constants
{ {
final val ACC_STATIC = 0x0008 final val ACC_STATIC = 0x0008
final val ACC_PUBLIC = 0x0001 final val ACC_PUBLIC = 0x0001

View File

@ -12,7 +12,7 @@ import java.io.{DataInputStream, File, InputStream}
import Constants._ import Constants._
object Parser private[sbt] object Parser
{ {
def apply(file: File, log: Logger): ClassFile = FileUtilities.readStreamValue(file, log)(parse(file.getCanonicalPath, log)).right.get def apply(file: File, log: Logger): ClassFile = FileUtilities.readStreamValue(file, log)(parse(file.getCanonicalPath, log)).right.get
private def parse(fileName: String, log: Logger)(is: InputStream): Either[String, ClassFile] = Right(parseImpl(fileName, is, log)) private def parse(fileName: String, log: Logger)(is: InputStream): Either[String, ClassFile] = Right(parseImpl(fileName, is, log))