Scala Programming Language
  1. Scala Programming Language
  2. SI-8114

ClassFormatError in pattern of code use by Slick

    Details

      Description

      In TypeMap, the following optimization is too eager:

      protected def noChangeToSymbols(origSyms: List[Symbol]) =
            origSyms forall (sym => sym.info eq this(sym.info))
      

      `sym.info` may still change indirectly, when
      `sym.info.typeSymbol.info ne this(sym.info.typeSymbol.info)`

      It turns out it's more than an optimization, as simply setting it to false causes other problems.

      repro:

      // derived from a real-world Slick app (support #3035)
      // running Test should not throw a java.lang.ClassFormatError: Duplicate method name&signature in class file Test$$anonfun$1 
      // workaround: uncomment type arg to list below
      
      class AbstractTable[T] { type TableElementType }
      class Table[T] extends AbstractTable[T] { type TableElementType = T }
      
      class Query[E, U]
      class TableQuery[E <: AbstractTable[_]] extends Query[E, E#TableElementType]
      
      object Test extends App {
        object MyTable extends TableQuery[Table[Long]]
      
        def list[R](q: Query[_, R]): List[R] = Nil
        list/*[Long]*/(MyTable) collect { case x => x }
      }
      

        Issue Links

          Activity

          Hide
          Adriaan Moors added a comment -

          2.11.0 is not affected because of the fix for SI-7120 in https://github.com/scala/scala/pull/2125

          Show
          Adriaan Moors added a comment - 2.11.0 is not affected because of the fix for SI-7120 in https://github.com/scala/scala/pull/2125
          Hide
          Adriaan Moors added a comment -

          I'd like to fix this in 2.10.4-RC2, if we have one.

          Show
          Adriaan Moors added a comment - I'd like to fix this in 2.10.4-RC2, if we have one.
          Hide
          Jason Zaugg added a comment - - edited

          2.10.x binary compatible workaround for the double definition symptom: https://github.com/scala/scala/pull/3345

          Show
          Jason Zaugg added a comment - - edited 2.10.x binary compatible workaround for the double definition symptom: https://github.com/scala/scala/pull/3345
          Hide
          Jason Zaugg added a comment - - edited

          Closing to note that we've worked around the ClassFormatError in 2.10.4. I'll open a new issue for the residual question about what TypeMap should do with bounds.

          Show
          Jason Zaugg added a comment - - edited Closing to note that we've worked around the ClassFormatError in 2.10.4. I'll open a new issue for the residual question about what TypeMap should do with bounds.

            People

            • Assignee:
              Adriaan Moors
              Reporter:
              Adriaan Moors
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development