diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 8e6ac5db2e04..1a5587960a54 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -90,7 +90,7 @@ trait ScalaSettings extends StandardScalaSettings with Warnings { _: MutableSett // TODO validate release <= java.specification.version } } withAbbreviation "--release" - def releaseValue: Option[String] = Option(release.value).filter(_ != "") + def releaseValue: Option[String] = Option(release.value).filter(_ != "") // release.valueSetByUser /** * -X "Advanced" settings diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index da93a90d72c1..0c627299ca52 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -549,7 +549,11 @@ abstract class ClassfileParser(reader: ReusableInstance[ReusableDataReader]) { val needsConstructor = ( !sawPrivateConstructor && !(instanceScope containsName nme.CONSTRUCTOR) - && ((sflags & INTERFACE) == 0 || (sflags | JAVA_ANNOTATION) != 0) + && ((sflags & INTERFACE) == 0 || (sflags & JAVA_ANNOTATION) != 0) + && { + val isSig = file.name.endsWith(".sig") + !isSig + } ) if (needsConstructor) instanceScope enter clazz.newClassConstructor(NoPosition) diff --git a/test/files/neg/t12565.check b/test/files/neg/t12565.check new file mode 100644 index 000000000000..b67443b9b545 --- /dev/null +++ b/test/files/neg/t12565.check @@ -0,0 +1,4 @@ +t12565.scala:5: error: java.time.Instant does not have a constructor + def f = new java.time.Instant + ^ +1 error diff --git a/test/files/neg/t12565.scala b/test/files/neg/t12565.scala new file mode 100644 index 000000000000..6336f90a4dd4 --- /dev/null +++ b/test/files/neg/t12565.scala @@ -0,0 +1,9 @@ +// scalac: -Werror --release 8 +// javaVersion: 9+ + +class C { + def f = new java.time.Instant +} +object Test extends App { + println(new C().f) +}