Skip to content

Commit

Permalink
Prepare a golden test output for https://bugs.openjdk.org/browse/JDK-…
Browse files Browse the repository at this point in the history
…8320766

PiperOrigin-RevId: 595837447
  • Loading branch information
cushon authored and Javac Team committed Jan 5, 2024
1 parent f607f6e commit 36d32d4
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@

package com.google.turbine.lower;

import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_VERSION;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static org.junit.Assert.assertEquals;
import static com.google.common.truth.Truth.assertThat;

import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.turbine.binder.ClassPath;
import com.google.turbine.binder.CtSymClassBinder;
import com.google.turbine.binder.JimageClassBinder;
import com.google.turbine.binder.bound.ModuleInfo;
import com.google.turbine.binder.bytecode.BytecodeBoundClass;
Expand All @@ -51,10 +49,7 @@ public void test() throws Exception {
IntegrationTestSupport.runJavac(
sources, ImmutableList.of(), ImmutableList.of("--release", "9", "--module-version=42"));

ClassPath base =
Double.parseDouble(JAVA_CLASS_VERSION.value()) < 54
? JimageClassBinder.bindDefault()
: CtSymClassBinder.bind(9);
ClassPath base = JimageClassBinder.bindDefault();
ClassPath bootclasspath =
new ClassPath() {
@Override
Expand Down Expand Up @@ -93,7 +88,10 @@ public TopLevelIndex index() {
Optional.of("42"),
/* javacopts= */ ImmutableList.of());

assertEquals(dump(expected), dump(actual));
// normalize output after https://bugs.openjdk.org/browse/JDK-8320766
String expectedOutput = dump(expected).replace(" // version 9\n", "");

assertThat(dump(actual)).isEqualTo(expectedOutput);
}

private String dump(Map<String, byte[]> map) throws Exception {
Expand Down

0 comments on commit 36d32d4

Please sign in to comment.