Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Whitespace normalization.

Normalized the repos, otherwise my patches will be sprinkled
with whitespace noise.
  • Loading branch information...
commit 94e26c985d4eea571828fecf8187fa7aa04e8235 1 parent c500876
Paul Phillips authored
Showing with 931 additions and 932 deletions.
  1. +11 −11 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/MimaMenuBar.scala
  2. +4 −4 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/MimaSwingApp.scala
  3. +2 −2 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/UncaughtExceptionHandlerDialog.scala
  4. +9 −9 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/WithConstraints.scala
  5. +1 −1  core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/event/ExitMiMa.scala
  6. +1 −2  core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/BugReportDialog.scala
  7. +3 −3 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/ClassPathEditor.scala
  8. +1 −1  core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/CloseButton.scala
  9. +1 −1  core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/FilePicker.scala
  10. +2 −2 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/HtmlViewPane.scala
  11. +6 −6 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/ListItemsPanel.scala
  12. +3 −3 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/LoadingPanel.scala
  13. +3 −3 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/NavigationPanel.scala
  14. +7 −7 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/wizard/Wizard.scala
  15. +2 −2 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/wizard/WizardPage.scala
  16. +5 −5 core-ui/src/main/scala/com/typesafe/tools/mima/core/util/log/UiLogger.scala
  17. +1 −1  core-ui/src/test/scala/com/typesafe/tools/mima/core/util/BrowseSpec.scala
  18. +1 −1  core/src/main/scala/com/typesafe/tools/mima/core/BufferReader.scala
  19. +283 −283 core/src/main/scala/com/typesafe/tools/mima/core/ClassInfo.scala
  20. +17 −17 core/src/main/scala/com/typesafe/tools/mima/core/ClassfileParser.scala
  21. +67 −67 core/src/main/scala/com/typesafe/tools/mima/core/Config.scala
  22. +16 −16 core/src/main/scala/com/typesafe/tools/mima/core/Definitions.scala
  23. +86 −86 core/src/main/scala/com/typesafe/tools/mima/core/MemberInfo.scala
  24. +18 −18 core/src/main/scala/com/typesafe/tools/mima/core/Members.scala
  25. +101 −101 core/src/main/scala/com/typesafe/tools/mima/core/PackageInfo.scala
  26. +11 −11 core/src/main/scala/com/typesafe/tools/mima/core/PathResolver.scala
  27. +4 −4 core/src/main/scala/com/typesafe/tools/mima/core/Reference.scala
  28. +12 −12 core/src/main/scala/com/typesafe/tools/mima/core/Settings.scala
  29. +54 −54 core/src/main/scala/com/typesafe/tools/mima/core/Type.scala
  30. +1 −1  core/src/main/scala/com/typesafe/tools/mima/core/WithAccessFlags.scala
  31. +4 −4 core/src/main/scala/com/typesafe/tools/mima/core/WithAccessModifier.scala
  32. +3 −3 core/src/main/scala/com/typesafe/tools/mima/core/WithLocalModifier.scala
  33. +19 −19 core/src/main/scala/com/typesafe/tools/mima/core/util/IndentedOutput.scala
  34. +1 −1  core/src/main/scala/com/typesafe/tools/mima/core/util/Urls.scala
  35. +1 −1  core/src/main/scala/com/typesafe/tools/mima/core/util/log/Logging.scala
  36. +13 −13 project/Build.scala
  37. +2 −2 reporter-ui/src/main/scala/com/typesafe/tools/mima/lib/ui/LibWizard.scala
  38. +7 −7 reporter-ui/src/main/scala/com/typesafe/tools/mima/lib/ui/MimaLibApp.scala
  39. +2 −2 reporter-ui/src/main/scala/com/typesafe/tools/mima/lib/ui/model/ReportTableModel.scala
  40. +2 −2 reporter-ui/src/main/scala/com/typesafe/tools/mima/lib/ui/widget/ProblemInfoView.scala
  41. +4 −4 reporter-ui/src/main/scala/com/typesafe/tools/mima/lib/ui/widget/ReportTable.scala
  42. +1 −1  reporter/functional-tests/src/main/scala/com/typesafe/tools/mima/lib/CollectProblemsTest.scala
  43. +1 −1  reporter/functional-tests/src/test/class-added-same-class-in-different-package-is-ok/v2/A.scala
  44. +1 −1  reporter/functional-tests/src/test/class-removed-superclass-nok/v1/A.scala
  45. +1 −1  reporter/functional-tests/src/test/eager-field-becomes-eager-lazy-nok-semantic/v1/Lazy.scala
  46. +1 −1  reporter/functional-tests/src/test/eager-field-becomes-eager-lazy-nok-semantic/v2/Lazy.scala
  47. +1 −1  reporter/functional-tests/src/test/lazy-field-becomes-eager-ok/v1/Lazy.scala
  48. +1 −1  reporter/functional-tests/src/test/lazy-field-becomes-eager-ok/v2/Lazy.scala
  49. +1 −1  reporter/functional-tests/src/test/moving-method-upward-from-trait-to-class-nok/v2/A.scala
  50. +9 −9 reporter/src/main/scala/com/typesafe/tools/mima/cli/Main.scala
  51. +87 −87 reporter/src/main/scala/com/typesafe/tools/mima/lib/MiMaLib.scala
  52. +8 −8 reporter/src/main/scala/com/typesafe/tools/mima/lib/analyze/Analyzer.scala
  53. +3 −3 reporter/src/main/scala/com/typesafe/tools/mima/lib/analyze/Checker.scala
  54. +2 −2 reporter/src/main/scala/com/typesafe/tools/mima/lib/analyze/field/FieldChecker.scala
  55. +4 −4 reporter/src/main/scala/com/typesafe/tools/mima/lib/analyze/method/MethodChecker.scala
  56. +1 −1  reporter/src/main/scala/com/typesafe/tools/mima/lib/analyze/method/MethodRules.scala
  57. +7 −7 reporter/src/main/scala/com/typesafe/tools/mima/lib/analyze/template/TemplateChecker.scala
  58. +11 −11 reporter/src/main/scala/com/typesafe/tools/mima/lib/analyze/template/TemplateRules.scala
View
22 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/MimaMenuBar.scala
@@ -14,38 +14,38 @@ object MimaMenuBar extends MenuBar {
val file = new Menu("File") {
mnemonic = Key.F
}
-
+
contents += file
-
+
val exit = new MenuItem(new Action("Exit") {
def apply() = publish(ExitMiMa)
}) {
mnemonic = Key.E
}
-
+
file.contents += exit
-
-
+
+
// File menu
val help = new Menu("Help") {
mnemonic = Key.H
}
-
+
contents += help
-
+
val guide = new MenuItem(new Action("Online resources") {
def apply() = Browse to OnlineResourceSite
}) {
mnemonic = Key.T
}
-
+
val bug = new MenuItem(new Action("Report a bug...") {
def apply() = Browse to BugReportingSite
}) {
mnemonic = Key.R
}
-
+
help.contents += (guide, bug)
-
-
+
+
}
View
8 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/MimaSwingApp.scala
@@ -10,15 +10,15 @@ import com.typesafe.tools.mima.core.util.WithUncaughtExceptionHandlerDialog
trait MimaSwingApp extends SimpleSwingApplication with WithUncaughtExceptionHandlerDialog {
- var resargs: List[String] = Nil
-
+ var resargs: List[String] = Nil
+
override def startup(args: Array[String]) {
resargs = Config.setup("scala " + launcherClassName +" <old-dir> <new-dir>", args, "-fixall")
super.startup(args)
}
protected def launcherClassName: String
-
-
+
+
override def top: Frame
}
View
4 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/UncaughtExceptionHandlerDialog.scala
@@ -20,7 +20,7 @@ trait WithUncaughtExceptionHandlerDialog {
/** Default exception handler */
protected val handler: Thread.UncaughtExceptionHandler = new UncaughtExceptionHandlerDialog()
-
- // setting the handler (assumes it is set only once, here - no way to enforce this though)
+
+ // setting the handler (assumes it is set only once, here - no way to enforce this though)
Thread.setDefaultUncaughtExceptionHandler(handler)
}
View
18 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/WithConstraints.scala
@@ -12,21 +12,21 @@ trait WithConstraints extends GridBagPanel {
/** Convenience method for creating and adding components to a GridBagPanel.
* It has reasonable defaults for all parameters.
*/
- def withConstraints[T](gridx: Int = RELATIVE,
- gridy: Int = RELATIVE,
+ def withConstraints[T](gridx: Int = RELATIVE,
+ gridy: Int = RELATIVE,
gridwidth: Int = 1,
- gridheight: Int = 1,
+ gridheight: Int = 1,
weightx: Double = 0.0,
- weighty: Double = 0.0,
+ weighty: Double = 0.0,
anchor: Anchor.Value = Anchor.NorthWest,
fill: Fill.Value = Fill.None,
- insets: Insets = new Insets(0, 0, 0, 0),
+ insets: Insets = new Insets(0, 0, 0, 0),
ipadx: Int = 0,
ipady: Int = 0)(op: Constraints => T) = {
- val c = new Constraints(gridx, gridy,
- gridwidth, gridheight,
- weightx, weighty,
- anchor.id, fill.id, insets,
+ val c = new Constraints(gridx, gridy,
+ gridwidth, gridheight,
+ weightx, weighty,
+ anchor.id, fill.id, insets,
ipadx, ipady)
op(c)
}
View
2  core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/event/ExitMiMa.scala
@@ -2,5 +2,5 @@ package com.typesafe.tools.mima.core.ui.event
import scala.swing.event.Event
-/** Event sent to request application's shut down.*/
+/** Event sent to request application's shut down.*/
object ExitMiMa extends Event
View
3  core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/BugReportDialog.scala
@@ -71,8 +71,7 @@ class BugReportDialog(error: Throwable, owner: Window = null) extends Dialog(own
location = center
modal = true
- resizable = false
+ resizable = false
pack()
visible = true
}
-
View
6 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/ClassPathEditor.scala
@@ -25,18 +25,18 @@ class ClassPathEditor(init: List[String] = Nil) extends GridBagPanel with WithCo
def classpath_=(_classpath: List[String]) = listView.listData = _classpath
def classpath = listView.listData
-
+
/** Return the string of current classpath in this editor. */
def classPathString = {
ClassPath.join(listView.listData: _*)
}
-
+
private val listView = new ListView(elements.toList) {
border = LineBorder(Color.gray)
selection.intervalMode = ListView.IntervalMode.SingleInterval
listenTo(mouse.moves)
-
+
reactions += {
case MouseMoved(_, point, _) =>
val index = peer.locationToIndex(point)
View
2  core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/CloseButton.scala
@@ -5,7 +5,7 @@ import scala.swing.Swing.EmptyBorder
import com.typesafe.tools.mima.core.ui.images
-/** A close button displayed as an icon. When the mouse is over
+/** A close button displayed as an icon. When the mouse is over
* the image a hand cursor is shown.*/
class CloseButton extends Button {
icon = images.Icons.close
View
2  core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/FilePicker.scala
@@ -73,6 +73,6 @@ class FilePicker(private val label: Label, owner: Component, private var _select
private def notifiyFileSelectedChanged() {
publish(FileChanged(FilePicker.this, selectedFile.get))
}
-
+
def selectedFile: Option[File] = _selectedFile
}
View
4 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/HtmlViewPane.scala
@@ -13,7 +13,7 @@ import com.typesafe.tools.mima.core.util.Browse
class HtmlViewPane extends Component {
override lazy val peer = componee
-
+
private lazy val componee = new JEditorPane(new HTMLEditorKit().getContentType(), "") {
private val defaultLabelFont = UIManager.getFont("Label.font")
/**
@@ -36,6 +36,6 @@ class HtmlViewPane extends Component {
}
})
}
-
+
def setHtml(html: String) = componee.setText(html)
}
View
12 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/ListItemsPanel.scala
@@ -6,7 +6,7 @@ import scala.swing.event.ButtonClicked
import com.typesafe.tools.mima.core.ui.images
abstract class ListItemsPanel extends Component {
-
+
private val MaxNumberOfItems = 10
type Item <: Component
@@ -52,7 +52,7 @@ abstract class ListItemsPanel extends Component {
override lazy val peer: javax.swing.JComponent = view.peer
final protected def addConstraint() {
- val newRow = new Row(create()) {
+ val newRow = new Row(create()) {
remove.visible = false
}
if(view.contents.nonEmpty) {
@@ -66,12 +66,12 @@ abstract class ListItemsPanel extends Component {
view -= r
view.contents.last.asInstanceOf[Row].remove.visible = false
}
-
-
+
+
private def updateView() {
- add.enabled = (view.contents.size < MaxNumberOfItems)
-
+ add.enabled = (view.contents.size < MaxNumberOfItems)
+
repaint()
revalidate()
}
View
6 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/LoadingPanel.scala
@@ -31,8 +31,8 @@ class LoadingPanel extends JComponent with MouseListener {
private var barsCount = 14
private var fps = 15.0f
- private var hints: RenderingHints = null
-
+ private var hints: RenderingHints = null
+
def this(text: String = "", barsCount: Int = 14, shield: Float = 0.0f, fps: Float = 15.0f, rampDelay: Int = 300) =
{
this()
@@ -119,7 +119,7 @@ class LoadingPanel extends JComponent with MouseListener {
{
val width = getWidth()
val height = getHeight()
-
+
val ticker = Array.ofDim[Area](barsCount)
val hwidth = width.asInstanceOf[Double] / 2
val hheight = height.asInstanceOf[Double] / 2
View
6 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/widget/NavigationPanel.scala
@@ -5,12 +5,12 @@ import event._
/** Simple navigation panel that exposes its three buttons: next, back and exit*/
class NavigationPanel extends BoxPanel(Orientation.Horizontal) {
-
+
val back = new Button("Back")
val next = new Button("Next")
val exit = new Button("Quit")
-
+
contents += Swing.HGlue
contents += (back, next, Swing.HStrut(20), exit)
-
+
}
View
14 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/wizard/Wizard.scala
@@ -32,7 +32,7 @@ class Wizard extends BorderPanel {
def apply(_page: => WizardPage) = new WizardPageProxy { override def page = _page }
}
private[Wizard] abstract class WizardPageProxy {
- private var cached: Option[WizardPage] = None
+ private var cached: Option[WizardPage] = None
def clear() = cached = None
protected def page: WizardPage
def get = cached match {
@@ -42,13 +42,13 @@ class Wizard extends BorderPanel {
case Some(page) => page
}
}
-
+
private class LoadingPanel extends BorderPanel {
private val loading = new com.typesafe.tools.mima.core.ui.widget.LoadingPanel("")
private val wrapper = Component.wrap(loading)
add(wrapper, BorderPanel.Position.Center)
add(com.typesafe.tools.mima.core.util.log.UiLogger, BorderPanel.Position.South)
-
+
def start() = loading.start()
}
@@ -155,9 +155,9 @@ class Wizard extends BorderPanel {
buttonsPanel.visible = false
val loading = new LoadingPanel()
setContent(loading)
- // delaying start so that `setContent` will trigger
- // component's `repaint` which will update the loading
- // panel's size. The size is needed to correctly center
+ // delaying start so that `setContent` will trigger
+ // component's `repaint` which will update the loading
+ // panel's size. The size is needed to correctly center
// the loading animation.
Swing onEDT { loading.start() }
}
@@ -175,7 +175,7 @@ class Wizard extends BorderPanel {
private def currentPage = _currentPage
private var _currentPage = 0
-
+
// the bottom section where the navigation buttons are
private val navigation = new NavigationPanel
View
4 core-ui/src/main/scala/com/typesafe/tools/mima/core/ui/wizard/WizardPage.scala
@@ -6,7 +6,7 @@ object WizardPage {
import scala.swing.event.Event
/** used to inform `Wizard` whether forward navigation is `allowed`. */
case class CanGoNext(allowed: Boolean) extends Event
-
+
trait Model {
/** model is backed by a mutable map. */
protected val data = collection.mutable.Map.empty[String, Any]
@@ -25,7 +25,7 @@ trait WizardPage extends Component {
/** is forward navigation enabled. */
def canNavigateForward = true
-
+
/** is Back navigation enabled. */
def canNavigateBack = true
View
10 core-ui/src/main/scala/com/typesafe/tools/mima/core/util/log/UiLogger.scala
@@ -6,11 +6,11 @@ import scala.swing.Swing
import com.typesafe.tools.mima.core.Config
object UiLogger extends Component with Logging {
-
+
private lazy val label = new Label
-
+
override lazy val peer = label.peer
-
- def info(str: String): Unit = Swing.onEDT { label.text = str }
- def debugLog(str: String): Unit = if(Config.debug) Swing.onEDT { label.text = str }
+
+ def info(str: String): Unit = Swing.onEDT { label.text = str }
+ def debugLog(str: String): Unit = if(Config.debug) Swing.onEDT { label.text = str }
}
View
2  core-ui/src/test/scala/com/typesafe/tools/mima/core/util/BrowseSpec.scala
@@ -63,7 +63,7 @@ class BrowseSpec extends SpecificationWithJUnit with Mockito {
there was one(proxy).cannotOpen(anyURI, any)
}
-
+
"fail gracefully if the URI cannot be converted into an URL" in new BrowseMock {
proxy.open(any) throws new java.lang.IllegalArgumentException()
View
2  core/src/main/scala/com/typesafe/tools/mima/core/BufferReader.scala
@@ -9,7 +9,7 @@ package com.typesafe.tools.mima.core
import java.lang.Float.intBitsToFloat
import java.lang.Double.longBitsToDouble
-/**
+/**
* This class reads files byte per byte. Only used by ClassFileParser
*
* @author Philippe Altherr
View
566 core/src/main/scala/com/typesafe/tools/mima/core/ClassInfo.scala
@@ -1,283 +1,283 @@
-package com.typesafe.tools.mima.core
-
-import scala.tools.nsc.io.AbstractFile
-import scala.reflect.NameTransformer
-
-object ClassInfo {
- def formatClassName(str: String) = NameTransformer.decode(str).replace('$', '#')
-
- /** We assume there can be only one java.lang.Object class, and that comes from the configuration
- * class path.
- */
- lazy val ObjectClass = Config.baseDefinitions.fromName("java.lang.Object")
-}
-
-import com.typesafe.tools.mima.core.util.log.{ConsoleLogging, Logging}
-
-/** A placeholder class info for a class that is not found on the classpath or in a given
- * package.
- */
-class SyntheticClassInfo(owner: PackageInfo, val name: String) extends ClassInfo(owner) {
- loaded = true
- def file: AbstractFile = throw new UnsupportedOperationException
- override lazy val superClasses = Nil
- override lazy val allTraits = Set.empty[ClassInfo]
- override lazy val allInterfaces: Set[ClassInfo] = Set.empty[ClassInfo]
-}
-
-/** As the name implies. */
-object NoClass extends SyntheticClassInfo(null, "<noclass>")
-
-/** A class for which we have the classfile. */
-class ConcreteClassInfo(owner: PackageInfo, val file: AbstractFile) extends ClassInfo(owner) {
- def name = PackageInfo.className(file.name)
-}
-
-abstract class ClassInfo(val owner: PackageInfo) extends WithAccessFlags {
- import ClassInfo._
-
- def file: AbstractFile
-
- private var _sourceFileName = ""
- def sourceFileName_=(fileName: String) = _sourceFileName = fileName
- def sourceFileName = this match {
- case c: ConcreteClassInfo => _sourceFileName
- case _ => "compiler generated"
- }
-
- def name: String
-
- lazy val fullName: String = {
- assert(name != null)
- if (owner.isRoot) name
- else owner.fullName + "." + name
- }
-
- def formattedFullName = formatClassName(if (isObject) fullName.init else fullName)
-
- def declarationPrefix = {
- if (isObject) "object"
- else if (isTrait) "trait"
- else if (loaded && isInterface) "interface" // java interfaces and traits with no implementation methods
- else "class"
- }
-
- def classString = (accessModifier + " " + declarationPrefix + " " + formattedFullName).trim
-
- protected var loaded = false
-
- import com.typesafe.tools.mima.core.util.log.ConsoleLogging._
- override protected def ensureLoaded() =
- if (!loaded)
- try {
- info("parsing " + file)
- owner.definitions.ClassfileParser.parse(this)
- } finally {
- loaded = true
- }
-
- private var _superClass: ClassInfo = NoClass
- private var _interfaces: List[ClassInfo] = Nil
- private var _fields: Members = NoMembers
- private var _methods: Members = NoMembers
- private var _flags: Int = 0
- private var _isScala: Boolean = false
-
- def superClass: ClassInfo = { ensureLoaded(); _superClass }
- def interfaces: List[ClassInfo] = { ensureLoaded(); _interfaces }
- def fields: Members = { ensureLoaded(); _fields }
- def methods: Members = { ensureLoaded(); _methods }
- override def flags: Int = _flags
-
- /** currently not set! */
- def isScala: Boolean = { ensureLoaded(); _isScala }
-
- def superClass_=(x: ClassInfo) = _superClass = x
- def interfaces_=(x: List[ClassInfo]) = _interfaces = x
- def fields_=(x: Members) = _fields = x
- def methods_=(x: Members) = _methods = x
- def flags_=(x: Int) = _flags = x
- def isScala_=(x: Boolean) = _isScala = x
-
- lazy val superClasses: List[ClassInfo] =
- (if (this == ClassInfo.ObjectClass) Nil else superClass :: superClass.superClasses)
-
- def lookupClassFields(name: String): Iterator[MemberInfo] =
- (Iterator.single(this) ++ superClasses.iterator) flatMap (_.fields.get(name))
-
- def lookupClassMethods(name: String): Iterator[MemberInfo] =
- (Iterator.single(this) ++ superClasses.iterator) flatMap (_.methods.get(name))
-
- private def lookupInterfaceMethods(name: String): Iterator[MemberInfo] =
- allInterfaces.iterator flatMap (_.methods.get(name))
-
- def lookupMethods(name: String): Iterator[MemberInfo] =
- lookupClassMethods(name) ++ lookupInterfaceMethods(name)
-
- def lookupConcreteTraitMethods(name: String): Iterator[MemberInfo] =
- allTraits.toList.flatten(_.concreteMethods).filter(_.name == name).toIterator
-
- /** Is this class a non-trait that inherits !from a trait */
- lazy val isClassInheritsTrait = !isInterface && _interfaces.exists(_.isTrait)
-
- /** Should methods be parsed from classfile? */
- def methodsAreRelevant = isTrait || isImplClass || _interfaces.exists(_.isTrait)
-
- /** The constructors of this class
- * pre: methodsAreRelevant
- */
- def constructors: List[MemberInfo] =
- if (methods == null) null
- else methods.iterator.filter(_.isClassConstructor).toList
-
- /** The setter methods defined of this trait that correspond to
- * a concrete field. TODO: define and check annotation for a mutable
- * setter.
- */
- lazy val traitSetters: List[MemberInfo] = {
- assert(isTrait)
- methods.iterator filter (_.isTraitSetter) toList
- }
-
- /** The concrete methods of this trait */
- lazy val concreteMethods: List[MemberInfo] = {
- if(isTrait) methods.iterator filter (hasStaticImpl(_)) toList
- else if(isClass) methods.iterator filter (!_.isDeferred) toList
- else Nil
- }
-
- /** The deferred methods of this trait */
- lazy val deferredMethods: List[MemberInfo] =
- methods.iterator.toList -- concreteMethods
-
- /** The inherited traits in the linearization of this class or trait,
- * except any traits inherited by its superclass.
- * Traits appear in linearization order of this class or trait.
- */
- lazy val directTraits: List[ClassInfo] = {
- /** All traits in the transitive, reflexive inheritance closure of given trait `t' */
- def traitClosure(t: ClassInfo): List[ClassInfo] =
- if (superClass.allTraits contains t) Nil
- else if (t.isTrait) parentsClosure(t) :+ t
- else parentsClosure(t)
-
- def parentsClosure(c: ClassInfo) =
- (c.interfaces flatMap traitClosure).distinct
-
- parentsClosure(this)
- }
-
- /** All traits inherited directly or indirectly by this class */
- lazy val allTraits: Set[ClassInfo] =
- if (this == ClassInfo.ObjectClass) Set.empty
- else superClass.allTraits ++ directTraits
-
- /** All traits inherited directly or indirectly by this class */
- lazy val allInterfaces: Set[ClassInfo] =
- if (this == ClassInfo.ObjectClass) Set.empty
- else superClass.allInterfaces ++ interfaces ++ (interfaces flatMap (_.allInterfaces))
-
- private def unimplemented(sel: ClassInfo => Traversable[MemberInfo]): List[MemberInfo] = {
- ensureLoaded()
- if (isClassInheritsTrait) {
- for {
- t <- directTraits.toList
- m <- sel(t)
- if !hasInstanceImpl(m)
- } yield m
- } else Nil
- }
-
- /** The methods that should be implemented by this class but aren't */
- lazy val unimplementedMethods = unimplemented(_.concreteMethods)
-
- /** The fields that should be implemented by this class but aren't */
- lazy val unimplementedSetters = unimplemented(_.traitSetters)
-
- /** Does this class have an implementation (forwarder or accessor) of given method `m'? */
- private def hasInstanceImpl(m: MemberInfo) =
- methods.get(m.name) exists (_.sig == m.sig)
-
- /** Does this implementation class have a static implementation of given method `m'? */
- def hasStaticImpl(m: MemberInfo) = staticImpl(m).isDefined
-
- /** Optionally, the static implementation method corresponding to trait member `m' */
- def staticImpl(m: MemberInfo): Option[MemberInfo] = {
- if(isTrait) {
- implClass match {
- case impl: ConcreteClassInfo =>
- assert(impl.isImplClass, impl)
- impl.methods.get(m.name) find (im => hasImplSig(im.sig, m.sig))
-
- case _ => None
- }
- }
- else None
- }
-
- /** Does `isig' correspond to `tsig' if seen as the signature of the static
- * implementation method of a trait method with signature `tsig'?
- */
- private def hasImplSig(isig: String, tsig: String) = {
- assert(isig(0) == '(' && isig(1) == 'L' && tsig(0) == '(')
- val ilen = isig.length
- val tlen = tsig.length
- var i = 2
- while (isig(i) != ';') i += 1
- i += 1
- var j = 1
- while (i < ilen && j < tlen && isig(i) == tsig(j)) {
- i += 1
- j += 1
- }
- i == ilen && j == tlen
- }
-
- /** Is this class an implementation class? */
- lazy val isImplClass: Boolean = name endsWith PackageInfo.implClassSuffix
-
- /** The implementation class corresponding to this trait */
- private var _implClass: ClassInfo = NoClass
-
- def implClass_=(ic: ClassInfo) = _implClass = ic
-
- /** The implementation class of this trait, or NoClass if it is not a trait.
- */
- def implClass: ClassInfo = {
- owner.traits // make sure we have implClass set
- _implClass
- }
-
- /** is this a class, an object or a trait's implementation class*/
- def isClass: Boolean = !isTrait && !isInterface
-
- /** Is this class a trait with some concrete methods or fields? */
- def isTrait: Boolean = implClass ne NoClass
-
- /** Is this class a trait without concrete methods or a java interface? */
- def isInterface: Boolean = {
- ensureLoaded()
- ClassfileParser.isInterface(flags)
- }
-
- def isObject: Boolean = name.endsWith("$")
-
- /** Is this class public? */
- /*
- def isPackageVisible: Boolean = {
- ensureLoaded()
- !ClassfileParser.isPrivate(flags)
- }*/
-
- override def toString = "class " + name
-
- def shortDescription = {
- // using 'description' because elsewhere objects' name are not correctly translated.
- // In fact, formatClassName(name) would have a suffixed '#' for an object name, which is annoying.
- val descr = description
- val index = descr.lastIndexOf(descr)
- if (index < 0) descr else descr.substring(index)
- }
-
- def description: String = declarationPrefix + " " + formattedFullName
-}
+package com.typesafe.tools.mima.core
+
+import scala.tools.nsc.io.AbstractFile
+import scala.reflect.NameTransformer
+
+object ClassInfo {
+ def formatClassName(str: String) = NameTransformer.decode(str).replace('$', '#')
+
+ /** We assume there can be only one java.lang.Object class, and that comes from the configuration
+ * class path.
+ */
+ lazy val ObjectClass = Config.baseDefinitions.fromName("java.lang.Object")
+}
+
+import com.typesafe.tools.mima.core.util.log.{ConsoleLogging, Logging}
+
+/** A placeholder class info for a class that is not found on the classpath or in a given
+ * package.
+ */
+class SyntheticClassInfo(owner: PackageInfo, val name: String) extends ClassInfo(owner) {
+ loaded = true
+ def file: AbstractFile = throw new UnsupportedOperationException
+ override lazy val superClasses = Nil
+ override lazy val allTraits = Set.empty[ClassInfo]
+ override lazy val allInterfaces: Set[ClassInfo] = Set.empty[ClassInfo]
+}
+
+/** As the name implies. */
+object NoClass extends SyntheticClassInfo(null, "<noclass>")
+
+/** A class for which we have the classfile. */
+class ConcreteClassInfo(owner: PackageInfo, val file: AbstractFile) extends ClassInfo(owner) {
+ def name = PackageInfo.className(file.name)
+}
+
+abstract class ClassInfo(val owner: PackageInfo) extends WithAccessFlags {
+ import ClassInfo._
+
+ def file: AbstractFile
+
+ private var _sourceFileName = ""
+ def sourceFileName_=(fileName: String) = _sourceFileName = fileName
+ def sourceFileName = this match {
+ case c: ConcreteClassInfo => _sourceFileName
+ case _ => "compiler generated"
+ }
+
+ def name: String
+
+ lazy val fullName: String = {
+ assert(name != null)
+ if (owner.isRoot) name
+ else owner.fullName + "." + name
+ }
+
+ def formattedFullName = formatClassName(if (isObject) fullName.init else fullName)
+
+ def declarationPrefix = {
+ if (isObject) "object"
+ else if (isTrait) "trait"
+ else if (loaded && isInterface) "interface" // java interfaces and traits with no implementation methods
+ else "class"
+ }
+
+ def classString = (accessModifier + " " + declarationPrefix + " " + formattedFullName).trim
+
+ protected var loaded = false
+
+ import com.typesafe.tools.mima.core.util.log.ConsoleLogging._
+ override protected def ensureLoaded() =
+ if (!loaded)
+ try {
+ info("parsing " + file)
+ owner.definitions.ClassfileParser.parse(this)
+ } finally {
+ loaded = true
+ }
+
+ private var _superClass: ClassInfo = NoClass
+ private var _interfaces: List[ClassInfo] = Nil
+ private var _fields: Members = NoMembers
+ private var _methods: Members = NoMembers
+ private var _flags: Int = 0
+ private var _isScala: Boolean = false
+
+ def superClass: ClassInfo = { ensureLoaded(); _superClass }
+ def interfaces: List[ClassInfo] = { ensureLoaded(); _interfaces }
+ def fields: Members = { ensureLoaded(); _fields }
+ def methods: Members = { ensureLoaded(); _methods }
+ override def flags: Int = _flags
+
+ /** currently not set! */
+ def isScala: Boolean = { ensureLoaded(); _isScala }
+
+ def superClass_=(x: ClassInfo) = _superClass = x
+ def interfaces_=(x: List[ClassInfo]) = _interfaces = x
+ def fields_=(x: Members) = _fields = x
+ def methods_=(x: Members) = _methods = x
+ def flags_=(x: Int) = _flags = x
+ def isScala_=(x: Boolean) = _isScala = x
+
+ lazy val superClasses: List[ClassInfo] =
+ (if (this == ClassInfo.ObjectClass) Nil else superClass :: superClass.superClasses)
+
+ def lookupClassFields(name: String): Iterator[MemberInfo] =
+ (Iterator.single(this) ++ superClasses.iterator) flatMap (_.fields.get(name))
+
+ def lookupClassMethods(name: String): Iterator[MemberInfo] =
+ (Iterator.single(this) ++ superClasses.iterator) flatMap (_.methods.get(name))
+
+ private def lookupInterfaceMethods(name: String): Iterator[MemberInfo] =
+ allInterfaces.iterator flatMap (_.methods.get(name))
+
+ def lookupMethods(name: String): Iterator[MemberInfo] =
+ lookupClassMethods(name) ++ lookupInterfaceMethods(name)
+
+ def lookupConcreteTraitMethods(name: String): Iterator[MemberInfo] =
+ allTraits.toList.flatten(_.concreteMethods).filter(_.name == name).toIterator
+
+ /** Is this class a non-trait that inherits !from a trait */
+ lazy val isClassInheritsTrait = !isInterface && _interfaces.exists(_.isTrait)
+
+ /** Should methods be parsed from classfile? */
+ def methodsAreRelevant = isTrait || isImplClass || _interfaces.exists(_.isTrait)
+
+ /** The constructors of this class
+ * pre: methodsAreRelevant
+ */
+ def constructors: List[MemberInfo] =
+ if (methods == null) null
+ else methods.iterator.filter(_.isClassConstructor).toList
+
+ /** The setter methods defined of this trait that correspond to
+ * a concrete field. TODO: define and check annotation for a mutable
+ * setter.
+ */
+ lazy val traitSetters: List[MemberInfo] = {
+ assert(isTrait)
+ methods.iterator filter (_.isTraitSetter) toList
+ }
+
+ /** The concrete methods of this trait */
+ lazy val concreteMethods: List[MemberInfo] = {
+ if(isTrait) methods.iterator filter (hasStaticImpl(_)) toList
+ else if(isClass) methods.iterator filter (!_.isDeferred) toList
+ else Nil
+ }
+
+ /** The deferred methods of this trait */
+ lazy val deferredMethods: List[MemberInfo] =
+ methods.iterator.toList -- concreteMethods
+
+ /** The inherited traits in the linearization of this class or trait,
+ * except any traits inherited by its superclass.
+ * Traits appear in linearization order of this class or trait.
+ */
+ lazy val directTraits: List[ClassInfo] = {
+ /** All traits in the transitive, reflexive inheritance closure of given trait `t' */
+ def traitClosure(t: ClassInfo): List[ClassInfo] =
+ if (superClass.allTraits contains t) Nil
+ else if (t.isTrait) parentsClosure(t) :+ t
+ else parentsClosure(t)
+
+ def parentsClosure(c: ClassInfo) =
+ (c.interfaces flatMap traitClosure).distinct
+
+ parentsClosure(this)
+ }
+
+ /** All traits inherited directly or indirectly by this class */
+ lazy val allTraits: Set[ClassInfo] =
+ if (this == ClassInfo.ObjectClass) Set.empty
+ else superClass.allTraits ++ directTraits
+
+ /** All traits inherited directly or indirectly by this class */
+ lazy val allInterfaces: Set[ClassInfo] =
+ if (this == ClassInfo.ObjectClass) Set.empty
+ else superClass.allInterfaces ++ interfaces ++ (interfaces flatMap (_.allInterfaces))
+
+ private def unimplemented(sel: ClassInfo => Traversable[MemberInfo]): List[MemberInfo] = {
+ ensureLoaded()
+ if (isClassInheritsTrait) {
+ for {
+ t <- directTraits.toList
+ m <- sel(t)
+ if !hasInstanceImpl(m)
+ } yield m
+ } else Nil
+ }
+
+ /** The methods that should be implemented by this class but aren't */
+ lazy val unimplementedMethods = unimplemented(_.concreteMethods)
+
+ /** The fields that should be implemented by this class but aren't */
+ lazy val unimplementedSetters = unimplemented(_.traitSetters)
+
+ /** Does this class have an implementation (forwarder or accessor) of given method `m'? */
+ private def hasInstanceImpl(m: MemberInfo) =
+ methods.get(m.name) exists (_.sig == m.sig)
+
+ /** Does this implementation class have a static implementation of given method `m'? */
+ def hasStaticImpl(m: MemberInfo) = staticImpl(m).isDefined
+
+ /** Optionally, the static implementation method corresponding to trait member `m' */
+ def staticImpl(m: MemberInfo): Option[MemberInfo] = {
+ if(isTrait) {
+ implClass match {
+ case impl: ConcreteClassInfo =>
+ assert(impl.isImplClass, impl)
+ impl.methods.get(m.name) find (im => hasImplSig(im.sig, m.sig))
+
+ case _ => None
+ }
+ }
+ else None
+ }
+
+ /** Does `isig' correspond to `tsig' if seen as the signature of the static
+ * implementation method of a trait method with signature `tsig'?
+ */
+ private def hasImplSig(isig: String, tsig: String) = {
+ assert(isig(0) == '(' && isig(1) == 'L' && tsig(0) == '(')
+ val ilen = isig.length
+ val tlen = tsig.length
+ var i = 2
+ while (isig(i) != ';') i += 1
+ i += 1
+ var j = 1
+ while (i < ilen && j < tlen && isig(i) == tsig(j)) {
+ i += 1
+ j += 1
+ }
+ i == ilen && j == tlen
+ }
+
+ /** Is this class an implementation class? */
+ lazy val isImplClass: Boolean = name endsWith PackageInfo.implClassSuffix
+
+ /** The implementation class corresponding to this trait */
+ private var _implClass: ClassInfo = NoClass
+
+ def implClass_=(ic: ClassInfo) = _implClass = ic
+
+ /** The implementation class of this trait, or NoClass if it is not a trait.
+ */
+ def implClass: ClassInfo = {
+ owner.traits // make sure we have implClass set
+ _implClass
+ }
+
+ /** is this a class, an object or a trait's implementation class*/
+ def isClass: Boolean = !isTrait && !isInterface
+
+ /** Is this class a trait with some concrete methods or fields? */
+ def isTrait: Boolean = implClass ne NoClass
+
+ /** Is this class a trait without concrete methods or a java interface? */
+ def isInterface: Boolean = {
+ ensureLoaded()
+ ClassfileParser.isInterface(flags)
+ }
+
+ def isObject: Boolean = name.endsWith("$")
+
+ /** Is this class public? */
+ /*
+ def isPackageVisible: Boolean = {
+ ensureLoaded()
+ !ClassfileParser.isPrivate(flags)
+ }*/
+
+ override def toString = "class " + name
+
+ def shortDescription = {
+ // using 'description' because elsewhere objects' name are not correctly translated.
+ // In fact, formatClassName(name) would have a suffixed '#' for an object name, which is annoying.
+ val descr = description
+ val index = descr.lastIndexOf(descr)
+ if (index < 0) descr else descr.substring(index)
+ }
+
+ def description: String = declarationPrefix + " " + formattedFullName
+}
View
34 core/src/main/scala/com/typesafe/tools/mima/core/ClassfileParser.scala
@@ -60,7 +60,7 @@ abstract class ClassfileParser(definitions: Definitions) {
} catch {
case e: RuntimeException => handleError(e)
}
- }
+ }
protected def parseAll(clazz: ClassInfo) {
parseHeader()
@@ -83,7 +83,7 @@ abstract class ClassfileParser(definitions: Definitions) {
private val starts = new Array[Int](length)
private val values = new Array[AnyRef](length)
private val internalized = new Array[String](length)
-
+
{ var i = 1
while (i < length) {
starts(i) = in.bp
@@ -140,7 +140,7 @@ abstract class ClassfileParser(definitions: Definitions) {
}
c
}
-
+
/** Return the external name of the class info structure found at 'index'.
* Use 'getClassSymbol' if the class is sure to be a top-level class.
*/
@@ -149,7 +149,7 @@ abstract class ClassfileParser(definitions: Definitions) {
if (in.buf(start).toInt != CONSTANT_CLASS) errorBadTag(start)
getExternalName(in.getChar(start + 1))
}
-
+
def getSuperClass(index: Int): ClassInfo =
if (index == 0) ClassInfo.ObjectClass else getClassInfo(index)
@@ -157,7 +157,7 @@ abstract class ClassfileParser(definitions: Definitions) {
* type, a dummy symbol is created in 'ownerTpe', which is used as the
* owner of its value parameters. This might lead to inconsistencies,
* if a symbol of the given name already exists, and has a different
- * type.
+ * type.
*/
def getNameAndType(index: Int): (String, String) = {
if (index <= 0 || length <= index) errorBadIndex(index)
@@ -201,13 +201,13 @@ abstract class ClassfileParser(definitions: Definitions) {
throw new RuntimeException("bad constant pool tag " + in.buf(start) + " at byte " + start)
}
- def parseFields(clazz: ClassInfo): Unit =
+ def parseFields(clazz: ClassInfo): Unit =
if (readFields(clazz)) clazz.fields = parseMembers(clazz)
else if (readMethods(clazz)) skipMembers()
- def parseMethods(clazz: ClassInfo) =
+ def parseMethods(clazz: ClassInfo) =
if (readMethods(clazz)) clazz.methods = parseMembers(clazz)
-
+
def parseMembers(clazz: ClassInfo): Members = {
val takeStatics = clazz.isImplClass
val memberCount = in.nextChar
@@ -229,7 +229,7 @@ abstract class ClassfileParser(definitions: Definitions) {
in.skip(6); skipAttributes()
}
}
-
+
def parseMember(clazz: ClassInfo, jflags: Int): MemberInfo = {
val name = pool.getName(in.nextChar)
val sig = pool.getExternalName(in.nextChar)
@@ -243,12 +243,12 @@ abstract class ClassfileParser(definitions: Definitions) {
val nameIdx = in.nextChar
val externalName = pool.getClassName(nameIdx)
- def parseSuperClass(): ClassInfo =
+ def parseSuperClass(): ClassInfo =
if (hasAnnotation(clazz.flags)) { in.nextChar; definitions.AnnotationClass }
else pool.getSuperClass(in.nextChar)
def parseInterfaces(): List[ClassInfo] = {
- val rawInterfaces =
+ val rawInterfaces =
for (i <- List.range(0, in.nextChar)) yield pool.getSuperClass(in.nextChar)
rawInterfaces filter (_ != NoClass)
}
@@ -266,7 +266,7 @@ abstract class ClassfileParser(definitions: Definitions) {
in.skip(2); in.skip(in.nextInt)
}
}
-
+
def parseAttributes(c: ClassInfo) {
val attrCount = in.nextChar
for (i <- 0 until attrCount) {
@@ -280,11 +280,11 @@ abstract class ClassfileParser(definitions: Definitions) {
c.sourceFileName = pool.getName(attrNameIndex)
}
}
-
+
in.bp = attrEnd
}
}
-
+
/** Return true iff TraitSetter annotation found among attributes */
def parseAttributes(m: MemberInfo) {
val maybeTraitSetter = MemberInfo.maybeSetter(m.name)
@@ -300,9 +300,9 @@ abstract class ClassfileParser(definitions: Definitions) {
while (j < annotCount && !m.isTraitSetter) {
if (in.bp + 2 <= attrEnd) {
val annotIndex = in.nextChar
- if (pool.getName(annotIndex) == "Lscala/runtime/TraitSetter;")
+ if (pool.getName(annotIndex) == "Lscala/runtime/TraitSetter;")
m.isTraitSetter = true
- else
+ else
skipAnnotation(annotIndex, attrEnd)
}
j += 1
@@ -332,7 +332,7 @@ abstract class ClassfileParser(definitions: Definitions) {
}
}
} catch {
- case ex: Exception =>
+ case ex: Exception =>
}
}
View
134 core/src/main/scala/com/typesafe/tools/mima/core/Config.scala
@@ -1,67 +1,67 @@
-package com.typesafe.tools.mima.core
-
-import scala.tools.nsc.io.{ Path, Directory }
-import scala.tools.nsc.util.JavaClassPath
-import scala.util.Properties
-import java.io.File
-
-object Config {
-
- private var settings: Settings = _
- private var _classpath: JavaClassPath = _
-
- def inPlace = settings.mimaOutDir.isDefault
-
- def verbose = settings.verbose.value
- def debug = settings.debug.value
-
- def fixall = settings.fixall.value
-
- def error(msg: String) = System.err.println(msg)
-
- def baseClassPath: JavaClassPath = _classpath
-
- lazy val baseDefinitions = new Definitions(None, baseClassPath)
-
- def baseClassPath_=(cp: JavaClassPath) {
- _classpath = cp
- }
-
- def fatal(msg: String): Nothing = {
- error(msg)
- System.exit(-1)
- throw new Error()
- }
-
- lazy val outDir: Directory = {
- assert(!inPlace)
- val f = Path(settings.mimaOutDir.value).toDirectory
- if (!(f.isDirectory && f.canWrite)) fatal(f + " is not a writable directory")
- f
- }
-
- /** Creates a help message for a subset of options based on cond */
- def usageMsg(cmd: String): String =
- settings.visibleSettings.
- map(s => format(s.helpSyntax).padTo(21, ' ') + " " + s.helpDescription).
- toList.sorted.mkString("Usage: " + cmd + " <options>\nwhere possible options include:\n ", "\n ", "\n")
-
- def setup(s: Settings) {
- settings = s
- }
-
- def setup(cmd: String, args: Array[String], specificOptions: String*): List[String] =
- setup(cmd, args, _ => true, specificOptions: _*)
-
- def setup(cmd: String, args: Array[String], validate: List[String] => Boolean, specificOptions: String*): List[String] = {
- settings = new Settings(specificOptions: _*)
- val (_, resargs) = settings.processArguments(args.toList, true)
- baseClassPath = new PathResolver(settings).mimaResult
- if (settings.help.value) {
- println(usageMsg(cmd))
- System.exit(0)
- }
- if (validate(resargs)) resargs
- else fatal(usageMsg(cmd))
- }
-}
+package com.typesafe.tools.mima.core
+
+import scala.tools.nsc.io.{ Path, Directory }
+import scala.tools.nsc.util.JavaClassPath
+import scala.util.Properties
+import java.io.File
+
+object Config {
+
+ private var settings: Settings = _
+ private var _classpath: JavaClassPath = _
+
+ def inPlace = settings.mimaOutDir.isDefault
+
+ def verbose = settings.verbose.value
+ def debug = settings.debug.value
+
+ def fixall = settings.fixall.value
+
+ def error(msg: String) = System.err.println(msg)
+
+ def baseClassPath: JavaClassPath = _classpath
+
+ lazy val baseDefinitions = new Definitions(None, baseClassPath)
+
+ def baseClassPath_=(cp: JavaClassPath) {
+ _classpath = cp
+ }
+
+ def fatal(msg: String): Nothing = {
+ error(msg)
+ System.exit(-1)
+ throw new Error()
+ }
+
+ lazy val outDir: Directory = {
+ assert(!inPlace)
+ val f = Path(settings.mimaOutDir.value).toDirectory
+ if (!(f.isDirectory && f.canWrite)) fatal(f + " is not a writable directory")
+ f
+ }
+
+ /** Creates a help message for a subset of options based on cond */
+ def usageMsg(cmd: String): String =
+ settings.visibleSettings.
+ map(s => format(s.helpSyntax).padTo(21, ' ') + " " + s.helpDescription).
+ toList.sorted.mkString("Usage: " + cmd + " <options>\nwhere possible options include:\n ", "\n ", "\n")
+
+ def setup(s: Settings) {
+ settings = s
+ }
+
+ def setup(cmd: String, args: Array[String], specificOptions: String*): List[String] =
+ setup(cmd, args, _ => true, specificOptions: _*)
+
+ def setup(cmd: String, args: Array[String], validate: List[String] => Boolean, specificOptions: String*): List[String] = {
+ settings = new Settings(specificOptions: _*)
+ val (_, resargs) = settings.processArguments(args.toList, true)
+ baseClassPath = new PathResolver(settings).mimaResult
+ if (settings.help.value) {
+ println(usageMsg(cmd))
+ System.exit(0)
+ }
+ if (validate(resargs)) resargs
+ else fatal(usageMsg(cmd))
+ }
+}
View
32 core/src/main/scala/com/typesafe/tools/mima/core/Definitions.scala
@@ -3,22 +3,22 @@ package com.typesafe.tools.mima.core
import scala.tools.nsc.util.{ClassPath, JavaClassPath, DirectoryClassPath}
-/** This class holds together a root package and a classpath. It
- * also offers definitions of commonly used classes, including
+/** This class holds together a root package and a classpath. It
+ * also offers definitions of commonly used classes, including
* java.lang.Object
- *
+ *
* Each version of the input jar file has an instance of Definitions, used
* to resolve type names during classfile parsing.
*/
class Definitions(val lib: Option[DirectoryClassPath], val classPath: JavaClassPath) {
import com.typesafe.tools.mima.core.util.log.ConsoleLogging._
-
- lazy val root =
- new ConcretePackageInfo(null,
+
+ lazy val root =
+ new ConcretePackageInfo(null,
new JavaClassPath(
- if (lib.isDefined) Vector(lib.get, classPath)
+ if (lib.isDefined) Vector(lib.get, classPath)
else Vector(classPath), DefaultJavaContext), this)
-
+
/** Return all packages in the target library. */
lazy val targetPackage: PackageInfo = {
val pkg = new SyntheticPackageInfo(root, "<root>") {
@@ -27,16 +27,16 @@ class Definitions(val lib: Option[DirectoryClassPath], val classPath: JavaClassP
override lazy val classes = Definitions.this.root.classes
}
pkg.packages ++= lib.get.packages map (cp => cp.name -> new ConcretePackageInfo(pkg, cp, this))
-
+
debugLog("added packages to <root>: %s".format(pkg.packages.keys.mkString(", ")))
pkg
}
-
+
lazy val ObjectClass = fromName("java.lang.Object")
lazy val AnnotationClass = fromName("java.lang.annotation.Annotation")
lazy val ClassfileParser = new LibClassfileParser(this)
-
+
/** Return the class corresponding to the fully qualified name.
* If there is no such class in the current classpath, a SyntheticClassInfo
* and all necessary SyntheticPackageInfo are created along the way.
@@ -49,7 +49,7 @@ class Definitions(val lib: Option[DirectoryClassPath], val classPath: JavaClassP
while (i < parts.length - 1) {
pkg.packages get part match {
case Some(p) => pkg = p
- case None =>
+ case None =>
val newpkg = new SyntheticPackageInfo(pkg, part)
pkg.packages += (part -> newpkg)
pkg = newpkg
@@ -59,7 +59,7 @@ class Definitions(val lib: Option[DirectoryClassPath], val classPath: JavaClassP
}
pkg.classes getOrElse (part, new SyntheticClassInfo(pkg, part))
}
-
+
import Type._
/** Return the type corresponding to 'sig'. Class names are resolved
@@ -67,12 +67,12 @@ class Definitions(val lib: Option[DirectoryClassPath], val classPath: JavaClassP
*/
def fromSig(sig: String): Type = {
var in = 0
-
+
def getType(): Type = {
val ch = sig(in)
in += 1
abbrevToValueType get ch match {
- case Some(tp) =>
+ case Some(tp) =>
tp
case None =>
if (ch == '[') {
@@ -98,7 +98,7 @@ class Definitions(val lib: Option[DirectoryClassPath], val classPath: JavaClassP
getType()
}
-
+
override def toString = {
"definitions:\n\tlib: %s\n%s".format(lib, classPath.asClasspathString)
}
View
172 core/src/main/scala/com/typesafe/tools/mima/core/MemberInfo.scala
@@ -1,86 +1,86 @@
-package com.typesafe.tools.mima.core
-
-import scala.reflect.NameTransformer
-
-object MemberInfo {
-
- /** The index of the string $_setter_$ in this string */
- private def setterIdx(name: String) = name.indexOf(setterTag)
-
- private val setterTag = "$_setter_$"
- private val setterSuffix = "_$eq"
-
- def maybeSetter(name: String) = name.endsWith(setterSuffix)
-}
-
-class MemberInfo(val owner: ClassInfo, val name: String, override val flags: Int, val sig: String) extends WithAccessFlags {
- override def toString = "def "+name+": "+ sig
-
- def decodedName = NameTransformer.decode(name)
-
- def fieldString = "field "+decodedName+" in "+owner.classString
- def shortMethodString = (if(hasSyntheticName) "synthetic " else "") + (if(isDeprecated) "deprecated " else "") + "method "+decodedName + tpe
- def methodString = shortMethodString + " in " + owner.classString
- def defString = (if(isDeprecated) "@deprecated " else "") + "def " + decodedName + params.mkString("(", ",", ")") + ": " + tpe.resultType + " = "
- def applyString = decodedName + params.mkString("(", ",", ")")
-
- lazy val params: List[String] = tpe match {
- case MethodType(paramTypes, resultType) =>
- for ((ptype, index) <- paramTypes.zipWithIndex) yield "par" + index + ": " + ptype
- }
-
- def fullName = owner.formattedFullName + "." + decodedName
-
- def tpe: Type = owner.owner.definitions.fromSig(sig)
-
- def staticImpl = owner.implClass.staticImpl(this)
-
- def isMethod: Boolean = sig(0) == '('
-
- def parametersSig = {
- assert(isMethod)
- sig substring (1, sig indexOf ")")
- }
-
- def matchesType(other: MemberInfo): Boolean =
- if (isMethod) other.isMethod && parametersSig == other.parametersSig
- else !other.isMethod && sig == other.sig
-
- def resultSig = {
- assert(sig(0) == '(')
- sig substring ((sig indexOf ")") + 1)
- }
-
-
- var codeOpt: Option[(Int, Int)] = None
-
- def isClassConstructor = name == "<init>"
-
- def needCode = isClassConstructor
-
- import MemberInfo._
-
- var isTraitSetter = maybeSetter(name) && setterIdx(name) >= 0
-
- var isDeprecated = false
-
- def hasSyntheticName: Boolean = decodedName contains '$'
-
- def isAccessible: Boolean = isPublic && !hasSyntheticName
-
- /** The name of the getter corresponding to this setter */
- private def getterName: String = {
- val sidx = setterIdx(name)
- val start = if (sidx >= 0) sidx + setterTag.length else 0
- name.substring(start, name.length - setterSuffix.length)
- }
-
- /** The getter that corresponds to this setter */
- def getter: MemberInfo = {
- val argsig = "()" + parametersSig
- owner.methods.get(getterName) find (_.sig == argsig) get
- }
-
- def description: String = name+": "+sig+" from "+owner.description
-}
-
+package com.typesafe.tools.mima.core
+
+import scala.reflect.NameTransformer
+
+object MemberInfo {
+
+ /** The index of the string $_setter_$ in this string */
+ private def setterIdx(name: String) = name.indexOf(setterTag)
+
+ private val setterTag = "$_setter_$"
+ private val setterSuffix = "_$eq"
+
+ def maybeSetter(name: String) = name.endsWith(setterSuffix)
+}
+
+class MemberInfo(val owner: ClassInfo, val name: String, override val flags: Int, val sig: String) extends WithAccessFlags {
+ override def toString = "def "+name+": "+ sig
+
+ def decodedName = NameTransformer.decode(name)
+
+ def fieldString = "field "+decodedName+" in "+owner.classString
+ def shortMethodString = (if(hasSyntheticName) "synthetic " else "") + (if(isDeprecated) "deprecated " else "") + "method "+decodedName + tpe
+ def methodString = shortMethodString + " in " + owner.classString
+ def defString = (if(isDeprecated) "@deprecated " else "") + "def " + decodedName + params.mkString("(", ",", ")") + ": " + tpe.resultType + " = "
+ def applyString = decodedName + params.mkString("(", ",", ")")
+
+ lazy val params: List[String] = tpe match {
+ case MethodType(paramTypes, resultType) =>
+ for ((ptype, index) <- paramTypes.zipWithIndex) yield "par" + index + ": " + ptype
+ }
+
+ def fullName = owner.formattedFullName + "." + decodedName
+
+ def tpe: Type = owner.owner.definitions.fromSig(sig)
+
+ def staticImpl = owner.implClass.staticImpl(this)
+
+ def isMethod: Boolean = sig(0) == '('
+
+ def parametersSig = {
+ assert(isMethod)
+ sig substring (1, sig indexOf ")")
+ }
+
+ def matchesType(other: MemberInfo): Boolean =
+ if (isMethod) other.isMethod && parametersSig == other.parametersSig
+ else !other.isMethod && sig == other.sig
+
+ def resultSig = {
+ assert(sig(0) == '(')
+ sig substring ((sig indexOf ")") + 1)
+ }
+
+
+ var codeOpt: Option[(Int, Int)] = None
+
+ def isClassConstructor = name == "<init>"
+
+ def needCode = isClassConstructor
+
+ import MemberInfo._
+
+ var isTraitSetter = maybeSetter(name) && setterIdx(name) >= 0
+
+ var isDeprecated = false
+
+ def hasSyntheticName: Boolean = decodedName contains '$'
+
+ def isAccessible: Boolean = isPublic && !hasSyntheticName
+
+ /** The name of the getter corresponding to this setter */
+ private def getterName: String = {
+ val sidx = setterIdx(name)
+ val start = if (sidx >= 0) sidx + setterTag.length else 0
+ name.substring(start, name.length - setterSuffix.length)
+ }
+
+ /** The getter that corresponds to this setter */
+ def getter: MemberInfo = {
+ val argsig = "()" + parametersSig
+ owner.methods.get(getterName) find (_.sig == argsig) get
+ }
+
+ def description: String = name+": "+sig+" from "+owner.description
+}
+
View
36 core/src/main/scala/com/typesafe/tools/mima/core/Members.scala
@@ -1,19 +1,19 @@
-package com.typesafe.tools.mima.core
-
-import collection.mutable
-import collection.TraversableOnce
-
-class Members(val members: TraversableOnce[MemberInfo]) {
-
- private val bindings = new mutable.HashMap[String, List[MemberInfo]] {
- override def default(key: String) = List()
- }
- for (m <- members) bindings += m.name -> (m :: bindings(m.name))
-
- def iterator: Iterator[MemberInfo] =
- for (ms <- bindings.valuesIterator; m <- ms.iterator) yield m
- def get(name: String): Iterator[MemberInfo] = bindings(name).iterator
-}
-
-
+package com.typesafe.tools.mima.core
+
+import collection.mutable
+import collection.TraversableOnce
+
+class Members(val members: TraversableOnce[MemberInfo]) {
+
+ private val bindings = new mutable.HashMap[String, List[MemberInfo]] {
+ override def default(key: String) = List()
+ }
+ for (m <- members) bindings += m.name -> (m :: bindings(m.name))
+
+ def iterator: Iterator[MemberInfo] =
+ for (ms <- bindings.valuesIterator; m <- ms.iterator) yield m
+ def get(name: String): Iterator[MemberInfo] = bindings(name).iterator
+}
+
+
object NoMembers extends Members(Nil)
View
202 core/src/main/scala/com/typesafe/tools/mima/core/PackageInfo.scala
@@ -1,101 +1,101 @@
-package com.typesafe.tools.mima.core
-
-import scala.tools.nsc.io.AbstractFile
-import scala.tools.nsc.util.ClassPath
-import collection.mutable
-
-object PackageInfo {
- val classExtension = ".class"
- val implClassSuffix = "$class"
-
- def className(fileName: String) = {
- assert(fileName endsWith classExtension)
- fileName.substring(0, fileName.length - classExtension.length)
- }
-
- def traitName(iclassName: String) = {
- assert(iclassName endsWith implClassSuffix)
- iclassName.substring(0, iclassName.length - implClassSuffix.length)
- }
-}
-
-import PackageInfo._
-
-class SyntheticPackageInfo(owner: PackageInfo, val name: String) extends PackageInfo(owner) {
- def definitions: Definitions = error("Called definitions on synthetic package")
- lazy val packages = mutable.Map.empty[String, PackageInfo]
- lazy val classes = mutable.Map.empty[String, ClassInfo]
-}
-
-object NoPackageInfo extends SyntheticPackageInfo(null, "<no package>")
-
-/** A concrete package. cp should be a directory classpath.
- */
-class ConcretePackageInfo(owner: PackageInfo, cp: ClassPath[AbstractFile], val defs: Definitions) extends PackageInfo(owner) {
- def definitions = defs
- def name = cp.name
- private def classFiles: IndexedSeq[AbstractFile] = cp.classes flatMap (_.binary)
-
- lazy val packages: mutable.Map[String, PackageInfo] =
- mutable.Map() ++= (cp.packages map (cp => cp.name -> new ConcretePackageInfo(this, cp, defs)))
-
- lazy val classes: mutable.Map[String, ClassInfo] =
- mutable.Map() ++= (classFiles map (f => className(f.name) -> new ConcreteClassInfo(this, f)))
-}
-
-/** Package information, including available classes and packages, and what is
- * accessible.
- */
-abstract class PackageInfo(val owner: PackageInfo) {
-
- def name: String
-
- def definitions: Definitions
-
- def isRoot = owner == null
-
- private lazy val root: PackageInfo = if (isRoot) this else owner.root
-
- def fullName: String = if (isRoot) "<root>"
- else if (owner.isRoot) name
- else owner.fullName + "." + name
-
- def packages: mutable.Map[String, PackageInfo]
- def classes: mutable.Map[String, ClassInfo]
-
- lazy val accessibleClasses: Set[ClassInfo] = {
- /** Fixed point iteration for finding all accessible classes. */
- def accessibleClassesUnder(prefix: Set[ClassInfo]): Set[ClassInfo] = {
- val vclasses = (classes.valuesIterator filter (isAccessible(_, prefix))).toSet
- if (vclasses.isEmpty) vclasses
- else vclasses union accessibleClassesUnder(vclasses)
- }
-
- def isAccessible(clazz: ClassInfo, prefix: Set[ClassInfo]) = {
- val idx = clazz.name.lastIndexOf("$")
- lazy val isReachable =
- if (idx < 0) prefix.isEmpty // class name contains no $
- else (prefix exists (_.name == clazz.name.substring(0, idx))) // prefix before dollar is an accessible class detected previously
- clazz.isPublic && isReachable
- }
-
- accessibleClassesUnder(Set.empty)
- }
-
- /** All implementation classes of traits (classes that end in '$class'). */
- lazy val implClasses: mutable.Map[String, ClassInfo] =
- classes filter { case (name, _) => name endsWith implClassSuffix }
-
- lazy val traits : mutable.Map[String, ClassInfo] = for {
- (name, iclazz) <- implClasses
- tclazz <- classes get traitName(name)
- } yield {
- tclazz.implClass = iclazz
- (traitName(name), tclazz)
- }
-
- override def toString = "package "+name
-
- def packageString = "package "+fullName
-}
-
+package com.typesafe.tools.mima.core
+
+import scala.tools.nsc.io.AbstractFile
+import scala.tools.nsc.util.ClassPath
+import collection.mutable
+
+object PackageInfo {
+ val classExtension = ".class"
+ val implClassSuffix = "$class"
+
+ def className(fileName: String) = {
+ assert(fileName endsWith classExtension)
+ fileName.substring(0, fileName.length - classExtension.length)
+ }
+
+ def traitName(iclassName: String) = {
+ assert(iclassName endsWith implClassSuffix)
+ iclassName.substring(0, iclassName.length - implClassSuffix.length)
+ }
+}
+
+import PackageInfo._
+
+class SyntheticPackageInfo(owner: PackageInfo, val name: String) extends PackageInfo(owner) {
+ def definitions: Definitions = error("Called definitions on synthetic package")
+ lazy val packages = mutable.Map.empty[String, PackageInfo]
+ lazy val classes = mutable.Map.empty[String, ClassInfo]
+}
+
+object NoPackageInfo extends SyntheticPackageInfo(null, "<no package>")
+
+/** A concrete package. cp should be a directory classpath.
+ */
+class ConcretePackageInfo(owner: PackageInfo, cp: ClassPath[AbstractFile], val defs: Definitions) extends PackageInfo(owner) {
+ def definitions = defs
+ def name = cp.name
+ private def classFiles: IndexedSeq[AbstractFile] = cp.classes flatMap (_.binary)
+
+ lazy val packages: mutable.Map[String, PackageInfo] =
+ mutable.Map() ++= (cp.packages map (cp => cp.name -> new ConcretePackageInfo(this, cp, defs)))
+
+ lazy val classes: mutable.Map[String, ClassInfo] =
+ mutable.Map() ++= (classFiles map (f => className(f.name) -> new ConcreteClassInfo(this, f)))
+}
+
+/** Package information, including available classes and packages, and what is
+ * accessible.
+ */
+abstract class PackageInfo(val owner: PackageInfo) {
+
+ def name: String
+
+ def definitions: Definitions
+
+ def isRoot = owner == null
+
+ private lazy val root: PackageInfo = if (isRoot) this else owner.root
+
+ def fullName: String = if (isRoot) "<root>"
+ else if (owner.isRoot) name
+ else owner.fullName + "." + name
+
+ def packages: mutable.Map[String, PackageInfo]
+ def classes: mutable.Map[String, ClassInfo]
+
+ lazy val accessibleClasses: Set[ClassInfo] = {
+ /** Fixed point iteration for finding all accessible classes. */
+ def accessibleClassesUnder(prefix: Set[ClassInfo]): Set[ClassInfo] = {
+ val vclasses = (classes.valuesIterator filter (isAccessible(_, prefix))).toSet
+ if (vclasses.isEmpty) vclasses
+ else vclasses union accessibleClassesUnder(vclasses)
+ }
+
+ def isAccessible(clazz: ClassInfo, prefix: Set[ClassInfo]) = {
+ val idx = clazz.name.lastIndexOf("$")
+ lazy val isReachable =
+ if (idx < 0) prefix.isEmpty // class name contains no $
+ else (prefix exists (_.name == clazz.name.substring(0, idx))) // prefix before dollar is an accessible class detected previously
+ clazz.isPublic && isReachable
+ }
+
+ accessibleClassesUnder(Set.empty)
+ }
+
+ /** All implementation classes of traits (classes that end in '$class'). */
+ lazy val implClasses: mutable.Map[String, ClassInfo] =
+ classes filter { case (name, _) => name endsWith implClassSuffix }
+
+ lazy val traits : mutable.Map[String, ClassInfo] = for {
+ (name, iclazz) <- implClasses
+ tclazz <- classes get traitName(name)
+ } yield {
+ tclazz.implClass = iclazz
+ (traitName(name), tclazz)
+ }
+
+ override def toString = "package "+name
+
+ def packageString = "package "+fullName
+}
+
View
22 core/src/main/scala/com/typesafe/tools/mima/core/PathResolver.scala
@@ -1,11 +1,11 @@
-package com.typesafe.tools.mima.core
-
-import scala.tools.nsc.util.{JavaClassPath, ClassPath}
-
-class PathResolver(settings: Settings) extends scala.tools.util.PathResolver(settings, DefaultJavaContext) {
- lazy val mimaResult = new JavaClassPath(containers.toIndexedSeq, DefaultJavaContext)
-}
-
-object DefaultJavaContext extends ClassPath.JavaContext
-
-
+package com.typesafe.tools.mima.core
+
+import scala.tools.nsc.util.{JavaClassPath, ClassPath}
+
+class PathResolver(settings: Settings) extends scala.tools.util.PathResolver(settings, DefaultJavaContext) {
+ lazy val mimaResult = new JavaClassPath(containers.toIndexedSeq, DefaultJavaContext)
+}
+
+object DefaultJavaContext extends ClassPath.JavaContext
+
+
View
8 core/src/main/scala/com/typesafe/tools/mima/core/Reference.scala
@@ -1,4 +1,4 @@
-package com.typesafe.tools.mima.core
-
-case class Reference(clazz: ClassInfo, name: String, tpe: String)
-
+package com.typesafe.tools.mima.core
+
+case class Reference(clazz: ClassInfo, name: String, tpe: String)
+
View
24 core/src/main/scala/com/typesafe/tools/mima/core/Settings.scala
@@ -16,22 +16,22 @@ class Settings(specificOptions: String*) extends nsc.Settings(Console.println) {
allSettings += (interactive, mimaOutDir)
- def visibleNames =
+ def visibleNames =
List(
- "-bootclasspath",
- "-classpath",
- "-extdirs",
- "-javaextdirs",
- "-usejavacp",
- "-version",
- "-help",
+ "-bootclasspath",
+ "-classpath",
+ "-extdirs",
+ "-javaextdirs",
+ "-usejavacp",
+ "-version",
+ "-help",
"-Ydebug",
- "-verbose",
- "-d",
+ "-verbose",
+ "-d",
"-i") ++ specificOptions
override def visibleSettings = super.visibleSettings.filter (visibleNames contains _.name)
}
-
-
+
+
View
108 core/src/main/scala/com/typesafe/tools/mima/core/Type.scala
@@ -1,54 +1,54 @@
-package com.typesafe.tools.mima.core
-
-object Type {
-
- val byteType = ValueType("Byte")
- val shortType = ValueType("Short")
- val charType = ValueType("Char")
- val intType = ValueType("Int")
- val longType = ValueType("Long")
- val floatType = ValueType("Float")
- val doubleType = ValueType("Double")
- val booleanType = ValueType("Boolean")
- val unitType = ValueType("Unit")
-
- val abbrevToValueType = Map(
- 'B' -> byteType,
- 'S' -> shortType,
- 'C' -> charType,
- 'I' -> intType,
- 'J' -> longType,
- 'F' -> floatType,
- 'D' -> doubleType,
- 'Z' -> booleanType,
- 'V' -> unitType)
-}
-
-abstract class Type {
- def elemType: Type = throw new UnsupportedOperationException
- def resultType: Type = throw new UnsupportedOperationException
- def isSubtypeOf(that: Type): Boolean = throw new UnsupportedOperationException
-}
-
-case class ValueType(name: String) extends Type {
- override def toString = name
- override def isSubtypeOf(that: Type) = this == that
-}
-case class ClassType(private val clazz: ClassInfo) extends Type {
- override def toString = ClassInfo.formatClassName(clazz.fullName)
-
- override def isSubtypeOf(that: Type) = that match {
- case ClassType(thatClazz) =>
- if(thatClazz.isTrait) clazz.allTraits.exists(_.fullName == thatClazz.fullName)
- else clazz.superClasses.exists(_.fullName == thatClazz.fullName)
- case _ => false
- }
-}
-case class ArrayType(override val elemType: Type) extends Type {
- override def toString = "Array["+elemType+"]"
- override def isSubtypeOf(that: Type) = this == that
-}
-case class MethodType(paramTypes: List[Type], override val resultType: Type) extends Type {
- override def toString = paramTypes.mkString("(", ",", ")"+resultType)
-}
-
+package com.typesafe.tools.mima.core
+
+object Type {
+
+ val byteType = ValueType("Byte")
+ val shortType = ValueType("Short")
+ val charType = ValueType("Char")
+ val intType = ValueType("Int")
+ val longType = ValueType("Long")
+ val floatType = ValueType("Float")
+ val doubleType = ValueType("Double")
+ val booleanType = ValueType("Boolean")
+ val unitType = ValueType("Unit")
+
+ val abbrevToValueType = Map(
+ 'B' -> byteType,
+ 'S' -> shortType,
+ 'C' -> charType,
+ 'I' -> intType,
+ 'J' -> longType,
+ 'F' -> floatType,
+ 'D' -> doubleType,
+ 'Z' -> booleanType,
+ 'V' -> unitType)
+}
+
+abstract class Type {
+ def elemType: Type = throw new UnsupportedOperationException
+ def resultType: Type = throw new UnsupportedOperationException
+ def isSubtypeOf(that: Type): Boolean = throw new UnsupportedOperationException
+}
+
+case class ValueType(name: String) extends Type {
+ override def toString = name
+ override def isSubtypeOf(that: Type) = this == that
+}
+case class ClassType(private val clazz: ClassInfo) extends Type {
+ override def toString = ClassInfo.formatClassName(clazz.fullName)
+
+ override def isSubtypeOf(that: Type) = that match {
+ case ClassType(thatClazz) =>
+ if(thatClazz.isTrait) clazz.allTraits.exists(_.fullName == thatClazz.fullName)
+ else clazz.superClasses.exists(_.fullName == thatClazz.fullName)
+ case _ => false
+ }
+}
+case class ArrayType(override val elemType: Type) extends Type {
+ override def toString = "Array["+elemType+"]"
+ override def isSubtypeOf(that: Type) = this == that
+}
+case class MethodType(paramTypes: List[Type], override val resultType: Type) extends Type {
+ override def toString = paramTypes.mkString("(", ",", ")"+resultType)
+}
+
View
2  core/src/main/scala/com/typesafe/tools/mima/core/WithAccessFlags.scala
@@ -1,4 +1,4 @@
package com.typesafe.tools.mima.core
-trait WithAccessFlags extends WithAccessModifier
+trait WithAccessFlags extends WithAccessModifier
with WithLocalModifier with HasAccessFlags
View
8 core/src/main/scala/com/typesafe/tools/mima/core/WithAccessModifier.scala
@@ -16,13 +16,13 @@ trait WithAccessModifier extends HasAccessFlags {
ensureLoaded()
ClassfileParser.isPrivate(flags)
}
-
+
def isLessVisibleThan(that: WithAccessModifier) = {
- (!isPublic && that.isPublic) || (isPrivate && that.isProtected)
+ (!isPublic && that.isPublic) || (isPrivate && that.isProtected)
}
-
+
protected def ensureLoaded() {}
-
+
def accessModifier = {
if(isProtected) "protected"
else if(isPrivate) "private"
View
6 core/src/main/scala/com/typesafe/tools/mima/core/WithLocalModifier.scala
@@ -2,10 +2,10 @@ package com.typesafe.tools.mima.core
trait WithLocalModifier extends HasAccessFlags {
def isConcrete: Boolean = !isDeferred
-
+
def isDeferred: Boolean = ClassfileParser.isDeferred(flags)
-
+
def isFinal: Boolean = ClassfileParser.isFinal(flags)
-
+
def nonFinal: Boolean = !isFinal
}
View
38 core/src/main/scala/com/typesafe/tools/mima/core/util/IndentedOutput.scala
@@ -1,19 +1,19 @@
-package com.typesafe.tools.mima.core.util
-
-import com.typesafe.tools.mima.core.Config
-
-object IndentedOutput {
- var indentMargin = 2
- private var indent = 0
- def printLine(str: String) = println(" "*indent+str)
- def indented[T](op: => T): T = try {
- indent += indentMargin
- op
- } finally {
- indent -= indentMargin
- }
-}
-
-
-
-
+package com.typesafe.tools.mima.core.util
+
+import com.typesafe.tools.mima.core.Config
+
+object IndentedOutput {
+ var indentMargin = 2
+ private var indent = 0
+ def printLine(str: String) = println(" "*indent+str)
+ def indented[T](op: => T): T = try {
+ indent += indentMargin
+ op
+ } finally {
+ indent -= indentMargin
+ }
+}
+
+
+
+
View
2  core/src/main/scala/com/typesafe/tools/mima/core/util/Urls.scala
@@ -3,7 +3,7 @@ package com.typesafe.tools.mima.core.util
object Urls {
val ScalaSite = "http://www.scala-lang.org/"
val TypesafeSite = "http://typesafe.com/"
-
+
val OnlineResourceSite = "http://typesafe.com/technology/migration-manager"
val BugReportingSite = "http://github.com/typesafehub/migration-manager/issues"
}
View
2  core/src/main/scala/com/types