OpenJDK / amber / amber
changeset 57904:c3e3f3b41490 amber-demo-II
Automatic merge with records-and-sealed
author | mcimadamore |
---|---|
date | Thu, 10 Oct 2019 17:36:01 +0000 |
parents | 027c1e2a196b 4e5c9c683088 |
children | 875054312830 |
files | test/langtools/lib/combo/tools/javac/combo/Diagnostics.java test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java test/langtools/lib/combo/tools/javac/combo/Template.java test/langtools/lib/combo/tools/javac/combo/TemplateTest.java test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java test/langtools/tools/javac/lambda/bridge/template_tests/BridgeMethodTestCase.java test/langtools/tools/javac/sealed/SealedCompilationTests.java |
diffstat | 9 files changed, 176 insertions(+), 318 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/langtools/lib/combo/tools/javac/combo/CompilationTestCase.java Thu Oct 10 17:36:01 2019 +0000 @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package tools.javac.combo; + +import java.io.IOException; + +import org.testng.ITestResult; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import static java.util.stream.Collectors.toList; + +/** + * Base class for negative and positive compilation tests. + * + * @author Brian Goetz + */ +@Test +public class CompilationTestCase extends JavacTemplateTestBase { + private String[] compileOptions = new String[] { }; + private String defaultFileName = "Source.java"; + private String programShell = "#"; + + @AfterMethod + public void dumpTemplateIfError(ITestResult result) { + // Make sure offending template ends up in log file on failure + if (!result.isSuccess()) { + System.err.printf("Diagnostics: %s%nTemplate: %s%n", diags.errorKeys(), + sourceFiles.stream().map(p -> p.snd).collect(toList())); + } + } + + protected void setProgramShell(String shell) { + programShell = shell; + } + + protected void setCompileOptions(String... options) { + compileOptions = options.clone(); + } + + protected void setDefaultFilename(String name) { + defaultFileName = name; + } + + private String expand(String... constructs) { + String s = programShell; + for (String c : constructs) + s = s.replace("#", c); + return s; + } + + private void assertCompile(String program, Runnable postTest) { + reset(); + addCompileOptions(compileOptions); + addSourceFile(defaultFileName, program); + try { + compile(); + } + catch (IOException e) { + throw new RuntimeException(e); + } + postTest.run(); + } + + protected void assertOK(String... constructs) { + assertCompile(expand(constructs), this::assertCompileSucceeded); + } + + protected void assertOKWithWarning(String warning, String... constructs) { + assertCompile(expand(constructs), () -> assertCompileSucceededWithWarning(warning)); + } + + protected void assertFail(String expectedDiag, String... constructs) { + assertCompile(expand(constructs), () -> assertCompileFailed(expectedDiag)); + } +}
--- a/test/langtools/lib/combo/tools/javac/combo/Diagnostics.java Thu Oct 10 16:16:05 2019 +0000 +++ b/test/langtools/lib/combo/tools/javac/combo/Diagnostics.java Thu Oct 10 17:36:01 2019 +0000 @@ -39,16 +39,15 @@ public class Diagnostics implements javax.tools.DiagnosticListener<JavaFileObject> { protected List<Diagnostic<? extends JavaFileObject>> diags = new ArrayList<>(); - protected boolean foundErrors = false; public void report(Diagnostic<? extends JavaFileObject> diagnostic) { diags.add(diagnostic); - foundErrors = foundErrors || diagnostic.getKind() == Diagnostic.Kind.ERROR; } /** Were there any errors found? */ public boolean errorsFound() { - return foundErrors; + return diags.stream() + .anyMatch(d -> d.getKind() == Diagnostic.Kind.ERROR); } /** Get all diagnostic keys */ @@ -85,6 +84,5 @@ /** Clear all diagnostic state */ public void reset() { diags.clear(); - foundErrors = false; } }
--- a/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java Thu Oct 10 16:16:05 2019 +0000 +++ b/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java Thu Oct 10 17:36:01 2019 +0000 @@ -77,12 +77,9 @@ protected final Map<String, Template> templates = new HashMap<>(); protected final Diagnostics diags = new Diagnostics(); - protected final List<Pair<String, Template>> sourceFiles = new ArrayList<>(); + protected final List<Pair<String, String>> sourceFiles = new ArrayList<>(); protected final List<String> compileOptions = new ArrayList<>(); protected final List<File> classpaths = new ArrayList<>(); - protected final Template.Resolver defaultResolver = new MapResolver(templates); - - private Template.Resolver currentResolver = defaultResolver; /** Add a template with a specified name */ protected void addTemplate(String name, Template t) { @@ -95,8 +92,8 @@ } /** Add a source file */ - protected void addSourceFile(String name, Template t) { - sourceFiles.add(new Pair<>(name, t)); + protected void addSourceFile(String name, String template) { + sourceFiles.add(new Pair<>(name, template)); } /** Add a File to the class path to be used when loading classes; File values @@ -149,7 +146,7 @@ List<Object> list = new ArrayList<>(); Collections.addAll(list, result.getParameters()); list.add("Test case: " + getTestCaseDescription()); - for (Pair<String, Template> e : sourceFiles) + for (Pair<String, String> e : sourceFiles) list.add("Source file " + e.fst + ": " + e.snd); if (diags.errorsFound()) list.add("Compile diagnostics: " + diags.toString()); @@ -231,16 +228,6 @@ fail("Expected compilation error " + k); } - /** Convert an object, which may be a Template or a String, into a Template */ - protected Template asTemplate(Object o) { - if (o instanceof Template) - return (Template) o; - else if (o instanceof String) - return new StringTemplate((String) o); - else - return new StringTemplate(o.toString()); - } - /** Compile all registered source files */ protected void compile() throws IOException { compile(false); @@ -250,8 +237,8 @@ * and returning a File describing the directory to which they were written */ protected File compile(boolean generate) throws IOException { List<JavaFileObject> files = new ArrayList<>(); - for (Pair<String, Template> e : sourceFiles) - files.add(new FileAdapter(e.fst, asTemplate(e.snd))); + for (Pair<String, String> e : sourceFiles) + files.add(new FileAdapter(e.fst, e.snd)); return compile(classpaths, files, generate); } @@ -260,8 +247,8 @@ * and returning a File describing the directory to which they were written */ protected File compile(List<File> classpaths, boolean generate) throws IOException { List<JavaFileObject> files = new ArrayList<>(); - for (Pair<String, Template> e : sourceFiles) - files.add(new FileAdapter(e.fst, asTemplate(e.snd))); + for (Pair<String, String> e : sourceFiles) + files.add(new FileAdapter(e.fst, e.snd)); return compile(classpaths, files, generate); } @@ -299,79 +286,28 @@ } /** An implementation of Template which is backed by a String */ - protected class StringTemplate implements Template { + private class StringTemplate implements Template { protected final String template; public StringTemplate(String template) { this.template = template; } - public String expand(String selector) { - return Behavior.expandTemplate(template, currentResolver); + public String expand(String selectorIgnored) { + return Template.expandTemplate(template, templates); } public String toString() { return expand(""); } - - public StringTemplate with(final String key, final String value) { - return new StringTemplateWithResolver(template, new KeyResolver(key, value)); - } - - } - - /** An implementation of Template which is backed by a String and which - * encapsulates a Resolver for resolving embedded tags. */ - protected class StringTemplateWithResolver extends StringTemplate { - private final Resolver localResolver; - - public StringTemplateWithResolver(String template, Resolver localResolver) { - super(template); - this.localResolver = localResolver; - } - - @Override - public String expand(String selector) { - Resolver saved = currentResolver; - currentResolver = new ChainedResolver(currentResolver, localResolver); - try { - return super.expand(selector); - } - finally { - currentResolver = saved; - } - } - - @Override - public StringTemplate with(String key, String value) { - return new StringTemplateWithResolver(template, new ChainedResolver(localResolver, new KeyResolver(key, value))); - } - } - - /** A Resolver which uses a Map to resolve tags */ - private class KeyResolver implements Template.Resolver { - private final String key; - private final String value; - - public KeyResolver(String key, String value) { - this.key = key; - this.value = value; - } - - @Override - public Template lookup(String k) { - return key.equals(k) ? new StringTemplate(value) : null; - } } private class FileAdapter extends SimpleJavaFileObject { - private final String filename; - private final Template template; + private final String templateString; - public FileAdapter(String filename, Template template) { + FileAdapter(String filename, String templateString) { super(URI.create("myfo:/" + filename), Kind.SOURCE); - this.template = template; - this.filename = filename; + this.templateString = templateString; } public CharSequence getCharContent(boolean ignoreEncodingErrors) { @@ -379,7 +315,7 @@ } public String toString() { - return Template.Behavior.expandTemplate(template.expand(filename), defaultResolver); + return Template.expandTemplate(templateString, templates); } } }
--- a/test/langtools/lib/combo/tools/javac/combo/Template.java Thu Oct 10 16:16:05 2019 +0000 +++ b/test/langtools/lib/combo/tools/javac/combo/Template.java Thu Oct 10 17:36:01 2019 +0000 @@ -24,6 +24,7 @@ package tools.javac.combo; import java.util.Map; +import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -32,14 +33,11 @@ * {@code #\{KEY.SUBKEY\}} can be expanded. */ public interface Template { + static final Pattern KEY_PATTERN = Pattern.compile("#\\{([A-Z_][A-Z0-9_]*(?:\\[\\d+\\])?)(?:\\.([A-Z0-9_]*))?\\}"); + String expand(String selector); - interface Resolver { - public Template lookup(String key); - } - - public static class Behavior { - /* Looks for expandable keys. An expandable key can take the form: + /* Looks for expandable keys. An expandable key can take the form: * #{MAJOR} * #{MAJOR.} * #{MAJOR.MINOR} @@ -56,69 +54,36 @@ * However, this being a general-purpose framework, the exact * use is left up to the test writers. */ - private static final Pattern pattern = Pattern.compile("#\\{([A-Z_][A-Z0-9_]*(?:\\[\\d+\\])?)(?:\\.([A-Z0-9_]*))?\\}"); + public static String expandTemplate(String template, + Map<String, Template> vars) { + return expandTemplate(template, vars::get); + } - public static String expandTemplate(String template, final Map<String, Template> vars) { - return expandTemplate(template, new MapResolver(vars)); - } + private static String expandTemplate(String template, Function<String, Template> resolver) { + CharSequence in = template; + StringBuffer out = new StringBuffer(); + while (true) { + boolean more = false; + Matcher m = KEY_PATTERN.matcher(in); + while (m.find()) { + String major = m.group(1); + String minor = m.group(2); + Template key = resolver.apply(major); + if (key == null) + throw new IllegalStateException("Unknown major key " + major); - public static String expandTemplate(String template, Resolver res) { - CharSequence in = template; - StringBuffer out = new StringBuffer(); - while (true) { - boolean more = false; - Matcher m = pattern.matcher(in); - while (m.find()) { - String major = m.group(1); - String minor = m.group(2); - Template key = res.lookup(major); - if (key == null) - throw new IllegalStateException("Unknown major key " + major); - - String replacement = key.expand(minor == null ? "" : minor); - more |= pattern.matcher(replacement).find(); - m.appendReplacement(out, replacement); - } - m.appendTail(out); - if (!more) - return out.toString(); - else { - in = out; - out = new StringBuffer(); - } + String replacement = key.expand(minor == null ? "" : minor); + more |= KEY_PATTERN.matcher(replacement).find(); + m.appendReplacement(out, replacement); + } + m.appendTail(out); + if (!more) + return out.toString(); + else { + in = out; + out = new StringBuffer(); } } - } } -class MapResolver implements Template.Resolver { - private final Map<String, Template> vars; - - public MapResolver(Map<String, Template> vars) {this.vars = vars;} - - public Template lookup(String key) { - return vars.get(key); - } -} - -class ChainedResolver implements Template.Resolver { - private final Template.Resolver upstreamResolver, thisResolver; - - public ChainedResolver(Template.Resolver upstreamResolver, Template.Resolver thisResolver) { - this.upstreamResolver = upstreamResolver; - this.thisResolver = thisResolver; - } - - public Template.Resolver getUpstreamResolver() { - return upstreamResolver; - } - - @Override - public Template lookup(String key) { - Template result = thisResolver.lookup(key); - if (result == null) - result = upstreamResolver.lookup(key); - return result; - } -}
--- a/test/langtools/lib/combo/tools/javac/combo/TemplateTest.java Thu Oct 10 16:16:05 2019 +0000 +++ b/test/langtools/lib/combo/tools/javac/combo/TemplateTest.java Thu Oct 10 17:36:01 2019 +0000 @@ -42,7 +42,7 @@ void before() { vars.clear(); } private void assertTemplate(String expected, String template) { - String result = Template.Behavior.expandTemplate(template, vars); + String result = Template.expandTemplate(template, vars); assertEquals(result, expected, "for " + template); }
--- a/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java Thu Oct 10 16:16:05 2019 +0000 +++ b/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java Thu Oct 10 17:36:01 2019 +0000 @@ -27,12 +27,13 @@ import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; +import tools.javac.combo.CompilationTestCase; import tools.javac.combo.JavacTemplateTestBase; import static java.util.stream.Collectors.toList; @Test -public class ExpSwitchNestingTest extends JavacTemplateTestBase { +public class ExpSwitchNestingTest extends CompilationTestCase { private static final String RUNNABLE = "Runnable r = () -> { # };"; private static final String INT_FN = "java.util.function.IntSupplier r = () -> { # };"; private static final String LABEL = "label: #"; @@ -68,61 +69,15 @@ private static final List<String> CONTAINER_STATEMENTS = List.of(FOR, WHILE, DO, SSWITCH, IF, BLOCK); - @AfterMethod - public void dumpTemplateIfError(ITestResult result) { - // Make sure offending template ends up in log file on failure - if (!result.isSuccess()) { - System.err.printf("Diagnostics: %s%nTemplate: %s%n", diags.errorKeys(), sourceFiles.stream().map(p -> p.snd).collect(toList())); - } - } - + // @@@ When expression switch becomes a permanent feature, we don't need these any more private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", Integer.toString(Runtime.version().feature())}; + private static final String SHELL = "class C { static boolean cond = false; static int x = 0; void m() { # } }"; - private void program(String... constructs) { - String s = "class C { static boolean cond = false; static int x = 0; void m() { # } }"; - for (String c : constructs) - s = s.replace("#", c); - addSourceFile("C.java", new StringTemplate(s)); - } - - private void assertOK(String... constructs) { - reset(); - addCompileOptions(PREVIEW_OPTIONS); - program(constructs); - try { - compile(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - assertCompileSucceeded(); - } - - private void assertOKWithWarning(String warning, String... constructs) { - reset(); - addCompileOptions(PREVIEW_OPTIONS); - program(constructs); - try { - compile(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - assertCompileSucceededWithWarning(warning); - } - - private void assertFail(String expectedDiag, String... constructs) { - reset(); - addCompileOptions(PREVIEW_OPTIONS); - program(constructs); - try { - compile(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - assertCompileFailed(expectedDiag); + { + setDefaultFilename("C.java"); + setCompileOptions(PREVIEW_OPTIONS); + setProgramShell(SHELL); } public void testReallySimpleCases() {
--- a/test/langtools/tools/javac/lambda/bridge/template_tests/BridgeMethodTestCase.java Thu Oct 10 16:16:05 2019 +0000 +++ b/test/langtools/tools/javac/lambda/bridge/template_tests/BridgeMethodTestCase.java Thu Oct 10 17:36:01 2019 +0000 @@ -111,11 +111,11 @@ ClassModel cm = new Parser(spec).parseClassModel(); for (int i = 0; i <= cm.maxIndex() ; i++) { if (debug) System.out.println(indexClass(i)); - addSourceFile(String.format("C%d.java", i), new StringTemplate(indexClass(i))); + addSourceFile(String.format("C%d.java", i), indexClass(i)); } for (Map.Entry<String, ClassModel> e : classes(cm).entrySet()) { if (debug) System.out.println(e.getValue().toSource()); - addSourceFile(e.getKey() + ".java", new StringTemplate(e.getValue().toSource())); + addSourceFile(e.getKey() + ".java", e.getValue().toSource()); } compileDirs.add(compile(true)); resetSourceFiles(); @@ -133,11 +133,11 @@ List<String> nameList = Arrays.asList(names); ClassModel cm = new Parser(spec).parseClassModel(); for (int i = 0; i <= cm.maxIndex() ; i++) { - addSourceFile(String.format("C%d.java", i), new StringTemplate(indexClass(i))); + addSourceFile(String.format("C%d.java", i), indexClass(i)); } for (Map.Entry<String, ClassModel> e : classes(cm).entrySet()) if (nameList.contains(e.getKey())) - addSourceFile(e.getKey() + ".java", new StringTemplate(e.getValue().toSource())); + addSourceFile(e.getKey() + ".java", e.getValue().toSource()); compileDirs.add(compile(Arrays.asList(classPaths()), true)); resetSourceFiles(); assertCompileSucceeded();
--- a/test/langtools/tools/javac/records/RecordCompilationTests.java Thu Oct 10 16:16:05 2019 +0000 +++ b/test/langtools/tools/javac/records/RecordCompilationTests.java Thu Oct 10 17:36:01 2019 +0000 @@ -23,7 +23,6 @@ * questions. */ -import java.io.IOException; import java.lang.annotation.ElementType; import java.util.EnumMap; import java.util.EnumSet; @@ -31,13 +30,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.testng.ITestResult; -import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; -import tools.javac.combo.JavacTemplateTestBase; +import tools.javac.combo.CompilationTestCase; import static java.lang.annotation.ElementType.*; -import static java.util.stream.Collectors.toList; import static org.testng.Assert.assertEquals; /** @@ -50,7 +46,11 @@ * @run testng RecordCompilationTests */ @Test -public class RecordCompilationTests extends JavacTemplateTestBase { +public class RecordCompilationTests extends CompilationTestCase { + + // @@@ When records become a permanent feature, we don't need these any more + private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", + Integer.toString(Runtime.version().feature())}; private static final List<String> BAD_COMPONENT_NAMES = List.of( "clone", "finalize", "getClass", "hashCode", @@ -59,55 +59,11 @@ "serialVersionUID", "toString", "wait", "writeReplace"); - // @@@ When records become a permanent feature, we don't need these any more - private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", - Integer.toString(Runtime.version().feature())}; - - // -- test framework code -- - - @AfterMethod - public void dumpTemplateIfError(ITestResult result) { - // Make sure offending template ends up in log file on failure - if (!result.isSuccess()) { - System.err.printf("Diagnostics: %s%nTemplate: %s%n", diags.errorKeys(), - sourceFiles.stream().map(p -> p.snd).collect(toList())); - } + { + setDefaultFilename("R.java"); + setCompileOptions(PREVIEW_OPTIONS); } - private String expand(String... constructs) { - String s = "#"; - for (String c : constructs) - s = s.replace("#", c); - return s; - } - - private void assertCompile(String program, Runnable postTest) { - reset(); - addCompileOptions(PREVIEW_OPTIONS); - addSourceFile("R.java", new StringTemplate(program)); - try { - compile(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - postTest.run(); - } - - private void assertOK(String... constructs) { - assertCompile(expand(constructs), this::assertCompileSucceeded); - } - - private void assertOKWithWarning(String warning, String... constructs) { - assertCompile(expand(constructs), () -> assertCompileSucceededWithWarning(warning)); - } - - private void assertFail(String expectedDiag, String... constructs) { - assertCompile(expand(constructs), () -> assertCompileFailed(expectedDiag)); - } - - // -- Actual test cases start here -- - public void testMalformedDeclarations() { assertFail("compiler.err.premature.eof", "record R()"); assertFail("compiler.err.premature.eof", "record R();");
--- a/test/langtools/tools/javac/sealed/SealedCompilationTests.java Thu Oct 10 16:16:05 2019 +0000 +++ b/test/langtools/tools/javac/sealed/SealedCompilationTests.java Thu Oct 10 17:36:01 2019 +0000 @@ -33,74 +33,23 @@ * @run testng SealedCompilationTests */ -import java.io.IOException; -import java.lang.annotation.ElementType; -import java.util.EnumMap; -import java.util.EnumSet; import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.testng.ITestResult; -import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; -import tools.javac.combo.JavacTemplateTestBase; - -import static java.lang.annotation.ElementType.*; -import static java.util.stream.Collectors.toList; -import static org.testng.Assert.assertEquals; +import tools.javac.combo.CompilationTestCase; @Test -public class SealedCompilationTests extends JavacTemplateTestBase { +public class SealedCompilationTests extends CompilationTestCase { - // @@@ When sealed types become a permanent feature, we don't need these any more - private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", "14"}; + // @@@ When records become a permanent feature, we don't need these any more + private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", + Integer.toString(Runtime.version().feature())}; - // -- test framework code -- - - @AfterMethod - public void dumpTemplateIfError(ITestResult result) { - // Make sure offending template ends up in log file on failure - if (!result.isSuccess()) { - System.err.printf("Diagnostics: %s%nTemplate: %s%n", diags.errorKeys(), - sourceFiles.stream().map(p -> p.snd).collect(toList())); - } + { + setDefaultFilename("SealedTest.java"); + setCompileOptions(PREVIEW_OPTIONS); } - private String expand(String... constructs) { - String s = "#"; - for (String c : constructs) - s = s.replace("#", c); - return s; - } - - private void assertCompile(String program, Runnable postTest) { - reset(); - addCompileOptions(PREVIEW_OPTIONS); - addSourceFile("SealedTest.java", new StringTemplate(program)); - try { - compile(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - postTest.run(); - } - - private void assertOK(String... constructs) { - assertCompile(expand(constructs), this::assertCompileSucceeded); - } - - private void assertOKWithWarning(String warning, String... constructs) { - assertCompile(expand(constructs), () -> assertCompileSucceededWithWarning(warning)); - } - - private void assertFail(String expectedDiag, String... constructs) { - assertCompile(expand(constructs), () -> assertCompileFailed(expectedDiag)); - } - - // -- Actual test cases start here -- - public void testSuccessExpected() { // with permits assertOK("class SealedTest {\n" +