Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable -Xsource:3 and reduce noise #663

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inThisBuild(Seq(
),
scmInfo := Some(ScmInfo(url("https://github.com/lightbend/mima"), "scm:git:[email protected]:lightbend/mima.git")),
dynverVTagPrefix := false,
scalacOptions := Seq("-feature", "-deprecation", "-Xlint"),
scalacOptions ++= Seq("-feature", "-Xsource:3", "-Xlint", "-Wconf:cat=deprecation&msg=Stream|JavaConverters:s"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that deprecation warning keep the rest of the deprecations showing? Intuitively I would have thought there should be an "enable deprecations" option in addition to the "oh and silence these ones", which has me confused.

Copy link
Contributor Author

@som-snytt som-snytt Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Xlint enables deprecation, and that was backported to 2.12 as well (as I did check).

Edit: you remind me that Scala 3 doesn't have -Xlint yet. I was about to restore the deprecation flag but spouse complained that I was coding at midnight and I hit PR button.

resolvers ++= (if (isStaging) List(stagingResolver) else Nil),
publishTo := Some(if (isSnapshot.value) Opts.resolver.sonatypeSnapshots else Opts.resolver.sonatypeStaging),
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object MimaUnpickler {
}

def readEnd(): Int = buf.readNat() + buf.readIndex
def readNameRef(): Name = at(buf.readNat(), readName)
def readNameRef(): Name = at(buf.readNat(), () => readName())
def readSymRef(): SymInfo = at(buf.readNat(), () => readSym(buf.readByte()))
def readSymbolRef(): SymbolInfo = at(buf.readNat(), () => readSymbol(buf.readByte()))
def readTypeRef(): TypeInfo = at(buf.readNat(), () => readType())
Expand Down Expand Up @@ -136,7 +136,7 @@ object MimaUnpickler {
}
}

for (num <- index.indices) at(num, readEntry)
for (num <- index.indices) at(num, () => readEntry())

if (doPrint) {
entries.iterator.zipWithIndex.filter(_._1 != null).foreach { case (entry, num) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ object PicklePrinter {
/** Returns the buffer as a sequence of (Int, Array[Byte]) representing
* (tag, data) of the individual entries. Saves and restores buffer state.
*/
private def toIndexedSeq(buf: PickleBuffer): IndexedSeq[(Int, Array[Byte])] = {
private def toIndexedSeq(buf: PickleBuffer): IndexedSeq[(Int, Array[Byte])] = (
for (idx <- buf.createIndex) yield {
buf.atIndex(idx) {
val tag = buf.readByte()
val len = buf.readNat()
tag -> buf.bytes.slice(buf.readIndex, buf.readIndex + len)
}
}
}
).toIndexedSeq
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on here? Looks like there's an implicit conversion from Array to immutable IndexedSeq?? Wow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is obvious in some contexts but not this one. There is not a good "just wrap my array" solution that cross-compiles.

I was about to tweak the loop to iterate once over buf to build an IndexedSeq but maybe that is overkill, and more of just an exercise one does at midnight when time seems momentarily infinite.

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ private[mima] object ProblemReporting {
val VersionRegex = """(\d+)\.?(\d+)?\.?(.*)?""".r
def int(versionPart: String) =
Try(versionPart.replace("x", Short.MaxValue.toString).filter(_.isDigit).toInt).getOrElse(0)
Ordering[(Int, Int, Int)].on[String] { case VersionRegex(x, y, z) => (int(x), int(y), int(z)) }
Ordering[(Int, Int, Int)].on[String] {
case VersionRegex(x, y, z) => (int(x), int(y), int(z))
case bad => throw new IllegalArgumentException(bad)
}
}

def isReported(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ object TastyFormat {
* Name = UTF8 Length UTF8-CodePoint*
* QUALIFIED Length qualified_NameRef selector_NameRef -- A.B
* EXPANDED Length qualified_NameRef selector_NameRef -- A$$B, semantically a NameKinds.ExpandedName
* EXPANDPREFIX Length qualified_NameRef selector_NameRef -- A$B, prefix of expanded name, see NamedKinds.ExpandPrefixName
* EXPANDPREFIX Length qualified_NameRef selector_NameRef -- A\$B, prefix of expanded name, see NamedKinds.ExpandPrefixName
*
* UNIQUE Length separator_NameRef uniqid_Nat underlying_NameRef? -- Unique name A<separator><number>
* DEFAULTGETTER Length underlying_NameRef index_Nat -- DefaultGetter$<number>
*
* SUPERACCESSOR Length underlying_NameRef -- super$A
* INLINEACCESSOR Length underlying_NameRef -- inline$A
* SUPERACCESSOR Length underlying_NameRef -- super\$A
* INLINEACCESSOR Length underlying_NameRef -- inline\$A
* OBJECTCLASS Length underlying_NameRef -- A$ (name of the module class for module A)
*
* SIGNED Length original_NameRef resultSig_NameRef ParamSig* -- name + signature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private[analyze] object FieldChecker {
if (oldfld.nonAccessible) None else {
val newflds = newclazz.lookupClassFields(oldfld)
if (newflds.hasNext) {
val newfld = newflds.next
val newfld = newflds.next()
if (!newfld.isPublic) Some(InaccessibleFieldProblem(newfld))
else if (oldfld.descriptor != newfld.descriptor) Some(IncompatibleFieldTypeProblem(oldfld, newfld))
else if (oldfld.isStatic && !newfld.isStatic) Some(StaticVirtualMemberProblem(oldfld))
Expand Down