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

CodeSig - array methods not expected #3616

Closed
bishabosha opened this issue Sep 27, 2024 · 1 comment · Fixed by #3623
Closed

CodeSig - array methods not expected #3616

bishabosha opened this issue Sep 27, 2024 · 1 comment · Fixed by #3623
Milestone

Comments

@bishabosha
Copy link
Contributor

Mill 0.11.12 (or main branch)

import mill._

def arrayCopyCommand() = T.command {
  val array = Array("a", "b", "c")
  val hash = array.hashCode
  val cloned = array.clone // invokevirtual Method "[Ljava/lang/String;".clone:()Ljava/lang/Object;
  val clonedHash = cloned.hashCode
  println(s"Original hash: $hash, cloned hash: $clonedHash")
}

Analysing this command will crash, because a method is not expected to be invoked on an array class:

1 targets failed
methodCodeHashSignatures java.lang.AssertionError: assertion failed: JType [Ljava.lang.String; contains invalid '[' characters
    scala.Predef$.assert(Predef.scala:279)
    mill.codesig.JvmModel$JType$Cls.<init>(JvmModel.scala:178)
    mill.codesig.JvmModel$SymbolTable$JCls$.$anonfun$create$4(JvmModel.scala:47)
    mill.codesig.JvmModel$SymbolTable$Table.$anonfun$get$1(JvmModel.scala:26)
    scala.collection.mutable.LinkedHashMap.getOrElseUpdate(LinkedHashMap.scala:143)
    mill.codesig.JvmModel$SymbolTable$Table.get(JvmModel.scala:26)
    mill.codesig.JvmModel$SymbolTable$JCls$.apply(JvmModel.scala:48)
    mill.codesig.JvmModel$JType$Cls$.fromSlashed(JvmModel.scala:186)
    mill.codesig.LocalSummary$MyMethodVisitor.visitMethodInsn(LocalSummary.scala:275)
@lihaoyi
Copy link
Member

lihaoyi commented Sep 28, 2024

Nice find, should be a quick fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants