This thread is for updates and discussions about the upcoming Scala 2.13.12 release.
As of yet, we don’t know much about the release’s likely timing or contents…
…except that we will address the regressions mentioned in the 2.13.11 release notes:
Exhaustivity checker emits spurious warning when matching on Java enum type (2.13.11 regression) (scala/bug#12800)
Duplicated @Deprecated annotations when extending Java interface with deprecated default method cause java.lang.annotation.AnnotationFormatError when accessed via Java reflection (2.13.11 regression) (scala/bug#12799)
It also most likely seems that the latest compiler-bridge sources in the Zinc repository can be successfully compiled for Scala 2.13.12 on the fly. I will open a separate discussion for this, to clarify some points.
Hopefully this has now settled down. The new RC is 2.13.12-bin-f7e30a6. The community build is already green. Let’s keep the same target dates: publish to Maven Central on Wed Sep 6, announce on Mon Sep 11 (just before Scala Days).
We’re now seeing more method isAnnotationType in trait Play2TemplateWrapperBase defined without a parameter list overrides method isAnnotationType in class ScTypeDefinitionImpl defined with a single empty parameter list type of warnings/errors than in the previous RC. Is this expected?
The warnings seem a bit strange. It seems like there are warnings issued across sbt subprojects, but not in the same subproject.
class BClass extends BaseTrait {
// there is no override here
// warning issued (defined without a parameter list overrides method with single empty parameter list
}
I’m typing this without trying it in a separate small reproduction project, just observation from a large one. I will try to open a ticket with a small reproduction tomorrow.
Your example should not warn as the mismatch is between Java and Scala, and it doesn’t warn in my testing (compiling the Java interface first, then the first Scala file, then the second).
Can you double-check all isAnnotationType methods defined in Scala are consistent?
The error in sbt is the following (copy pasted verbatim):
[error] /Users/vasil/Code/scala-plugin-for-ultimate/play/src/com/intellij/scala/play/language/psi/light/Play2ObjectWrapper.scala:26:13: method isAnnotationType in trait Play2TemplateWrapperBase defined without a parameter list overrides method isAnnotationType in class ScTypeDefinitionImpl defined with a single empty parameter list
[error] final class Play2ObjectWrapper private[language](stub: ScTemplateDefinitionStub[ScObject],
The definition of Play2ObjectWrapper is the following (unfortunately, this is a closed source module, so I have to copy paste it).
final class Play2ObjectWrapper private[language](stub: ScTemplateDefinitionStub[ScObject],
nodeType: ScTemplateDefinitionElementType[ScObject],
node: ASTNode,
debugName: String)
extends ScObjectImpl(stub, nodeType, node, debugName)
with ScDeclarationSequenceHolder
with Play2TemplateImportHolder
with Play2TemplateWrapperBase[ScObject] { ... }
Worth noting is that Play2ObjectWrapper and Play2TemplateWrapperBase (let’s call it play2) are defined in a separate sbt subproject, while ScTypeDefinitionImpl and PsiClassFake are defined in another (let’s call it scala-impl). play2 depends on scala-impl.
ScTypeDefinitionImpl is an abstract class. In the same subproject, there is a another concrete class ScClassImpl, and no warnings are issued for this one. There are others as well, this is just an example.
trait B extends A {
override def someNumber: Int = 1
}
abstract class C extends B {
override def someNumber: Int = 2
}
trait D extends B { self: C =>
override def someNumber: Int = 3
}
class E extends C with D // Warning issued
Edit: For the record, this does not issue the warning, I’m just brainstorming.
This is just a PSA for :paste -java in forthcoming REPL. Here is its modest debut:
➜ skala -Xlint -nobootcp
Welcome to Scala 2.13.12-20230830-200406-f7e30a6 (OpenJDK 64-Bit Server VM, Java 20.0.1).
Type in expressions for evaluation. Or try :help.
scala> :paste -java
// Entering paste mode (ctrl-D to finish)
package p;
public interface A {
int someNumber();
}
// Exiting paste mode, now interpreting.
scala> trait B extends p.A { override def someNumber: Int = 1 }
trait B
scala> abstract class C extends B { override def someNumber: Int = 2 }
class C
scala> trait D extends B { self: C => override def someNumber: Int = 3 }
trait D
scala> class E extends C with D
class E
In some context, I recently considered that override is permitted but not required when a self-type is present. Here, Y is not an X, and the warning is for the mixin.
scala> class X { def f() = 42 }
class X
scala> trait Y { _: X => override def f = 27 }
trait Y
scala> class Z extends X with Y
^
warning: method f in trait Y defined without a parameter list overrides method f in class X defined with a single empty parameter list
class Z
There are two code paths that lead to the “method … without a parameter list overrides … method … with a single empty” warning. Could you maybe attach a debugger to sbt and set a breakpoint in def warnAdaptedNullaryOverride? That would at least tell us if we get there through the NullaryOverrideAdapted attachment or the new code path (most likely). And if you poke around maybe you can find some hints why ScTypeDefinitionImpl.isAnnotationType has an empty parameter list, even though it’s defined without?
Lukas and I talked on Discord, he managed to reproduce the warnings that we’re seeing in the Scala Plugin for IntelliJ codebase and he’s investigating.