Skip to content

Commit

Permalink
Merge pull request #10676 from SethTisue/merge-2.12-to-2.13-20240126
Browse files Browse the repository at this point in the history
Merge 2.12. to 2.13 [ci: last-only]
  • Loading branch information
SethTisue committed Jan 26, 2024
2 parents 30cfb3c + 7d3e96b commit 25f7035
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Expand Up @@ -31,9 +31,9 @@ templates: # this has no effect on travis, it's just a place to put our template
name: build, publishLocal, build again
script:
- set -e
- sbt -Dsbt.io.jdktimestamps=true -Dsbt.scala.version=2.12.18-M2 setupPublishCore generateBuildCharacterPropertiesFile headerCheck publishLocal
- sbt -Dsbt.io.jdktimestamps=true setupPublishCore generateBuildCharacterPropertiesFile headerCheck publishLocal
- STARR=$(sed -n 's/^maven\.version\.number=//p' buildcharacter.properties) && echo $STARR
- sbt -Dsbt.io.jdktimestamps=true -Dsbt.scala.version=2.12.18-M2 -Dstarr.version=$STARR setupValidateTest compile
- sbt -Dsbt.io.jdktimestamps=true -Dstarr.version=$STARR setupValidateTest compile
workspaces:
create:
name: bootstrapped
Expand All @@ -57,7 +57,7 @@ templates: # this has no effect on travis, it's just a place to put our template
script:
- set -e
- STARR=$(sed -n 's/^maven\.version\.number=//p' buildcharacter.properties) && echo $STARR
- sbt -Dsbt.io.jdktimestamps=true -Dsbt.scala.version=2.12.18-M2 -Dstarr.version=$STARR setupValidateTest Test/compile testAll1
- sbt -Dsbt.io.jdktimestamps=true -Dstarr.version=$STARR setupValidateTest Test/compile testAll1

test2: &test2
stage: test
Expand All @@ -67,7 +67,7 @@ templates: # this has no effect on travis, it's just a place to put our template
script:
- set -e
- STARR=$(sed -n 's/^maven\.version\.number=//p' buildcharacter.properties) && echo $STARR
- sbt -Dsbt.io.jdktimestamps=true -Dsbt.scala.version=2.12.18-M2 -Dstarr.version=$STARR setupValidateTest testAll2
- sbt -Dsbt.io.jdktimestamps=true -Dstarr.version=$STARR setupValidateTest testAll2

jobs:
include:
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
script:
- set -e
- STARR=$(sed -n 's/^maven\.version\.number=//p' buildcharacter.properties) && echo $STARR
- sbt -Dsbt.io.jdktimestamps=true -Dsbt.scala.version=2.12.18-M2 -Dscala.build.compileWithDotty=true library/compile
- sbt -Dsbt.io.jdktimestamps=true -Dscala.build.compileWithDotty=true library/compile

- name: build benchmarks
if: type = pull_request OR repo != scala/scala
Expand All @@ -126,7 +126,7 @@ jobs:
script:
- set -e
- STARR=$(sed -n 's/^maven\.version\.number=//p' buildcharacter.properties) && echo $STARR
- sbt -Dsbt.io.jdktimestamps=true -Dsbt.scala.version=2.12.18-M2 bench/Jmh/compile
- sbt -Dsbt.io.jdktimestamps=true bench/Jmh/compile

- stage: build
if: type = pull_request OR type = push
Expand Down
2 changes: 1 addition & 1 deletion scripts/common
Expand Up @@ -15,7 +15,7 @@ SBT_VERSION=`grep sbt.version $WORKSPACE/project/build.properties | sed -n 's/sb
SBT_CMD=${SBT_CMD-sbt}
# the jdktimestamps thing is to work around https://github.com/sbt/sbt/issues/7463 --
# it can be removed again once we're on an sbt version with a fix
SBT_CMD="$SBT_CMD -Dsbt.io.jdktimestamps=true -Dsbt.scala.version=2.12.18-M2 -sbt-version $SBT_VERSION"
SBT_CMD="$SBT_CMD -Dsbt.io.jdktimestamps=true -sbt-version $SBT_VERSION"

# repo to publish builds
integrationRepoUrl=${integrationRepoUrl-"https://scala-ci.typesafe.com/artifactory/scala-integration/"}
Expand Down
Expand Up @@ -225,7 +225,7 @@ abstract class ClassfileParser(reader: ReusableInstance[ReusableDataReader]) {
case CONSTANT_METHODHANDLE => in skip 3
case CONSTANT_FIELDREF | CONSTANT_METHODREF | CONSTANT_INTFMETHODREF => in skip 4
case CONSTANT_NAMEANDTYPE | CONSTANT_INTEGER | CONSTANT_FLOAT => in skip 4
case CONSTANT_INVOKEDYNAMIC => in skip 4
case CONSTANT_DYNAMIC | CONSTANT_INVOKEDYNAMIC => in skip 4
case CONSTANT_LONG | CONSTANT_DOUBLE => in skip 8 ; i += 1
case _ => errorBadTag(in.bp - 1)
}
Expand Down
Expand Up @@ -81,6 +81,7 @@ object ClassfileConstants {
final val CONSTANT_NAMEANDTYPE = 12
final val CONSTANT_METHODHANDLE = 15
final val CONSTANT_METHODTYPE = 16
final val CONSTANT_DYNAMIC = 17
final val CONSTANT_INVOKEDYNAMIC = 18
final val CONSTANT_MODULE = 19
final val CONSTANT_PACKAGE = 20
Expand Down
17 changes: 17 additions & 0 deletions test/files/pos/t12396/A_1.java
@@ -0,0 +1,17 @@
// javaVersion: 21+

public class A_1 {
public int f(Object s) {
switch(s) {
case Res.R -> {
return 1;
}
default -> {
return 3;
}
}
}
static enum Res {
R
}
}
5 changes: 5 additions & 0 deletions test/files/pos/t12396/B_2.scala
@@ -0,0 +1,5 @@
// javaVersion: 21+

class B {
def bar = (new A_1).f(null)
}
31 changes: 31 additions & 0 deletions test/junit/scala/tools/nsc/backend/jvm/ClassfileParserTest.scala
@@ -0,0 +1,31 @@
package scala.tools.nsc.backend.jvm

import org.junit.Assert.assertEquals
import org.junit.Test

import java.lang.reflect.Member

class ClassfileParserTest {
@Test
def noConstantPoolLag(): Unit = {
def constNames(ms: List[Member]) = ms.collect {
case f if f.getName.startsWith("CONSTANT_") => f.getName
}.sorted

val toScalac = Map(
"CONSTANT_INTERFACE_METHODREF" -> "CONSTANT_INTFMETHODREF",
"CONSTANT_INVOKE_DYNAMIC" -> "CONSTANT_INVOKEDYNAMIC",
"CONSTANT_METHOD_HANDLE" -> "CONSTANT_METHODHANDLE",
"CONSTANT_METHOD_TYPE" -> "CONSTANT_METHODTYPE",
"CONSTANT_NAME_AND_TYPE" -> "CONSTANT_NAMEANDTYPE",
).withDefault(x => x)

val asmConsts = constNames(Class.forName("scala.tools.asm.Symbol").getDeclaredFields.toList)
.map(_.stripSuffix("_TAG"))
.map(toScalac)
.::("CONSTANT_UNICODE")
.sorted
val scalacConsts = constNames(scala.reflect.internal.ClassfileConstants.getClass.getDeclaredMethods.toList)
assertEquals(scalacConsts, asmConsts)
}
}

0 comments on commit 25f7035

Please sign in to comment.