Skip to content

Commit

Permalink
Remove obsolete runtime version checks from turbine
Browse files Browse the repository at this point in the history
The minimum supported runtime version is now JDK 17.

PiperOrigin-RevId: 678473012
  • Loading branch information
cushon authored and Javac Team committed Sep 25, 2024
1 parent 99442e8 commit 5a874b7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 43 deletions.
8 changes: 2 additions & 6 deletions java/com/google/turbine/binder/CtSymClassBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
/** Constructs a platform {@link ClassPath} from the current JDK's ct.sym file. */
public final class CtSymClassBinder {

private static final int FEATURE_VERSION = Runtime.version().feature();

public static @Nullable ClassPath bind(int version) throws IOException {
Path ctSym;
String explicitCtSymPath = System.getProperty("turbine.ctSymPath");
Expand Down Expand Up @@ -89,10 +87,8 @@ public final class CtSymClassBinder {
if (!ze.name().substring(0, idx).contains(releaseString)) {
continue;
}
if (FEATURE_VERSION >= 12) {
// JDK >= 12 includes the module name as a prefix
idx = name.indexOf('/', idx + 1);
}
// JDK >= 12 includes the module name as a prefix
idx = name.indexOf('/', idx + 1);
if (name.substring(name.lastIndexOf('/') + 1).equals("module-info.sig")) {
ModuleInfo moduleInfo = BytecodeBinder.bindModuleInfo(name, toByteArrayOrDie(ze));
modules.put(new ModuleSymbol(moduleInfo.name()), moduleInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,5 @@ public static TestInput parse(String text) {
}
}

public static int getMajor() {
return Runtime.version().feature();
}

private IntegrationTestSupport() {}
}
5 changes: 0 additions & 5 deletions javatests/com/google/turbine/lower/ModuleIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ public ModuleIntegrationTest(String test) {

@Test
public void test() throws Exception {
if (Runtime.version().feature() < 9) {
// only run on JDK 9 and later
return;
}

IntegrationTestSupport.TestInput input =
IntegrationTestSupport.TestInput.parse(getResource(getClass(), "moduletestdata/" + test));

Expand Down
3 changes: 0 additions & 3 deletions javatests/com/google/turbine/parse/LexerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.google.turbine.parse;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assume.assumeTrue;

import com.google.common.truth.Expect;
import com.google.turbine.diag.SourceFile;
Expand Down Expand Up @@ -383,7 +382,6 @@ public static List<String> lex(String input) {

@Test
public void stripIndent() throws Exception {
assumeTrue(Runtime.version().feature() >= 13);
String[] inputs = {
"",
"hello",
Expand All @@ -404,7 +402,6 @@ public void stripIndent() throws Exception {

@Test
public void textBlockNewlineEscapes() throws Exception {
assumeTrue(Runtime.version().feature() >= 13);
String input =
"\"\"\"\n" //
+ "hello\\\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import static javax.lang.model.util.ElementFilter.methodsIn;
import static javax.lang.model.util.ElementFilter.typesIn;
import static org.junit.Assert.assertThrows;
import static org.junit.Assume.assumeTrue;

import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
Expand Down Expand Up @@ -586,7 +585,6 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment

@Test
public void recordProcessing() throws IOException {
assumeTrue(Runtime.version().feature() >= 15);
ImmutableList<Tree.CompUnit> units =
parseUnit(
"=== R.java ===", //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ObjectArrays;
import com.google.common.truth.Expect;
import com.google.turbine.binder.Binder;
import com.google.turbine.binder.ClassPathBinder;
Expand Down Expand Up @@ -160,29 +159,20 @@ public static Iterable<TestInput[]> parameters() {
"public class A {",
"}",
},
{
// interfaces
"=== A.java ===",
"interface A {",
" static void f() {}",
" int x = 42;",
"}",
"=== B.java ===",
"interface B extends A {",
" static void f() {}",
" int x = 42;",
"}",
}
};
// https://bugs.openjdk.java.net/browse/JDK-8275746
if (Runtime.version().feature() >= 11) {
inputs =
ObjectArrays.concat(
inputs,
new String[][] {
{
// interfaces
"=== A.java ===",
"interface A {",
" static void f() {}",
" int x = 42;",
"}",
"=== B.java ===",
"interface B extends A {",
" static void f() {}",
" int x = 42;",
"}",
}
},
String[].class);
}
return stream(inputs)
.map(input -> TestInput.parse(Joiner.on('\n').join(input)))
.map(x -> new TestInput[] {x})
Expand Down

0 comments on commit 5a874b7

Please sign in to comment.