diff options
Diffstat (limited to 'javatests/com')
7 files changed, 50 insertions, 1 deletions
diff --git a/javatests/com/google/turbine/bytecode/ClassWriterTest.java b/javatests/com/google/turbine/bytecode/ClassWriterTest.java index 4ca5e36..a6f9234 100644 --- a/javatests/com/google/turbine/bytecode/ClassWriterTest.java +++ b/javatests/com/google/turbine/bytecode/ClassWriterTest.java @@ -186,6 +186,7 @@ public class ClassWriterTest { /* signature= */ null, /* superClass= */ "java/lang/Record", /* interfaces= */ ImmutableList.of(), + /* permits= */ ImmutableList.of(), /* methods= */ ImmutableList.of(), /* fields= */ ImmutableList.of(), /* annotations= */ ImmutableList.of(), @@ -240,6 +241,7 @@ public class ClassWriterTest { /* signature= */ null, /* superClass= */ null, /* interfaces= */ ImmutableList.of(), + /* permits= */ ImmutableList.of(), /* methods= */ ImmutableList.of(), /* fields= */ ImmutableList.of(), /* annotations= */ ImmutableList.of(), diff --git a/javatests/com/google/turbine/lower/LowerIntegrationTest.java b/javatests/com/google/turbine/lower/LowerIntegrationTest.java index 9e16075..db73ec0 100644 --- a/javatests/com/google/turbine/lower/LowerIntegrationTest.java +++ b/javatests/com/google/turbine/lower/LowerIntegrationTest.java @@ -44,7 +44,9 @@ import org.junit.runners.Parameterized.Parameters; public class LowerIntegrationTest { private static final ImmutableMap<String, Integer> SOURCE_VERSION = - ImmutableMap.of("record.test", 16); + ImmutableMap.of( + "record.test", 16, + "sealed.test", 17); @Parameters(name = "{index}: {0}") public static Iterable<Object[]> parameters() { @@ -60,6 +62,7 @@ public class LowerIntegrationTest { "B8148131.test", "abstractenum.test", "access1.test", + "ambiguous_identifier.test", "anno_const_coerce.test", "anno_const_scope.test", "anno_nested.test", @@ -264,6 +267,7 @@ public class LowerIntegrationTest { "record.test", "rek.test", "samepkg.test", + "sealed.test", "self.test", "semi.test", // https://bugs.openjdk.java.net/browse/JDK-8054064 ? diff --git a/javatests/com/google/turbine/lower/LowerTest.java b/javatests/com/google/turbine/lower/LowerTest.java index e560321..c679228 100644 --- a/javatests/com/google/turbine/lower/LowerTest.java +++ b/javatests/com/google/turbine/lower/LowerTest.java @@ -185,6 +185,7 @@ public class LowerTest { SourceTypeBoundClass c = new SourceTypeBoundClass( interfaceTypes, + ImmutableList.of(), xtnds, tps, access, @@ -206,6 +207,7 @@ public class LowerTest { SourceTypeBoundClass i = new SourceTypeBoundClass( ImmutableList.of(), + ImmutableList.of(), Type.ClassTy.OBJECT, ImmutableMap.of(), TurbineFlag.ACC_STATIC | TurbineFlag.ACC_PROTECTED, diff --git a/javatests/com/google/turbine/lower/testdata/ambiguous_identifier.test b/javatests/com/google/turbine/lower/testdata/ambiguous_identifier.test new file mode 100644 index 0000000..d7bbc54 --- /dev/null +++ b/javatests/com/google/turbine/lower/testdata/ambiguous_identifier.test @@ -0,0 +1,14 @@ +=== Test.java === +class Test { + static final int non = 42; + static final int sealed = 1; + // here 'non-sealed' is a binary expression subtracting two identifiers, + // not a contextual hyphenated keyword + static final int x = non-sealed; +} + +// handle backtracking when we see 'non', but it isn't part of a contextualy +// hyphenated keyword 'non-sealed' +class non { + non self; +} diff --git a/javatests/com/google/turbine/lower/testdata/sealed.test b/javatests/com/google/turbine/lower/testdata/sealed.test new file mode 100644 index 0000000..0bac7b1 --- /dev/null +++ b/javatests/com/google/turbine/lower/testdata/sealed.test @@ -0,0 +1,11 @@ +=== Sealed.java === + +sealed class Sealed permits Sealed.Foo, Sealed.Bar { + static final class Foo extends Sealed {} + static final class Bar extends Sealed {} +} + +sealed interface ISealed permits ISealed.Foo, ISealed.Bar { + static final class Foo implements ISealed {} + static non-sealed class Bar implements ISealed {} +} diff --git a/javatests/com/google/turbine/parse/ParserIntegrationTest.java b/javatests/com/google/turbine/parse/ParserIntegrationTest.java index ade6bf0..2f37a84 100644 --- a/javatests/com/google/turbine/parse/ParserIntegrationTest.java +++ b/javatests/com/google/turbine/parse/ParserIntegrationTest.java @@ -76,6 +76,7 @@ public class ParserIntegrationTest { "type_annotations.input", "module-info.input", "record.input", + "sealed.input", }; return Iterables.transform( Arrays.asList(tests), diff --git a/javatests/com/google/turbine/parse/testdata/sealed.input b/javatests/com/google/turbine/parse/testdata/sealed.input new file mode 100644 index 0000000..5a277b8 --- /dev/null +++ b/javatests/com/google/turbine/parse/testdata/sealed.input @@ -0,0 +1,15 @@ +sealed class Sealed permits Sealed.Foo, Sealed.Bar { + static final class Foo extends Sealed { + } + + static final class Bar extends Sealed { + } +} + +sealed interface ISealed permits ISealed.Foo, ISealed.Bar { + static final class Foo implements ISealed { + } + + static non-sealed class Bar implements ISealed { + } +} |