8313613: Use JUnit in langtools/lib tests
Reviewed-by: cstein, asotona
This commit is contained in:
parent
8c1bb2b280
commit
741ae06c55
@ -1,6 +1,6 @@
|
|||||||
# This file identifies root(s) of the test-ng hierarchy.
|
# This file identifies root(s) of the JUnit hierarchy.
|
||||||
|
|
||||||
TestNG.dirs = .
|
JUnit.dirs = .
|
||||||
|
|
||||||
modules = \
|
modules = \
|
||||||
jdk.compiler/com.sun.tools.javac.util
|
jdk.compiler/com.sun.tools.javac.util
|
||||||
|
31
test/langtools/lib/combo/tools/javac/combo/ComboWatcher.java
Normal file
31
test/langtools/lib/combo/tools/javac/combo/ComboWatcher.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package tools.javac.combo;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.extension.AfterAllCallback;
|
||||||
|
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||||
|
import org.junit.jupiter.api.extension.TestWatcher;
|
||||||
|
|
||||||
|
public class ComboWatcher implements TestWatcher, AfterAllCallback {
|
||||||
|
private final Set<String> errors = Collections.synchronizedSet(new HashSet<>());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testFailed(ExtensionContext context, Throwable cause) {
|
||||||
|
if (context.getRequiredTestInstance() instanceof JavacTemplateTestBase instance) {
|
||||||
|
errors.addAll(instance.diags.errorKeys());
|
||||||
|
if (instance instanceof CompilationTestCase) {
|
||||||
|
// Make sure offending template ends up in log file on failure
|
||||||
|
System.err.printf("Diagnostics: %s%nTemplate: %s%n", instance.diags.errorKeys(),
|
||||||
|
instance.sourceFiles.stream().map(SourceFile::template).toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterAll(ExtensionContext extensionContext) {
|
||||||
|
if (errors.isEmpty()) return;
|
||||||
|
System.err.println("Errors found in tests: " + errors);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,30 +31,14 @@ import java.util.stream.IntStream;
|
|||||||
|
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
|
|
||||||
import org.testng.ITestResult;
|
|
||||||
import org.testng.annotations.AfterMethod;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for negative and positive compilation tests.
|
* Base class for negative and positive compilation tests.
|
||||||
*/
|
*/
|
||||||
@Test
|
|
||||||
public class CompilationTestCase extends JavacTemplateTestBase {
|
public class CompilationTestCase extends JavacTemplateTestBase {
|
||||||
private String[] compileOptions = new String[] { };
|
private String[] compileOptions = new String[]{};
|
||||||
private String defaultFileName = "Source.java";
|
private String defaultFileName = "Source.java";
|
||||||
private String programShell = "#";
|
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) {
|
protected void setProgramShell(String shell) {
|
||||||
programShell = shell;
|
programShell = shell;
|
||||||
}
|
}
|
||||||
@ -81,7 +65,7 @@ public class CompilationTestCase extends JavacTemplateTestBase {
|
|||||||
throw new AssertionError("unexpected negative value " + i);
|
throw new AssertionError("unexpected negative value " + i);
|
||||||
}
|
}
|
||||||
if (i >= compileOptions.length) {
|
if (i >= compileOptions.length) {
|
||||||
compileOptions = new String[] {};
|
compileOptions = new String[]{};
|
||||||
} else {
|
} else {
|
||||||
compileOptions = Arrays.copyOf(compileOptions, compileOptions.length - i);
|
compileOptions = Arrays.copyOf(compileOptions, compileOptions.length - i);
|
||||||
}
|
}
|
||||||
@ -105,8 +89,7 @@ public class CompilationTestCase extends JavacTemplateTestBase {
|
|||||||
File dir = null;
|
File dir = null;
|
||||||
try {
|
try {
|
||||||
dir = compile(generate);
|
dir = compile(generate);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
postTest.run();
|
postTest.run();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -33,10 +33,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
@ -48,17 +46,13 @@ import javax.tools.StandardLocation;
|
|||||||
import javax.tools.ToolProvider;
|
import javax.tools.ToolProvider;
|
||||||
|
|
||||||
import com.sun.source.util.JavacTask;
|
import com.sun.source.util.JavacTask;
|
||||||
import com.sun.tools.javac.util.Pair;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.testng.ITestResult;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.testng.annotations.AfterMethod;
|
|
||||||
import org.testng.annotations.AfterSuite;
|
|
||||||
import org.testng.annotations.BeforeMethod;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import static org.testng.Assert.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for template-driven TestNG javac tests that support on-the-fly
|
* Base class for template-driven JUnit javac tests that support on-the-fly
|
||||||
* source file generation, compilation, classloading, execution, and separate
|
* source file generation, compilation, classloading, execution, and separate
|
||||||
* compilation.
|
* compilation.
|
||||||
*
|
*
|
||||||
@ -70,16 +64,15 @@ import static org.testng.Assert.fail;
|
|||||||
*
|
*
|
||||||
* @author Brian Goetz
|
* @author Brian Goetz
|
||||||
*/
|
*/
|
||||||
@Test
|
@ExtendWith(ComboWatcher.class)
|
||||||
public abstract class JavacTemplateTestBase {
|
public abstract class JavacTemplateTestBase {
|
||||||
private static final Set<String> suiteErrors = Collections.synchronizedSet(new HashSet<>());
|
|
||||||
private static final AtomicInteger counter = new AtomicInteger();
|
private static final AtomicInteger counter = new AtomicInteger();
|
||||||
private static final File root = new File("gen");
|
private static final File root = new File("gen");
|
||||||
private static final File nullDir = new File("empty");
|
private static final File nullDir = new File("empty");
|
||||||
|
|
||||||
protected final Map<String, Template> templates = new HashMap<>();
|
protected final Map<String, Template> templates = new HashMap<>();
|
||||||
protected final Diagnostics diags = new Diagnostics();
|
protected final Diagnostics diags = new Diagnostics();
|
||||||
protected final List<Pair<String, String>> sourceFiles = new ArrayList<>();
|
protected final List<SourceFile> sourceFiles = new ArrayList<>();
|
||||||
protected final List<String> compileOptions = new ArrayList<>();
|
protected final List<String> compileOptions = new ArrayList<>();
|
||||||
protected final List<File> classpaths = new ArrayList<>();
|
protected final List<File> classpaths = new ArrayList<>();
|
||||||
|
|
||||||
@ -95,7 +88,7 @@ public abstract class JavacTemplateTestBase {
|
|||||||
|
|
||||||
/** Add a source file */
|
/** Add a source file */
|
||||||
protected void addSourceFile(String name, String template) {
|
protected void addSourceFile(String name, String template) {
|
||||||
sourceFiles.add(new Pair<>(name, template));
|
sourceFiles.add(new SourceFile(name, template));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a File to the class path to be used when loading classes; File values
|
/** Add a File to the class path to be used when loading classes; File values
|
||||||
@ -130,7 +123,7 @@ public abstract class JavacTemplateTestBase {
|
|||||||
protected void resetClassPaths() { classpaths.clear(); }
|
protected void resetClassPaths() { classpaths.clear(); }
|
||||||
|
|
||||||
// Before each test method, reset everything
|
// Before each test method, reset everything
|
||||||
@BeforeMethod
|
@BeforeEach
|
||||||
public void reset() {
|
public void reset() {
|
||||||
resetCompileOptions();
|
resetCompileOptions();
|
||||||
resetDiagnostics();
|
resetDiagnostics();
|
||||||
@ -139,38 +132,6 @@ public abstract class JavacTemplateTestBase {
|
|||||||
resetClassPaths();
|
resetClassPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
// After each test method, if the test failed, capture source files and diagnostics and put them in the log
|
|
||||||
@AfterMethod
|
|
||||||
public void copyErrors(ITestResult result) {
|
|
||||||
if (!result.isSuccess()) {
|
|
||||||
suiteErrors.addAll(diags.errorKeys());
|
|
||||||
|
|
||||||
List<Object> list = new ArrayList<>();
|
|
||||||
Collections.addAll(list, result.getParameters());
|
|
||||||
list.add("Test case: " + getTestCaseDescription());
|
|
||||||
for (Pair<String, String> e : sourceFiles)
|
|
||||||
list.add("Source file " + e.fst + ": " + e.snd);
|
|
||||||
if (diags.errorsFound())
|
|
||||||
list.add("Compile diagnostics: " + diags.toString());
|
|
||||||
result.setParameters(list.toArray(new Object[list.size()]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterSuite
|
|
||||||
// After the suite is done, dump any errors to output
|
|
||||||
public void dumpErrors() {
|
|
||||||
if (!suiteErrors.isEmpty())
|
|
||||||
System.err.println("Errors found in test suite: " + suiteErrors);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a description of this test case; since test cases may be combinatorially
|
|
||||||
* generated, this should include all information needed to describe the test case
|
|
||||||
*/
|
|
||||||
protected String getTestCaseDescription() {
|
|
||||||
return this.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Assert that all previous calls to compile() succeeded */
|
/** Assert that all previous calls to compile() succeeded */
|
||||||
protected void assertCompileSucceeded() {
|
protected void assertCompileSucceeded() {
|
||||||
if (diags.errorsFound())
|
if (diags.errorsFound())
|
||||||
@ -258,9 +219,7 @@ public abstract class JavacTemplateTestBase {
|
|||||||
/** Compile all registered source files, optionally generating class files
|
/** Compile all registered source files, optionally generating class files
|
||||||
* and returning a File describing the directory to which they were written */
|
* and returning a File describing the directory to which they were written */
|
||||||
protected File compile(boolean generate) throws IOException {
|
protected File compile(boolean generate) throws IOException {
|
||||||
List<JavaFileObject> files = new ArrayList<>();
|
var files = sourceFiles.stream().map(FileAdapter::new).toList();
|
||||||
for (Pair<String, String> e : sourceFiles)
|
|
||||||
files.add(new FileAdapter(e.fst, e.snd));
|
|
||||||
return compile(classpaths, files, generate);
|
return compile(classpaths, files, generate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,13 +227,11 @@ public abstract class JavacTemplateTestBase {
|
|||||||
* for finding required classfiles, optionally generating class files
|
* for finding required classfiles, optionally generating class files
|
||||||
* and returning a File describing the directory to which they were written */
|
* and returning a File describing the directory to which they were written */
|
||||||
protected File compile(List<File> classpaths, boolean generate) throws IOException {
|
protected File compile(List<File> classpaths, boolean generate) throws IOException {
|
||||||
List<JavaFileObject> files = new ArrayList<>();
|
var files = sourceFiles.stream().map(FileAdapter::new).toList();
|
||||||
for (Pair<String, String> e : sourceFiles)
|
|
||||||
files.add(new FileAdapter(e.fst, e.snd));
|
|
||||||
return compile(classpaths, files, generate);
|
return compile(classpaths, files, generate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private File compile(List<File> classpaths, List<JavaFileObject> files, boolean generate) throws IOException {
|
private File compile(List<File> classpaths, List<? extends JavaFileObject> files, boolean generate) throws IOException {
|
||||||
JavaCompiler systemJavaCompiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler systemJavaCompiler = ToolProvider.getSystemJavaCompiler();
|
||||||
try (StandardJavaFileManager fm = systemJavaCompiler.getStandardFileManager(null, null, null)) {
|
try (StandardJavaFileManager fm = systemJavaCompiler.getStandardFileManager(null, null, null)) {
|
||||||
if (classpaths.size() > 0)
|
if (classpaths.size() > 0)
|
||||||
@ -327,9 +284,9 @@ public abstract class JavacTemplateTestBase {
|
|||||||
private class FileAdapter extends SimpleJavaFileObject {
|
private class FileAdapter extends SimpleJavaFileObject {
|
||||||
private final String templateString;
|
private final String templateString;
|
||||||
|
|
||||||
FileAdapter(String filename, String templateString) {
|
FileAdapter(SourceFile file) {
|
||||||
super(URI.create("myfo:/" + filename), Kind.SOURCE);
|
super(URI.create("myfo:/" + file.name()), Kind.SOURCE);
|
||||||
this.templateString = templateString;
|
this.templateString = file.template();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
|
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
|
||||||
|
26
test/langtools/lib/combo/tools/javac/combo/SourceFile.java
Normal file
26
test/langtools/lib/combo/tools/javac/combo/SourceFile.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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.
|
||||||
|
*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
public record SourceFile(String name, String template) {}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,34 +23,34 @@
|
|||||||
|
|
||||||
package tools.javac.combo;
|
package tools.javac.combo;
|
||||||
|
|
||||||
import org.testng.annotations.BeforeTest;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TemplateTest
|
* TemplateTest
|
||||||
*/
|
*/
|
||||||
@Test
|
class TemplateTest {
|
||||||
public class TemplateTest {
|
final Map<String, Template> vars = new HashMap<>();
|
||||||
Map<String, Template> vars = new HashMap<>();
|
|
||||||
|
|
||||||
@BeforeTest
|
@BeforeEach
|
||||||
void before() { vars.clear(); }
|
void before() { vars.clear(); }
|
||||||
|
|
||||||
private void assertTemplate(String expected, String template) {
|
private void assertTemplate(String expected, String template) {
|
||||||
String result = Template.expandTemplate(template, vars);
|
String result = Template.expandTemplate(template, vars);
|
||||||
assertEquals(result, expected, "for " + template);
|
assertEquals(expected, result, "for " + template);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String dotIf(String s) {
|
private String dotIf(String s) {
|
||||||
return s == null || s.isEmpty() ? "" : "." + s;
|
return s == null || s.isEmpty() ? "" : "." + s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTemplateExpansion() {
|
@Test
|
||||||
|
void testTemplateExpansion() {
|
||||||
vars.put("A", s -> "a" + dotIf(s));
|
vars.put("A", s -> "a" + dotIf(s));
|
||||||
vars.put("B", s -> "b" + dotIf(s));
|
vars.put("B", s -> "b" + dotIf(s));
|
||||||
vars.put("C", s -> "#{A}#{B}");
|
vars.put("C", s -> "#{A}#{B}");
|
||||||
@ -72,7 +72,8 @@ public class TemplateTest {
|
|||||||
assertTemplate("#{A", "#{A");
|
assertTemplate("#{A", "#{A");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIndexedTemplate() {
|
@Test
|
||||||
|
void testIndexedTemplate() {
|
||||||
vars.put("A[0]", s -> "a" );
|
vars.put("A[0]", s -> "a" );
|
||||||
vars.put("A[1]", s -> "b" );
|
vars.put("A[1]", s -> "b" );
|
||||||
vars.put("A[2]", s -> "c" );
|
vars.put("A[2]", s -> "c" );
|
||||||
@ -82,13 +83,14 @@ public class TemplateTest {
|
|||||||
assertTemplate("c", "#{A[2]}");
|
assertTemplate("c", "#{A[2]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAngleBrackets() {
|
@Test
|
||||||
|
void testAngleBrackets() {
|
||||||
vars.put("X", s -> "xyz");
|
vars.put("X", s -> "xyz");
|
||||||
assertTemplate("List<String> ls = xyz;", "List<String> ls = #{X};");
|
assertTemplate("List<String> ls = xyz;", "List<String> ls = #{X};");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = IllegalStateException.class )
|
@Test
|
||||||
public void testUnknownKey() {
|
void testUnknownKey() {
|
||||||
assertTemplate("#{Q}", "#{Q}");
|
assertThrows(IllegalStateException.class, () -> assertTemplate("#{Q}", "#{Q}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -21,19 +21,12 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.testng.ITestResult;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.testng.annotations.AfterMethod;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
import tools.javac.combo.CompilationTestCase;
|
import tools.javac.combo.CompilationTestCase;
|
||||||
import tools.javac.combo.JavacTemplateTestBase;
|
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toList;
|
class ExpSwitchNestingTest extends CompilationTestCase {
|
||||||
|
|
||||||
@Test
|
|
||||||
public class ExpSwitchNestingTest extends CompilationTestCase {
|
|
||||||
private static final String RUNNABLE = "Runnable r = () -> { # };";
|
private static final String RUNNABLE = "Runnable r = () -> { # };";
|
||||||
private static final String INT_FN = "java.util.function.IntSupplier r = () -> { # };";
|
private static final String INT_FN = "java.util.function.IntSupplier r = () -> { # };";
|
||||||
private static final String LABEL = "label: #";
|
private static final String LABEL = "label: #";
|
||||||
@ -77,14 +70,16 @@ public class ExpSwitchNestingTest extends CompilationTestCase {
|
|||||||
setProgramShell(SHELL);
|
setProgramShell(SHELL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReallySimpleCases() {
|
@Test
|
||||||
|
void testReallySimpleCases() {
|
||||||
for (String s : CONTAINERS)
|
for (String s : CONTAINERS)
|
||||||
assertOK(s, NOTHING);
|
assertOK(s, NOTHING);
|
||||||
for (String s : CONTAINER_STATEMENTS)
|
for (String s : CONTAINER_STATEMENTS)
|
||||||
assertOK(LABEL, s, NOTHING);
|
assertOK(LABEL, s, NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLambda() {
|
@Test
|
||||||
|
void testLambda() {
|
||||||
assertOK(RUNNABLE, RETURN_N);
|
assertOK(RUNNABLE, RETURN_N);
|
||||||
assertOK(RUNNABLE, NOTHING);
|
assertOK(RUNNABLE, NOTHING);
|
||||||
assertOK(INT_FN, RETURN_Z);
|
assertOK(INT_FN, RETURN_Z);
|
||||||
@ -106,7 +101,8 @@ public class ExpSwitchNestingTest extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.undef.label", LABEL, BLOCK, INT_FN, CONTINUE_L);
|
assertFail("compiler.err.undef.label", LABEL, BLOCK, INT_FN, CONTINUE_L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEswitch() {
|
@Test
|
||||||
|
void testEswitch() {
|
||||||
//Int-valued switch expressions
|
//Int-valued switch expressions
|
||||||
assertOK(ESWITCH_Z, YIELD_Z);
|
assertOK(ESWITCH_Z, YIELD_Z);
|
||||||
assertOK(LABEL, BLOCK, ESWITCH_Z, YIELD_Z);
|
assertOK(LABEL, BLOCK, ESWITCH_Z, YIELD_Z);
|
||||||
@ -151,7 +147,8 @@ public class ExpSwitchNestingTest extends CompilationTestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNestedInExpSwitch() {
|
@Test
|
||||||
|
void testNestedInExpSwitch() {
|
||||||
assertOK(ESWITCH_Z, IF, YIELD_Z);
|
assertOK(ESWITCH_Z, IF, YIELD_Z);
|
||||||
assertOK(ESWITCH_Z, BLOCK, YIELD_Z);
|
assertOK(ESWITCH_Z, BLOCK, YIELD_Z);
|
||||||
//
|
//
|
||||||
@ -184,7 +181,8 @@ public class ExpSwitchNestingTest extends CompilationTestCase {
|
|||||||
assertOK(ESWITCH_Z, YIELD_Z, BLOCK, DO, IF, YIELD_Z);
|
assertOK(ESWITCH_Z, YIELD_Z, BLOCK, DO, IF, YIELD_Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBreakExpressionLabelDisambiguation() {
|
@Test
|
||||||
|
void testBreakExpressionLabelDisambiguation() {
|
||||||
assertOK(DEF_LABEL_VAR, ESWITCH_Z, YIELD_L);
|
assertOK(DEF_LABEL_VAR, ESWITCH_Z, YIELD_L);
|
||||||
assertFail("compiler.err.undef.label", DEF_LABEL_VAR, ESWITCH_Z, BREAK_L);
|
assertFail("compiler.err.undef.label", DEF_LABEL_VAR, ESWITCH_Z, BREAK_L);
|
||||||
assertFail("compiler.err.break.outside.switch.expression", LABEL, FOR, BLOCK, DEF_LABEL_VAR, ESWITCH_Z, BREAK_L);
|
assertFail("compiler.err.break.outside.switch.expression", LABEL, FOR, BLOCK, DEF_LABEL_VAR, ESWITCH_Z, BREAK_L);
|
||||||
@ -194,11 +192,13 @@ public class ExpSwitchNestingTest extends CompilationTestCase {
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFunReturningSwitchExp() {
|
@Test
|
||||||
|
void testFunReturningSwitchExp() {
|
||||||
assertOK(INT_FN_ESWITCH, YIELD_INT_FN);
|
assertOK(INT_FN_ESWITCH, YIELD_INT_FN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testContinueLoops() {
|
@Test
|
||||||
|
void testContinueLoops() {
|
||||||
assertOK(LABEL, FOR, CONTINUE_L);
|
assertOK(LABEL, FOR, CONTINUE_L);
|
||||||
assertOK(LABEL, FOR_EACH, CONTINUE_L);
|
assertOK(LABEL, FOR_EACH, CONTINUE_L);
|
||||||
assertOK(LABEL, WHILE, CONTINUE_L);
|
assertOK(LABEL, WHILE, CONTINUE_L);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
TestNG.dirs = .
|
JUnit.dirs = .
|
||||||
|
|
||||||
lib.dirs = /lib/combo
|
lib.dirs = /lib/combo
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,12 +31,12 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.testng.annotations.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import tools.javac.combo.*;
|
import tools.javac.combo.*;
|
||||||
|
|
||||||
import static org.testng.Assert.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BridgeMethodTestCase -- used for asserting linkage to bridges under separate compilation.
|
* BridgeMethodTestCase -- used for asserting linkage to bridges under separate compilation.
|
||||||
@ -56,7 +56,6 @@ import static org.testng.Assert.fail;
|
|||||||
* @author Brian Goetz
|
* @author Brian Goetz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Test
|
|
||||||
public abstract class BridgeMethodTestCase extends JavacTemplateTestBase {
|
public abstract class BridgeMethodTestCase extends JavacTemplateTestBase {
|
||||||
|
|
||||||
private static final String TYPE_LETTERS = "ABCDIJK";
|
private static final String TYPE_LETTERS = "ABCDIJK";
|
||||||
@ -229,7 +228,7 @@ public abstract class BridgeMethodTestCase extends JavacTemplateTestBase {
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeEach
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
compileDirs.clear();
|
compileDirs.clear();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -22,16 +22,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import tools.javac.combo.*;
|
||||||
import org.testng.annotations.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BridgeMethodsTemplateTest
|
* BridgeMethodsTemplateTest
|
||||||
*
|
*
|
||||||
* @author Brian Goetz
|
* @author Brian Goetz
|
||||||
*/
|
*/
|
||||||
@Test
|
class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
||||||
public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cc1(A) -> Cc1(Ac0)
|
* Cc1(A) -> Cc1(Ac0)
|
||||||
@ -39,7 +39,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited from A
|
* 0*: Inherited from A
|
||||||
* 1: Declared in C
|
* 1: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test1() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test1() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc1(A)");
|
compileSpec("Cc1(A)");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C1");
|
assertLinkage("C", LINKAGE_ERROR, "C1");
|
||||||
recompileSpec("Cc1(Ac0)", "A");
|
recompileSpec("Cc1(Ac0)", "A");
|
||||||
@ -52,7 +53,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited default from I
|
* 0*: Inherited default from I
|
||||||
* 1: Declared in C
|
* 1: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test2() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test2() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc1(I)");
|
compileSpec("Cc1(I)");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C1");
|
assertLinkage("C", LINKAGE_ERROR, "C1");
|
||||||
recompileSpec("Cc1(Id0)", "I");
|
recompileSpec("Cc1(Id0)", "I");
|
||||||
@ -65,7 +67,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited from A
|
* 0*: Inherited from A
|
||||||
* 1: Inherited from B
|
* 1: Inherited from B
|
||||||
*/
|
*/
|
||||||
public void test3() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test3() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Bc1(A))");
|
compileSpec("C(Bc1(A))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "B1");
|
assertLinkage("C", LINKAGE_ERROR, "B1");
|
||||||
recompileSpec("C(Bc1(Ac0))", "A");
|
recompileSpec("C(Bc1(Ac0))", "A");
|
||||||
@ -78,7 +81,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0: Inherited from B (through bridge)
|
* 0: Inherited from B (through bridge)
|
||||||
* 1: Inherited from B
|
* 1: Inherited from B
|
||||||
*/
|
*/
|
||||||
public void test4() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test4() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(B(Ac0))");
|
compileSpec("C(B(Ac0))");
|
||||||
assertLinkage("C", "A0", LINKAGE_ERROR);
|
assertLinkage("C", "A0", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Bc1(Ac0))", "B");
|
recompileSpec("C(Bc1(Ac0))", "B");
|
||||||
@ -91,7 +95,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0: Inherited from B (through bridge)
|
* 0: Inherited from B (through bridge)
|
||||||
* 1: Inherited from B
|
* 1: Inherited from B
|
||||||
*/
|
*/
|
||||||
public void test5() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test5() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(B(A))");
|
compileSpec("C(B(A))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR);
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR);
|
||||||
recompileSpec("C(Bc1(Ac0))", "A", "B");
|
recompileSpec("C(Bc1(Ac0))", "A", "B");
|
||||||
@ -104,7 +109,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited default from I
|
* 0*: Inherited default from I
|
||||||
* 1: Inherited from A
|
* 1: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test6() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test6() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Ac1(I))");
|
compileSpec("C(Ac1(I))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "A1");
|
assertLinkage("C", LINKAGE_ERROR, "A1");
|
||||||
recompileSpec("C(Ac1(Id0))", "I");
|
recompileSpec("C(Ac1(Id0))", "I");
|
||||||
@ -117,7 +123,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0: Inherited from A (through bridge)
|
* 0: Inherited from A (through bridge)
|
||||||
* 1: Inherited from A
|
* 1: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test7() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test7() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0))");
|
compileSpec("C(A(Id0))");
|
||||||
assertLinkage("C", "I0", LINKAGE_ERROR);
|
assertLinkage("C", "I0", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Ac1(Id0))", "A");
|
recompileSpec("C(Ac1(Id0))", "A");
|
||||||
@ -130,7 +137,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited from A (through bridge)
|
* 0*: Inherited from A (through bridge)
|
||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test8() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test8() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(I))");
|
compileSpec("C(A(I))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR);
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR);
|
||||||
recompileSpec("C(Ac1(Id0))", "A", "I");
|
recompileSpec("C(Ac1(Id0))", "A", "I");
|
||||||
@ -143,7 +151,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited default from J
|
* 0*: Inherited default from J
|
||||||
* 1: Inherited default from I
|
* 1: Inherited default from I
|
||||||
*/
|
*/
|
||||||
public void test9() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test9() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Id1(J))");
|
compileSpec("C(Id1(J))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "I1");
|
assertLinkage("C", LINKAGE_ERROR, "I1");
|
||||||
recompileSpec("C(Id1(Jd0))", "J");
|
recompileSpec("C(Id1(Jd0))", "J");
|
||||||
@ -156,7 +165,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0: Inherited default from I (through bridge)
|
* 0: Inherited default from I (through bridge)
|
||||||
* 1: Inherited default from I
|
* 1: Inherited default from I
|
||||||
*/
|
*/
|
||||||
public void test10() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test10() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(I(Jd0))");
|
compileSpec("C(I(Jd0))");
|
||||||
assertLinkage("C", "J0", LINKAGE_ERROR);
|
assertLinkage("C", "J0", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Id1(Jd0))", "I");
|
recompileSpec("C(Id1(Jd0))", "I");
|
||||||
@ -169,7 +179,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0: Inherited default from I (through bridge)
|
* 0: Inherited default from I (through bridge)
|
||||||
* 1: Inherited default from I
|
* 1: Inherited default from I
|
||||||
*/
|
*/
|
||||||
public void test11() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test11() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(I(J))");
|
compileSpec("C(I(J))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR);
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR);
|
||||||
recompileSpec("C(Id1(Jd0))", "I", "J");
|
recompileSpec("C(Id1(Jd0))", "I", "J");
|
||||||
@ -183,7 +194,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from B
|
* 1*: Inherited from B
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test12() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test12() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(B(Ac0))");
|
compileSpec("Cc2(B(Ac0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Bc1(Ac0))", "B");
|
recompileSpec("Cc2(Bc1(Ac0))", "B");
|
||||||
@ -197,7 +209,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from B
|
* 1*: Inherited from B
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test13() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test13() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(B(Aa0))");
|
compileSpec("Cc2(B(Aa0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Bc1(Aa0))", "B");
|
recompileSpec("Cc2(Bc1(Aa0))", "B");
|
||||||
@ -211,7 +224,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Declared in C (through bridge)
|
* 1: Declared in C (through bridge)
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test14() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test14() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Bc1(A))");
|
compileSpec("Cc2(Bc1(A))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
||||||
recompileSpec("Cc2(Bc1(Ac0))", "A");
|
recompileSpec("Cc2(Bc1(Ac0))", "A");
|
||||||
@ -225,7 +239,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Declared in C (through bridge)
|
* 1: Declared in C (through bridge)
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test15() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test15() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Ba1(A))");
|
compileSpec("Cc2(Ba1(A))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
||||||
recompileSpec("Cc2(Ba1(Ac0))", "A");
|
recompileSpec("Cc2(Ba1(Ac0))", "A");
|
||||||
@ -239,7 +254,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from B
|
* 1*: Inherited from B
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test16() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test16() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(B(A))");
|
compileSpec("Cc2(B(A))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Bc1(Ac0))", "B", "A");
|
recompileSpec("Cc2(Bc1(Ac0))", "B", "A");
|
||||||
@ -253,7 +269,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test17() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test17() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A(Id0))");
|
compileSpec("Cc2(A(Id0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ac1(Id0))", "A");
|
recompileSpec("Cc2(Ac1(Id0))", "A");
|
||||||
@ -267,7 +284,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test18() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test18() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A(Ia0))");
|
compileSpec("Cc2(A(Ia0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ac1(Ia0))", "A");
|
recompileSpec("Cc2(Ac1(Ia0))", "A");
|
||||||
@ -281,7 +299,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Declared in C (through bridge)
|
* 1: Declared in C (through bridge)
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test19() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test19() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Ac1(I))");
|
compileSpec("Cc2(Ac1(I))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
||||||
recompileSpec("Cc2(Ac1(Id0))", "I");
|
recompileSpec("Cc2(Ac1(Id0))", "I");
|
||||||
@ -295,7 +314,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Declared in C (through bridge)
|
* 1: Declared in C (through bridge)
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test20() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test20() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Aa1(I))");
|
compileSpec("Cc2(Aa1(I))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
||||||
recompileSpec("Cc2(Aa1(Id0))", "I");
|
recompileSpec("Cc2(Aa1(Id0))", "I");
|
||||||
@ -309,7 +329,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test21() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test21() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A(I))");
|
compileSpec("Cc2(A(I))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ac1(Id0))", "A", "I");
|
recompileSpec("Cc2(Ac1(Id0))", "A", "I");
|
||||||
@ -323,7 +344,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test22() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test22() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(J(Id0))");
|
compileSpec("Cc2(J(Id0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Jd1(Id0))", "J");
|
recompileSpec("Cc2(Jd1(Id0))", "J");
|
||||||
@ -337,7 +359,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test23() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test23() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(J(Ia0))");
|
compileSpec("Cc2(J(Ia0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Jd1(Ia0))", "J");
|
recompileSpec("Cc2(Jd1(Ia0))", "J");
|
||||||
@ -351,7 +374,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Declared in C (through bridge)
|
* 1: Declared in C (through bridge)
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test24() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test24() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Jd1(I))");
|
compileSpec("Cc2(Jd1(I))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
||||||
recompileSpec("Cc2(Jd1(Id0))", "I");
|
recompileSpec("Cc2(Jd1(Id0))", "I");
|
||||||
@ -365,7 +389,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Declared in C (through bridge)
|
* 1: Declared in C (through bridge)
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test25() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test25() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Ja1(I))");
|
compileSpec("Cc2(Ja1(I))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
||||||
recompileSpec("Cc2(Ja1(Id0))", "I");
|
recompileSpec("Cc2(Ja1(Id0))", "I");
|
||||||
@ -379,7 +404,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test26() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test26() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(J(I))");
|
compileSpec("Cc2(J(I))");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Jd1(Id0))", "J", "I");
|
recompileSpec("Cc2(Jd1(Id0))", "J", "I");
|
||||||
@ -392,7 +418,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited default from I
|
* 0*: Inherited default from I
|
||||||
* 1: Inherited from A
|
* 1: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test27() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test27() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Ac1,I)");
|
compileSpec("C(Ac1,I)");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "A1");
|
assertLinkage("C", LINKAGE_ERROR, "A1");
|
||||||
recompileSpec("C(Ac1,Id0)", "I");
|
recompileSpec("C(Ac1,Id0)", "I");
|
||||||
@ -405,7 +432,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited default from I
|
* 0*: Inherited default from I
|
||||||
* 1: Inherited from A
|
* 1: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test28() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test28() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A,Id0)");
|
compileSpec("C(A,Id0)");
|
||||||
assertLinkage("C", "I0", LINKAGE_ERROR);
|
assertLinkage("C", "I0", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Ac1,Id0)", "A");
|
recompileSpec("C(Ac1,Id0)", "A");
|
||||||
@ -418,7 +446,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited default from I
|
* 0*: Inherited default from I
|
||||||
* 1: Inherited from A
|
* 1: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test29() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test29() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A,I)");
|
compileSpec("C(A,I)");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR);
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR);
|
||||||
recompileSpec("C(Ac1,Id0)", "A", "I");
|
recompileSpec("C(Ac1,Id0)", "A", "I");
|
||||||
@ -432,7 +461,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Declared in C (through bridge)
|
* 1: Declared in C (through bridge)
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test30() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test30() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Ac1,I)");
|
compileSpec("Cc2(Ac1,I)");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
||||||
recompileSpec("Cc2(Ac1,Id0)", "I");
|
recompileSpec("Cc2(Ac1,Id0)", "I");
|
||||||
@ -446,7 +476,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Declared in C (through bridge)
|
* 1: Declared in C (through bridge)
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test31() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test31() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Aa1,I)");
|
compileSpec("Cc2(Aa1,I)");
|
||||||
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
assertLinkage("C", LINKAGE_ERROR, "C2", "C2");
|
||||||
recompileSpec("Cc2(Aa1,Id0)", "I");
|
recompileSpec("Cc2(Aa1,Id0)", "I");
|
||||||
@ -460,7 +491,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test32() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test32() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A,Id0)");
|
compileSpec("Cc2(A,Id0)");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ac1,Id0)", "A");
|
recompileSpec("Cc2(Ac1,Id0)", "A");
|
||||||
@ -474,7 +506,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test33() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test33() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A,Ia0)");
|
compileSpec("Cc2(A,Ia0)");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ac1,Ia0)", "A");
|
recompileSpec("Cc2(Ac1,Ia0)", "A");
|
||||||
@ -488,7 +521,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from I
|
* 1*: Inherited default from I
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test34() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test34() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A,I)");
|
compileSpec("Cc2(A,I)");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ac1,Id0)", "A", "I");
|
recompileSpec("Cc2(Ac1,Id0)", "A", "I");
|
||||||
@ -502,7 +536,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test35() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test35() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Id0,J)");
|
compileSpec("Cc2(Id0,J)");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Id0,Jd1)", "J");
|
recompileSpec("Cc2(Id0,Jd1)", "J");
|
||||||
@ -516,7 +551,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test36() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test36() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(Ia0,J)");
|
compileSpec("Cc2(Ia0,J)");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ia0,Jd1)", "J");
|
recompileSpec("Cc2(Ia0,Jd1)", "J");
|
||||||
@ -530,7 +566,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test37() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test37() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(I,J)");
|
compileSpec("Cc2(I,J)");
|
||||||
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
assertLinkage("C", LINKAGE_ERROR, LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Id0,Jd1)", "I", "J");
|
recompileSpec("Cc2(Id0,Jd1)", "I", "J");
|
||||||
@ -544,7 +581,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited from A (through bridge)
|
* 0*: Inherited from A (through bridge)
|
||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test38() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test38() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0),J(Id0))");
|
compileSpec("C(A(Id0),J(Id0))");
|
||||||
assertLinkage("C", "I0", LINKAGE_ERROR);
|
assertLinkage("C", "I0", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Ac1(Id0),J(Id0))", "A");
|
recompileSpec("C(Ac1(Id0),J(Id0))", "A");
|
||||||
@ -558,7 +596,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0: Inherited default from J (through bridge)
|
* 0: Inherited default from J (through bridge)
|
||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
*/
|
*/
|
||||||
public void test39() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test39() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0),J(Id0))");
|
compileSpec("C(A(Id0),J(Id0))");
|
||||||
assertLinkage("C", "I0", LINKAGE_ERROR);
|
assertLinkage("C", "I0", LINKAGE_ERROR);
|
||||||
recompileSpec("C(A(Id0),Jd1(Id0))", "J");
|
recompileSpec("C(A(Id0),Jd1(Id0))", "J");
|
||||||
@ -573,7 +612,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Inherited from A
|
* 2: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test40() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test40() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0),J(Id0))");
|
compileSpec("C(A(Id0),J(Id0))");
|
||||||
assertLinkage("C", "I0", LINKAGE_ERROR);
|
assertLinkage("C", "I0", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Ac2(Id0),Jd1(Id0))", "A", "J");
|
recompileSpec("C(Ac2(Id0),Jd1(Id0))", "A", "J");
|
||||||
@ -587,7 +627,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 0*: Inherited default from J (through bridge)
|
* 0*: Inherited default from J (through bridge)
|
||||||
* 1: Inherited default from J
|
* 1: Inherited default from J
|
||||||
*/
|
*/
|
||||||
public void test41() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test41() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(J(Id0),K(Id0))");
|
compileSpec("C(J(Id0),K(Id0))");
|
||||||
assertLinkage("C", "I0", LINKAGE_ERROR);
|
assertLinkage("C", "I0", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Jd1(Id0),K(Id0))", "J");
|
recompileSpec("C(Jd1(Id0),K(Id0))", "J");
|
||||||
@ -601,7 +642,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Inherited from A
|
* 2: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test42() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test42() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Ac2(Id0),J(Id0))");
|
compileSpec("C(Ac2(Id0),J(Id0))");
|
||||||
assertLinkage("C", "A2", LINKAGE_ERROR, "A2");
|
assertLinkage("C", "A2", LINKAGE_ERROR, "A2");
|
||||||
recompileSpec("C(Ac2(Id0),Jd1(Id0))", "J");
|
recompileSpec("C(Ac2(Id0),Jd1(Id0))", "J");
|
||||||
@ -615,7 +657,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Inherited from A
|
* 2: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test43() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test43() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Ac2(Ia0),J(Ia0))");
|
compileSpec("C(Ac2(Ia0),J(Ia0))");
|
||||||
assertLinkage("C", "A2", LINKAGE_ERROR, "A2");
|
assertLinkage("C", "A2", LINKAGE_ERROR, "A2");
|
||||||
recompileSpec("C(Ac2(Ia0),Jd1(Ia0))", "J");
|
recompileSpec("C(Ac2(Ia0),Jd1(Ia0))", "J");
|
||||||
@ -630,7 +673,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Inherited default from J
|
* 1: Inherited default from J
|
||||||
* 2*: Inherited from A
|
* 2*: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test44() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test44() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0),Jd1(Id0))");
|
compileSpec("C(A(Id0),Jd1(Id0))");
|
||||||
assertLinkage("C", "J1", "J1", LINKAGE_ERROR);
|
assertLinkage("C", "J1", "J1", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Ac2(Id0),Jd1(Id0))", "A");
|
recompileSpec("C(Ac2(Id0),Jd1(Id0))", "A");
|
||||||
@ -645,7 +689,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1: Inherited default from J
|
* 1: Inherited default from J
|
||||||
* 2*: Inherited from A
|
* 2*: Inherited from A
|
||||||
*/
|
*/
|
||||||
public void test45() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test45() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Ia0),Jd1(Ia0))");
|
compileSpec("C(A(Ia0),Jd1(Ia0))");
|
||||||
assertLinkage("C", "J1", "J1", LINKAGE_ERROR);
|
assertLinkage("C", "J1", "J1", LINKAGE_ERROR);
|
||||||
recompileSpec("C(Ac2(Ia0),Jd1(Ia0))", "A");
|
recompileSpec("C(Ac2(Ia0),Jd1(Ia0))", "A");
|
||||||
@ -659,7 +704,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test46() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test46() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A(Id0),J(Id0))");
|
compileSpec("Cc2(A(Id0),J(Id0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ac1(Id0),J(Id0))", "A");
|
recompileSpec("Cc2(Ac1(Id0),J(Id0))", "A");
|
||||||
@ -673,7 +719,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited from A
|
* 1*: Inherited from A
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test47() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test47() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A(Ia0),J(Ia0))");
|
compileSpec("Cc2(A(Ia0),J(Ia0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Ac1(Ia0),J(Ia0))", "A");
|
recompileSpec("Cc2(Ac1(Ia0),J(Ia0))", "A");
|
||||||
@ -687,7 +734,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test48() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test48() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A(Id0),J(Id0))");
|
compileSpec("Cc2(A(Id0),J(Id0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(A(Id0),Jd1(Id0))", "J");
|
recompileSpec("Cc2(A(Id0),Jd1(Id0))", "J");
|
||||||
@ -701,7 +749,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test49() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test49() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(A(Ia0),J(Ia0))");
|
compileSpec("Cc2(A(Ia0),J(Ia0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(A(Ia0),Jd1(Ia0))", "J");
|
recompileSpec("Cc2(A(Ia0),Jd1(Ia0))", "J");
|
||||||
@ -717,7 +766,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from J
|
* 2*: Inherited default from J
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test50() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test50() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(A(Id0),J(Id0))");
|
compileSpec("Cc3(A(Id0),J(Id0))");
|
||||||
assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "A", "J");
|
recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "A", "J");
|
||||||
@ -732,7 +782,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from J
|
* 2*: Inherited default from J
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test51() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test51() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(A(Ia0),J(Ia0))");
|
compileSpec("Cc3(A(Ia0),J(Ia0))");
|
||||||
assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "A", "J");
|
recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "A", "J");
|
||||||
@ -746,7 +797,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test52() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test52() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(J(Id0),K(Id0))");
|
compileSpec("Cc2(J(Id0),K(Id0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Jd1(Id0),K(Id0))", "J");
|
recompileSpec("Cc2(Jd1(Id0),K(Id0))", "J");
|
||||||
@ -760,7 +812,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 1*: Inherited default from J
|
* 1*: Inherited default from J
|
||||||
* 2: Declared in C
|
* 2: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test53() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test53() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc2(J(Ia0),K(Ia0))");
|
compileSpec("Cc2(J(Ia0),K(Ia0))");
|
||||||
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
assertLinkage("C", "C2", LINKAGE_ERROR, "C2");
|
||||||
recompileSpec("Cc2(Jd1(Ia0),K(Ia0))", "J");
|
recompileSpec("Cc2(Jd1(Ia0),K(Ia0))", "J");
|
||||||
@ -775,7 +828,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from K
|
* 2*: Inherited default from K
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test54() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test54() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(J(Id0),K(Id0))");
|
compileSpec("Cc3(J(Id0),K(Id0))");
|
||||||
assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "J", "K");
|
recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "J", "K");
|
||||||
@ -790,7 +844,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from K
|
* 2*: Inherited default from K
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test55() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test55() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(J(Ia0),K(Ia0))");
|
compileSpec("Cc3(J(Ia0),K(Ia0))");
|
||||||
assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", LINKAGE_ERROR, LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "J", "K");
|
recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "J", "K");
|
||||||
@ -805,7 +860,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from J
|
* 2*: Inherited default from J
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test56() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test56() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(Ac1(Id0),J(Id0))");
|
compileSpec("Cc3(Ac1(Id0),J(Id0))");
|
||||||
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "J");
|
recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "J");
|
||||||
@ -820,7 +876,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from J
|
* 2*: Inherited default from J
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test57() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test57() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(Ac1(Ia0),J(Ia0))");
|
compileSpec("Cc3(Ac1(Ia0),J(Ia0))");
|
||||||
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "J");
|
recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "J");
|
||||||
@ -835,7 +892,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from J
|
* 2*: Inherited default from J
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test58() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test58() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(Aa1(Id0),J(Id0))");
|
compileSpec("Cc3(Aa1(Id0),J(Id0))");
|
||||||
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Aa1(Id0),Jd2(Id0))", "J");
|
recompileSpec("Cc3(Aa1(Id0),Jd2(Id0))", "J");
|
||||||
@ -850,7 +908,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from J
|
* 2*: Inherited default from J
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test59() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test59() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(Aa1(Ia0),J(Ia0))");
|
compileSpec("Cc3(Aa1(Ia0),J(Ia0))");
|
||||||
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Aa1(Ia0),Jd2(Ia0))", "J");
|
recompileSpec("Cc3(Aa1(Ia0),Jd2(Ia0))", "J");
|
||||||
@ -865,7 +924,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2: Declared in C (through bridge)
|
* 2: Declared in C (through bridge)
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test60() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test60() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(A(Id0),Jd2(Id0))");
|
compileSpec("Cc3(A(Id0),Jd2(Id0))");
|
||||||
assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3");
|
assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3");
|
||||||
recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "A");
|
recompileSpec("Cc3(Ac1(Id0),Jd2(Id0))", "A");
|
||||||
@ -880,7 +940,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2: Declared in C (through bridge)
|
* 2: Declared in C (through bridge)
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test61() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test61() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(A(Ia0),Jd2(Ia0))");
|
compileSpec("Cc3(A(Ia0),Jd2(Ia0))");
|
||||||
assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3");
|
assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3");
|
||||||
recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "A");
|
recompileSpec("Cc3(Ac1(Ia0),Jd2(Ia0))", "A");
|
||||||
@ -895,7 +956,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2: Declared in C (through bridge)
|
* 2: Declared in C (through bridge)
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test62() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test62() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(A(Id0),Ja2(Id0))");
|
compileSpec("Cc3(A(Id0),Ja2(Id0))");
|
||||||
assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3");
|
assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3");
|
||||||
recompileSpec("Cc3(Ac1(Id0),Ja2(Id0))", "A");
|
recompileSpec("Cc3(Ac1(Id0),Ja2(Id0))", "A");
|
||||||
@ -910,7 +972,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2: Declared in C (through bridge)
|
* 2: Declared in C (through bridge)
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test63() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test63() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(A(Ia0),Ja2(Ia0))");
|
compileSpec("Cc3(A(Ia0),Ja2(Ia0))");
|
||||||
assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3");
|
assertLinkage("C", "C3", LINKAGE_ERROR, "C3", "C3");
|
||||||
recompileSpec("Cc3(Ac1(Ia0),Ja2(Ia0))", "A");
|
recompileSpec("Cc3(Ac1(Ia0),Ja2(Ia0))", "A");
|
||||||
@ -925,7 +988,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from K
|
* 2*: Inherited default from K
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test64() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test64() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(Jd1(Id0),K(Id0))");
|
compileSpec("Cc3(Jd1(Id0),K(Id0))");
|
||||||
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "K");
|
recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "K");
|
||||||
@ -940,7 +1004,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from K
|
* 2*: Inherited default from K
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test65() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test65() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(Jd1(Ia0),K(Ia0))");
|
compileSpec("Cc3(Jd1(Ia0),K(Ia0))");
|
||||||
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "K");
|
recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "K");
|
||||||
@ -955,7 +1020,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from K
|
* 2*: Inherited default from K
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test66() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test66() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(Jd1(Id0),K(Id0))");
|
compileSpec("Cc3(Jd1(Id0),K(Id0))");
|
||||||
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "K");
|
recompileSpec("Cc3(Jd1(Id0),Kd2(Id0))", "K");
|
||||||
@ -970,7 +1036,8 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
* 2*: Inherited default from K
|
* 2*: Inherited default from K
|
||||||
* 3: Declared in C
|
* 3: Declared in C
|
||||||
*/
|
*/
|
||||||
public void test67() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void test67() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc3(Jd1(Ia0),K(Ia0))");
|
compileSpec("Cc3(Jd1(Ia0),K(Ia0))");
|
||||||
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
assertLinkage("C", "C3", "C3", LINKAGE_ERROR, "C3");
|
||||||
recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "K");
|
recompileSpec("Cc3(Jd1(Ia0),Kd2(Ia0))", "K");
|
||||||
@ -978,57 +1045,68 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dan's set A
|
// Dan's set A
|
||||||
public void testA1() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA1() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Id0)");
|
compileSpec("C(Id0)");
|
||||||
assertLinkage("C", "I0");
|
assertLinkage("C", "I0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA2() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA2() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0))");
|
compileSpec("C(A(Id0))");
|
||||||
assertLinkage("C", "I0");
|
assertLinkage("C", "I0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA3() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA3() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0),J)");
|
compileSpec("C(A(Id0),J)");
|
||||||
assertLinkage("C", "I0");
|
assertLinkage("C", "I0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA4() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA4() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("D(C(Id0),Jd0(Id0))");
|
compileSpec("D(C(Id0),Jd0(Id0))");
|
||||||
assertLinkage("D", "J0");
|
assertLinkage("D", "J0");
|
||||||
assertLinkage("C", "I0");
|
assertLinkage("C", "I0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA5() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA5() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0),Jd0)",
|
compileSpec("C(A(Id0),Jd0)",
|
||||||
"compiler.err.types.incompatible");
|
"compiler.err.types.incompatible");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA6() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA6() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Ia0,Jd0))",
|
compileSpec("C(A(Ia0,Jd0))",
|
||||||
"compiler.err.does.not.override.abstract",
|
"compiler.err.does.not.override.abstract",
|
||||||
"compiler.err.types.incompatible");
|
"compiler.err.types.incompatible");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA7() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA7() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Id0,Jd0))",
|
compileSpec("C(A(Id0,Jd0))",
|
||||||
"compiler.err.types.incompatible");
|
"compiler.err.types.incompatible");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA8() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA8() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(A(Ia0),J)", "compiler.err.does.not.override.abstract");
|
compileSpec("C(A(Ia0),J)", "compiler.err.does.not.override.abstract");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA9() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA9() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Ac0(Id0))");
|
compileSpec("C(Ac0(Id0))");
|
||||||
assertLinkage("C", "A0");
|
assertLinkage("C", "A0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA10() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA10() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Aa0,I)", "compiler.err.does.not.override.abstract");
|
compileSpec("C(Aa0,I)", "compiler.err.does.not.override.abstract");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testA11() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testA11() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Ac0,Id0)");
|
compileSpec("C(Ac0,Id0)");
|
||||||
assertLinkage("C", "A0");
|
assertLinkage("C", "A0");
|
||||||
}
|
}
|
||||||
@ -1036,14 +1114,16 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
// Dan's set B
|
// Dan's set B
|
||||||
|
|
||||||
/* B1 can't be done, needs a second concrete class D
|
/* B1 can't be done, needs a second concrete class D
|
||||||
public void testB1() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testB1() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc1(Dc0)");
|
compileSpec("Cc1(Dc0)");
|
||||||
assertLinkage("C", "C1", "C1");
|
assertLinkage("C", "C1", "C1");
|
||||||
assertLinkage("D", "A0", LINKAGE_ERROR);
|
assertLinkage("D", "A0", LINKAGE_ERROR);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void testB2() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testB2() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc1(Ac0)");
|
compileSpec("Cc1(Ac0)");
|
||||||
assertLinkage("C", "C1", "C1");
|
assertLinkage("C", "C1", "C1");
|
||||||
}
|
}
|
||||||
@ -1056,22 +1136,26 @@ public class BridgeMethodsTemplateTest extends BridgeMethodTestCase {
|
|||||||
|
|
||||||
// B4 needs too many classes
|
// B4 needs too many classes
|
||||||
|
|
||||||
public void testB5() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testB5() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc1(Aa1(Id0))");
|
compileSpec("Cc1(Aa1(Id0))");
|
||||||
assertLinkage("C", "C1", "C1");
|
assertLinkage("C", "C1", "C1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testB6() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testB6() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Ac1(Id0))");
|
compileSpec("C(Ac1(Id0))");
|
||||||
assertLinkage("C", "A1", "A1");
|
assertLinkage("C", "A1", "A1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testB7() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testB7() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("Cc1(Id0)");
|
compileSpec("Cc1(Id0)");
|
||||||
assertLinkage("C", "C1", "C1");
|
assertLinkage("C", "C1", "C1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testB8() throws IOException, ReflectiveOperationException {
|
@Test
|
||||||
|
void testB8() throws IOException, ReflectiveOperationException {
|
||||||
compileSpec("C(Jd1(Id0))");
|
compileSpec("C(Jd1(Id0))");
|
||||||
assertLinkage("C", "J1", "J1");
|
assertLinkage("C", "J1", "J1");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# This file identifies root(s) of the test-ng hierarchy.
|
# This file identifies root(s) of the JUnit hierarchy.
|
||||||
|
|
||||||
TestNG.dirs = .
|
JUnit.dirs = .
|
||||||
|
|
||||||
lib.dirs = /lib/combo
|
lib.dirs = /lib/combo
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,7 +29,7 @@
|
|||||||
* @modules
|
* @modules
|
||||||
* jdk.compiler/com.sun.tools.javac.api
|
* jdk.compiler/com.sun.tools.javac.api
|
||||||
* jdk.compiler/com.sun.tools.javac.util
|
* jdk.compiler/com.sun.tools.javac.util
|
||||||
* @run testng BoundUnboundSearchTest
|
* @run junit BoundUnboundSearchTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.function.*;
|
import java.util.function.*;
|
||||||
@ -40,13 +40,10 @@ import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper;
|
|||||||
import com.sun.tools.javac.util.Assert;
|
import com.sun.tools.javac.util.Assert;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic;
|
import com.sun.tools.javac.util.JCDiagnostic;
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import tools.javac.combo.CompilationTestCase;
|
import tools.javac.combo.CompilationTestCase;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
class BoundUnboundSearchTest extends CompilationTestCase {
|
||||||
|
|
||||||
@Test
|
|
||||||
public class BoundUnboundSearchTest extends CompilationTestCase {
|
|
||||||
static final String TEMPLATE =
|
static final String TEMPLATE =
|
||||||
"""
|
"""
|
||||||
import java.util.function.*;
|
import java.util.function.*;
|
||||||
@ -58,7 +55,7 @@ public class BoundUnboundSearchTest extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
""";
|
""";
|
||||||
|
|
||||||
public BoundUnboundSearchTest() {
|
BoundUnboundSearchTest() {
|
||||||
setDefaultFilename("Test.java");
|
setDefaultFilename("Test.java");
|
||||||
setCompileOptions(new String[]{"--debug=dumpMethodReferenceSearchResults"});
|
setCompileOptions(new String[]{"--debug=dumpMethodReferenceSearchResults"});
|
||||||
}
|
}
|
||||||
@ -75,7 +72,8 @@ public class BoundUnboundSearchTest extends CompilationTestCase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test() {
|
@Test
|
||||||
|
void test() {
|
||||||
assertOK(
|
assertOK(
|
||||||
getDiagConsumer(0, -1),
|
getDiagConsumer(0, -1),
|
||||||
TEMPLATE.replaceFirst("#CANDIDATES",
|
TEMPLATE.replaceFirst("#CANDIDATES",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,18 +23,11 @@
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import org.testng.ITestResult;
|
|
||||||
import org.testng.annotations.AfterMethod;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
import tools.javac.combo.JavacTemplateTestBase;
|
import tools.javac.combo.JavacTemplateTestBase;
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toList;
|
class ScopeTest extends JavacTemplateTestBase {
|
||||||
|
|
||||||
@Test
|
|
||||||
public class ScopeTest extends JavacTemplateTestBase {
|
|
||||||
|
|
||||||
private static String st_block(String... statements) {
|
private static String st_block(String... statements) {
|
||||||
return Arrays.stream(statements).collect(Collectors.joining("", "{", "}"));
|
return Arrays.stream(statements).collect(Collectors.joining("", "{", "}"));
|
||||||
@ -84,14 +77,6 @@ public class ScopeTest extends JavacTemplateTestBase {
|
|||||||
return "!(" + expr + ")";
|
return "!(" + expr + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@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()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void program(String block) {
|
private void program(String block) {
|
||||||
String s = "class C { void m(Object o) " + block + "}";
|
String s = "class C { void m(Object o) " + block + "}";
|
||||||
addSourceFile("C.java", s);
|
addSourceFile("C.java", s);
|
||||||
@ -121,24 +106,28 @@ public class ScopeTest extends JavacTemplateTestBase {
|
|||||||
assertCompileFailed(expectedDiag);
|
assertCompileFailed(expectedDiag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIf() {
|
@Test
|
||||||
|
void testIf() {
|
||||||
assertOK(st_block(st_if(expr_o_match_str(), st_s_use(), st_return()), st_s_use()));
|
assertOK(st_block(st_if(expr_o_match_str(), st_s_use(), st_return()), st_s_use()));
|
||||||
assertOK(st_block(st_if(expr_not(expr_o_match_str()), st_return(), st_s_use()), st_s_use()));
|
assertOK(st_block(st_if(expr_not(expr_o_match_str()), st_return(), st_s_use()), st_s_use()));
|
||||||
assertFail("compiler.err.cant.resolve.location", st_block(st_if(expr_o_match_str(), st_s_use(), st_noop()), st_s_use()));
|
assertFail("compiler.err.cant.resolve.location", st_block(st_if(expr_o_match_str(), st_s_use(), st_noop()), st_s_use()));
|
||||||
assertFail("compiler.err.cant.resolve.location", st_block(st_if(expr_not(expr_o_match_str()), st_noop(), st_s_use()), st_s_use()));
|
assertFail("compiler.err.cant.resolve.location", st_block(st_if(expr_not(expr_o_match_str()), st_noop(), st_s_use()), st_s_use()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWhile() {
|
@Test
|
||||||
|
void testWhile() {
|
||||||
assertOK(st_block(st_while(expr_not(expr_o_match_str()), st_noop()), st_s_use()));
|
assertOK(st_block(st_while(expr_not(expr_o_match_str()), st_noop()), st_s_use()));
|
||||||
assertFail("compiler.err.cant.resolve.location", st_block(st_while(expr_not(expr_o_match_str()), st_break()), st_s_use()));
|
assertFail("compiler.err.cant.resolve.location", st_block(st_while(expr_not(expr_o_match_str()), st_break()), st_s_use()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDoWhile() {
|
@Test
|
||||||
|
void testDoWhile() {
|
||||||
assertOK(st_block(st_do_while(st_noop(), expr_not(expr_o_match_str())), st_s_use()));
|
assertOK(st_block(st_do_while(st_noop(), expr_not(expr_o_match_str())), st_s_use()));
|
||||||
assertFail("compiler.err.cant.resolve.location", st_block(st_do_while(st_break(), expr_not(expr_o_match_str())), st_s_use()));
|
assertFail("compiler.err.cant.resolve.location", st_block(st_do_while(st_break(), expr_not(expr_o_match_str())), st_s_use()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFor() {
|
@Test
|
||||||
|
void testFor() {
|
||||||
assertOK(st_block(st_for(expr_empty(), expr_not(expr_o_match_str()), expr_empty(), st_noop()), st_s_use()));
|
assertOK(st_block(st_for(expr_empty(), expr_not(expr_o_match_str()), expr_empty(), st_noop()), st_s_use()));
|
||||||
assertFail("compiler.err.cant.resolve.location", st_block(st_for(expr_empty(), expr_not(expr_o_match_str()), expr_empty(), st_break()), st_s_use()));
|
assertFail("compiler.err.cant.resolve.location", st_block(st_for(expr_empty(), expr_not(expr_o_match_str()), expr_empty(), st_break()), st_s_use()));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
TestNG.dirs = .
|
JUnit.dirs = .
|
||||||
|
|
||||||
lib.dirs = /lib/combo
|
lib.dirs = /lib/combo
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,17 +29,15 @@
|
|||||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||||
* jdk.compiler/com.sun.tools.javac.file
|
* jdk.compiler/com.sun.tools.javac.file
|
||||||
* jdk.compiler/com.sun.tools.javac.util
|
* jdk.compiler/com.sun.tools.javac.util
|
||||||
* @run testng/othervm LocalStaticDeclarations2
|
* @run junit/othervm LocalStaticDeclarations2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import tools.javac.combo.CompilationTestCase;
|
import tools.javac.combo.CompilationTestCase;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
class LocalStaticDeclarations2 extends CompilationTestCase {
|
||||||
|
@Test
|
||||||
@Test
|
void testLocalStatic() {
|
||||||
public class LocalStaticDeclarations2 extends CompilationTestCase {
|
|
||||||
public void testLocalStatic() {
|
|
||||||
assertOK(
|
assertOK(
|
||||||
"""
|
"""
|
||||||
class Test {
|
class Test {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -39,8 +39,8 @@
|
|||||||
* java.base/jdk.internal.classfile.components
|
* java.base/jdk.internal.classfile.components
|
||||||
* java.base/jdk.internal.classfile.impl
|
* java.base/jdk.internal.classfile.impl
|
||||||
* @build JavacTestingAbstractProcessor
|
* @build JavacTestingAbstractProcessor
|
||||||
* @run testng/othervm -DuseAP=false RecordCompilationTests
|
* @run junit/othervm -DuseAP=false RecordCompilationTests
|
||||||
* @run testng/othervm -DuseAP=true RecordCompilationTests
|
* @run junit/othervm -DuseAP=true RecordCompilationTests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -81,11 +81,10 @@ import com.sun.tools.javac.code.Symbol;
|
|||||||
import com.sun.tools.javac.code.Symbol.VarSymbol;
|
import com.sun.tools.javac.code.Symbol.VarSymbol;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic;
|
import com.sun.tools.javac.util.JCDiagnostic;
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
import tools.javac.combo.CompilationTestCase;
|
import tools.javac.combo.CompilationTestCase;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static java.lang.annotation.ElementType.*;
|
import static java.lang.annotation.ElementType.*;
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
/** Records are the first feature which sports automatic injection of (declarative and type) annotations : from a
|
/** Records are the first feature which sports automatic injection of (declarative and type) annotations : from a
|
||||||
* given record component to one or more record members, if applicable.
|
* given record component to one or more record members, if applicable.
|
||||||
@ -99,8 +98,7 @@ import static org.testng.Assert.assertEquals;
|
|||||||
* method: testAnnos()
|
* method: testAnnos()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Test
|
class RecordCompilationTests extends CompilationTestCase {
|
||||||
public class RecordCompilationTests extends CompilationTestCase {
|
|
||||||
private static String[] OPTIONS_WITH_AP = {"-processor", SimplestAP.class.getName()};
|
private static String[] OPTIONS_WITH_AP = {"-processor", SimplestAP.class.getName()};
|
||||||
|
|
||||||
private static final List<String> BAD_COMPONENT_NAMES = List.of(
|
private static final List<String> BAD_COMPONENT_NAMES = List.of(
|
||||||
@ -128,7 +126,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
System.out.println(useAP ? "running all tests using an annotation processor" : "running all tests without annotation processor");
|
System.out.println(useAP ? "running all tests using an annotation processor" : "running all tests without annotation processor");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMalformedDeclarations() {
|
@Test
|
||||||
|
void testMalformedDeclarations() {
|
||||||
assertFail("compiler.err.premature.eof", "record R()");
|
assertFail("compiler.err.premature.eof", "record R()");
|
||||||
assertFail("compiler.err.expected", "record R();");
|
assertFail("compiler.err.expected", "record R();");
|
||||||
assertFail("compiler.err.illegal.start.of.type", "record R(,) { }");
|
assertFail("compiler.err.illegal.start.of.type", "record R(,) { }");
|
||||||
@ -150,7 +149,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.instance.initializer.not.allowed.in.records", "record R(int i) { {} }");
|
assertFail("compiler.err.instance.initializer.not.allowed.in.records", "record R(int i) { {} }");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodDeclarations() {
|
@Test
|
||||||
|
void testGoodDeclarations() {
|
||||||
assertOK("public record R() { }");
|
assertOK("public record R() { }");
|
||||||
assertOK("record R() { }");
|
assertOK("record R() { }");
|
||||||
assertOK("record R() implements java.io.Serializable, Runnable { public void run() { } }");
|
assertOK("record R() implements java.io.Serializable, Runnable { public void run() { } }");
|
||||||
@ -180,7 +180,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodMemberDeclarations() {
|
@Test
|
||||||
|
void testGoodMemberDeclarations() {
|
||||||
String template = "public record R(int x) {\n"
|
String template = "public record R(int x) {\n"
|
||||||
+ " public R(int x) { this.x = x; }\n"
|
+ " public R(int x) { this.x = x; }\n"
|
||||||
+ " public int x() { return x; }\n"
|
+ " public int x() { return x; }\n"
|
||||||
@ -191,12 +192,14 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
assertOK(template);
|
assertOK(template);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBadComponentNames() {
|
@Test
|
||||||
|
void testBadComponentNames() {
|
||||||
for (String s : BAD_COMPONENT_NAMES)
|
for (String s : BAD_COMPONENT_NAMES)
|
||||||
assertFail("compiler.err.illegal.record.component.name", "record R(int #) { } ", s);
|
assertFail("compiler.err.illegal.record.component.name", "record R(int #) { } ", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRestrictedIdentifiers() {
|
@Test
|
||||||
|
void testRestrictedIdentifiers() {
|
||||||
for (String s : List.of("interface record { void m(); }",
|
for (String s : List.of("interface record { void m(); }",
|
||||||
"@interface record { }",
|
"@interface record { }",
|
||||||
"class record { }",
|
"class record { }",
|
||||||
@ -215,7 +218,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testValidMembers() {
|
@Test
|
||||||
|
void testValidMembers() {
|
||||||
for (String s : List.of("record X(int j) { }",
|
for (String s : List.of("record X(int j) { }",
|
||||||
"interface I { }",
|
"interface I { }",
|
||||||
"static { }",
|
"static { }",
|
||||||
@ -226,12 +230,14 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCyclic() {
|
@Test
|
||||||
|
void testCyclic() {
|
||||||
// Cyclic records are OK, but cyclic inline records would not be
|
// Cyclic records are OK, but cyclic inline records would not be
|
||||||
assertOK("record R(R r) { }");
|
assertOK("record R(R r) { }");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBadExtends() {
|
@Test
|
||||||
|
void testBadExtends() {
|
||||||
assertFail("compiler.err.expected", "record R(int x) extends Object { }");
|
assertFail("compiler.err.expected", "record R(int x) extends Object { }");
|
||||||
assertFail("compiler.err.expected", "record R(int x) {}\n"
|
assertFail("compiler.err.expected", "record R(int x) {}\n"
|
||||||
+ "record R2(int x) extends R { }");
|
+ "record R2(int x) extends R { }");
|
||||||
@ -239,7 +245,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
+ "class C extends R { }");
|
+ "class C extends R { }");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoExtendRecord() {
|
@Test
|
||||||
|
void testNoExtendRecord() {
|
||||||
assertFail("compiler.err.invalid.supertype.record",
|
assertFail("compiler.err.invalid.supertype.record",
|
||||||
"""
|
"""
|
||||||
class R extends Record {
|
class R extends Record {
|
||||||
@ -251,7 +258,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFieldDeclarations() {
|
@Test
|
||||||
|
void testFieldDeclarations() {
|
||||||
// static fields are OK
|
// static fields are OK
|
||||||
assertOK("public record R(int x) {\n" +
|
assertOK("public record R(int x) {\n" +
|
||||||
" static int I = 1;\n" +
|
" static int I = 1;\n" +
|
||||||
@ -279,7 +287,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
"}");
|
"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAccessorRedeclaration() {
|
@Test
|
||||||
|
void testAccessorRedeclaration() {
|
||||||
assertOK("public record R(int x) {\n" +
|
assertOK("public record R(int x) {\n" +
|
||||||
" public int x() { return x; };" +
|
" public int x() { return x; };" +
|
||||||
"}");
|
"}");
|
||||||
@ -335,7 +344,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
"}");
|
"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConstructorRedeclaration() {
|
@Test
|
||||||
|
void testConstructorRedeclaration() {
|
||||||
for (String goodCtor : List.of(
|
for (String goodCtor : List.of(
|
||||||
"public R(int x) { this(x, 0); }",
|
"public R(int x) { this(x, 0); }",
|
||||||
"public R(int x, int y) { this.x = x; this.y = y; }",
|
"public R(int x, int y) { this.x = x; this.y = y; }",
|
||||||
@ -426,7 +436,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
"public R(int a) { super(); this.a = a; }");
|
"public R(int a) { super(); this.a = a; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAnnotationCriteria() {
|
@Test
|
||||||
|
void testAnnotationCriteria() {
|
||||||
String imports = "import java.lang.annotation.*;\n";
|
String imports = "import java.lang.annotation.*;\n";
|
||||||
String template = "@Target({ # }) @interface A {}\n";
|
String template = "@Target({ # }) @interface A {}\n";
|
||||||
EnumMap<ElementType, String> annotations = new EnumMap<>(ElementType.class);
|
EnumMap<ElementType, String> annotations = new EnumMap<>(ElementType.class);
|
||||||
@ -435,7 +446,7 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
EnumSet<ElementType> goodSet = EnumSet.of(RECORD_COMPONENT, FIELD, METHOD, PARAMETER, TYPE_USE);
|
EnumSet<ElementType> goodSet = EnumSet.of(RECORD_COMPONENT, FIELD, METHOD, PARAMETER, TYPE_USE);
|
||||||
EnumSet<ElementType> badSet = EnumSet.of(CONSTRUCTOR, PACKAGE, TYPE, LOCAL_VARIABLE, ANNOTATION_TYPE, TYPE_PARAMETER, MODULE);
|
EnumSet<ElementType> badSet = EnumSet.of(CONSTRUCTOR, PACKAGE, TYPE, LOCAL_VARIABLE, ANNOTATION_TYPE, TYPE_PARAMETER, MODULE);
|
||||||
|
|
||||||
assertEquals(goodSet.size() + badSet.size(), values().length);
|
Assert.check(goodSet.size() + badSet.size() == values().length);
|
||||||
String A_GOOD = template.replace("#",
|
String A_GOOD = template.replace("#",
|
||||||
goodSet.stream().map(ElementType::name).map(s -> "ElementType." + s).collect(Collectors.joining(",")));
|
goodSet.stream().map(ElementType::name).map(s -> "ElementType." + s).collect(Collectors.joining(",")));
|
||||||
String A_BAD = template.replace("#",
|
String A_BAD = template.replace("#",
|
||||||
@ -459,7 +470,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
// TODO: OK to redeclare with or without same annos
|
// TODO: OK to redeclare with or without same annos
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNestedRecords() {
|
@Test
|
||||||
|
void testNestedRecords() {
|
||||||
String template = "class R { \n" +
|
String template = "class R { \n" +
|
||||||
" # record RR(int a) { }\n" +
|
" # record RR(int a) { }\n" +
|
||||||
"}";
|
"}";
|
||||||
@ -477,7 +489,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
assertOK("record R(int x) { # }", s);
|
assertOK("record R(int x) { # }", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDuplicatedMember() {
|
@Test
|
||||||
|
void testDuplicatedMember() {
|
||||||
String template
|
String template
|
||||||
= " record R(int i) {\n" +
|
= " record R(int i) {\n" +
|
||||||
" public int i() { return i; }\n" +
|
" public int i() { return i; }\n" +
|
||||||
@ -486,7 +499,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.already.defined", template);
|
assertFail("compiler.err.already.defined", template);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStaticLocals() {
|
@Test
|
||||||
|
void testStaticLocals() {
|
||||||
// static locals can't capture local variables, instance fields or type variables
|
// static locals can't capture local variables, instance fields or type variables
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"record RR(int x) { public int x() { return y; }};",
|
"record RR(int x) { public int x() { return y; }};",
|
||||||
@ -576,7 +590,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
assertOK("class R { void m() { final record RR(int x) { }; } }");
|
assertOK("class R { void m() { final record RR(int x) { }; } }");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStaticDefinitionsInInnerClasses() {
|
@Test
|
||||||
|
void testStaticDefinitionsInInnerClasses() {
|
||||||
// static defs in inner classes can't capture instance fields or type variables
|
// static defs in inner classes can't capture instance fields or type variables
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
@ -1042,7 +1057,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReturnInCanonical_Compact() {
|
@Test
|
||||||
|
void testReturnInCanonical_Compact() {
|
||||||
assertFail("compiler.err.invalid.canonical.constructor.in.record", "record R(int x) { # }",
|
assertFail("compiler.err.invalid.canonical.constructor.in.record", "record R(int x) { # }",
|
||||||
"public R { return; }");
|
"public R { return; }");
|
||||||
assertFail("compiler.err.invalid.canonical.constructor.in.record", "record R(int x) { # }",
|
assertFail("compiler.err.invalid.canonical.constructor.in.record", "record R(int x) { # }",
|
||||||
@ -1051,7 +1067,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
assertOK("record R(int x) { public R { Runnable r = () -> { return; };} }");
|
assertOK("record R(int x) { public R { Runnable r = () -> { return; };} }");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testArgumentsAreNotFinalInCompact() {
|
@Test
|
||||||
|
void testArgumentsAreNotFinalInCompact() {
|
||||||
assertOK(
|
assertOK(
|
||||||
"""
|
"""
|
||||||
record R(int x) {
|
record R(int x) {
|
||||||
@ -1062,14 +1079,16 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoNativeMethods() {
|
@Test
|
||||||
|
void testNoNativeMethods() {
|
||||||
assertFail("compiler.err.mod.not.allowed.here", "record R(int x) { # }",
|
assertFail("compiler.err.mod.not.allowed.here", "record R(int x) { # }",
|
||||||
"public native R {}");
|
"public native R {}");
|
||||||
assertFail("compiler.err.mod.not.allowed.here", "record R(int x) { # }",
|
assertFail("compiler.err.mod.not.allowed.here", "record R(int x) { # }",
|
||||||
"public native void m();");
|
"public native void m();");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRecordsInsideInner() {
|
@Test
|
||||||
|
void testRecordsInsideInner() {
|
||||||
assertOK(
|
assertOK(
|
||||||
"""
|
"""
|
||||||
class Outer {
|
class Outer {
|
||||||
@ -1110,7 +1129,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAnnoInsideLocalOrAnonymous() {
|
@Test
|
||||||
|
void testAnnoInsideLocalOrAnonymous() {
|
||||||
assertFail("compiler.err.annotation.decl.not.allowed.here",
|
assertFail("compiler.err.annotation.decl.not.allowed.here",
|
||||||
"""
|
"""
|
||||||
class Outer {
|
class Outer {
|
||||||
@ -1214,7 +1234,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReceiverParameter() {
|
@Test
|
||||||
|
void testReceiverParameter() {
|
||||||
assertFail("compiler.err.receiver.parameter.not.applicable.constructor.toplevel.class",
|
assertFail("compiler.err.receiver.parameter.not.applicable.constructor.toplevel.class",
|
||||||
"""
|
"""
|
||||||
record R(int i) {
|
record R(int i) {
|
||||||
@ -1242,7 +1263,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOnlyOneFieldRef() throws Exception {
|
@Test
|
||||||
|
void testOnlyOneFieldRef() throws Exception {
|
||||||
for (String source : List.of(
|
for (String source : List.of(
|
||||||
"record R(int recordComponent) {}",
|
"record R(int recordComponent) {}",
|
||||||
"""
|
"""
|
||||||
@ -1292,7 +1314,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
|
|
||||||
// check that fields are initialized in a canonical constructor in the same declaration order as the corresponding
|
// check that fields are initialized in a canonical constructor in the same declaration order as the corresponding
|
||||||
// record component
|
// record component
|
||||||
public void testCheckInitializationOrderInCompactConstructor() throws Exception {
|
@Test
|
||||||
|
void testCheckInitializationOrderInCompactConstructor() throws Exception {
|
||||||
FieldInstruction putField1 = null;
|
FieldInstruction putField1 = null;
|
||||||
FieldInstruction putField2 = null;
|
FieldInstruction putField2 = null;
|
||||||
File dir = assertOK(true, "record R(int i, String s) { R {} }");
|
File dir = assertOK(true, "record R(int i, String s) { R {} }");
|
||||||
@ -1331,7 +1354,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAcceptRecordId() {
|
@Test
|
||||||
|
void testAcceptRecordId() {
|
||||||
String[] previousOptions = getCompileOptions();
|
String[] previousOptions = getCompileOptions();
|
||||||
try {
|
try {
|
||||||
String[] testOptions = {};
|
String[] testOptions = {};
|
||||||
@ -1348,7 +1372,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMultipleAnnosInRecord() throws Exception {
|
@Test
|
||||||
|
void testMultipleAnnosInRecord() throws Exception {
|
||||||
String[] previousOptions = getCompileOptions();
|
String[] previousOptions = getCompileOptions();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1389,7 +1414,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAnnos() throws Exception {
|
@Test
|
||||||
|
void testAnnos() throws Exception {
|
||||||
String[] previousOptions = getCompileOptions();
|
String[] previousOptions = getCompileOptions();
|
||||||
try {
|
try {
|
||||||
String srcTemplate =
|
String srcTemplate =
|
||||||
@ -1532,7 +1558,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
|
|
||||||
// JDK-8292159: TYPE_USE annotations on generic type arguments
|
// JDK-8292159: TYPE_USE annotations on generic type arguments
|
||||||
// of record components discarded
|
// of record components discarded
|
||||||
public void testOnlyTypeAnnotationsOnComponentField() throws Exception {
|
@Test
|
||||||
|
void testOnlyTypeAnnotationsOnComponentField() throws Exception {
|
||||||
String code =
|
String code =
|
||||||
"""
|
"""
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
@ -1755,7 +1782,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMethodsInheritedFromRecordArePublicAndFinal() throws Exception {
|
@Test
|
||||||
|
void testMethodsInheritedFromRecordArePublicAndFinal() throws Exception {
|
||||||
int numberOfFieldRefs = 0;
|
int numberOfFieldRefs = 0;
|
||||||
File dir = assertOK(true, "record R() {}");
|
File dir = assertOK(true, "record R() {}");
|
||||||
for (final File fileEntry : Objects.requireNonNull(dir.listFiles())) {
|
for (final File fileEntry : Objects.requireNonNull(dir.listFiles())) {
|
||||||
@ -1774,7 +1802,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
private static final List<String> ACCESSIBILITY = List.of(
|
private static final List<String> ACCESSIBILITY = List.of(
|
||||||
"public", "protected", "", "private");
|
"public", "protected", "", "private");
|
||||||
|
|
||||||
public void testCanonicalAccessibility() throws Exception {
|
@Test
|
||||||
|
void testCanonicalAccessibility() throws Exception {
|
||||||
// accessibility of canonical can't be stronger than that of the record type
|
// accessibility of canonical can't be stronger than that of the record type
|
||||||
for (String a1 : ACCESSIBILITY) {
|
for (String a1 : ACCESSIBILITY) {
|
||||||
for (String a2 : ACCESSIBILITY) {
|
for (String a2 : ACCESSIBILITY) {
|
||||||
@ -1823,7 +1852,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSameArity() {
|
@Test
|
||||||
|
void testSameArity() {
|
||||||
for (String source : List.of(
|
for (String source : List.of(
|
||||||
"""
|
"""
|
||||||
record R(int... args) {
|
record R(int... args) {
|
||||||
@ -1897,7 +1927,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSafeVararsAnno() {
|
@Test
|
||||||
|
void testSafeVararsAnno() {
|
||||||
assertFail("compiler.err.annotation.type.not.applicable",
|
assertFail("compiler.err.annotation.type.not.applicable",
|
||||||
"""
|
"""
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
@ -1959,7 +1990,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOverrideAtAccessor() {
|
@Test
|
||||||
|
void testOverrideAtAccessor() {
|
||||||
assertOK(
|
assertOK(
|
||||||
"""
|
"""
|
||||||
record R(int i) {
|
record R(int i) {
|
||||||
@ -1997,7 +2029,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoAssigmentInsideCompactRecord() {
|
@Test
|
||||||
|
void testNoAssigmentInsideCompactRecord() {
|
||||||
assertFail("compiler.err.cant.assign.val.to.var",
|
assertFail("compiler.err.cant.assign.val.to.var",
|
||||||
"""
|
"""
|
||||||
record R(int i) {
|
record R(int i) {
|
||||||
@ -2018,7 +2051,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoNPEStaticAnnotatedFields() {
|
@Test
|
||||||
|
void testNoNPEStaticAnnotatedFields() {
|
||||||
assertOK(
|
assertOK(
|
||||||
"""
|
"""
|
||||||
import java.lang.annotation.Native;
|
import java.lang.annotation.Native;
|
||||||
@ -2051,7 +2085,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDoNotAllowCStyleArraySyntaxForRecComponents() {
|
@Test
|
||||||
|
void testDoNotAllowCStyleArraySyntaxForRecComponents() {
|
||||||
assertFail("compiler.err.record.component.and.old.array.syntax",
|
assertFail("compiler.err.record.component.and.old.array.syntax",
|
||||||
"""
|
"""
|
||||||
record R(int i[]) {}
|
record R(int i[]) {}
|
||||||
@ -2069,7 +2104,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoWarningForSerializableRecords() {
|
@Test
|
||||||
|
void testNoWarningForSerializableRecords() {
|
||||||
if (!useAP) {
|
if (!useAP) {
|
||||||
// don't execute this test when the default annotation processor is on as it will fail due to
|
// don't execute this test when the default annotation processor is on as it will fail due to
|
||||||
// spurious warnings
|
// spurious warnings
|
||||||
@ -2084,7 +2120,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAnnotationsOnVarargsRecComp() {
|
@Test
|
||||||
|
void testAnnotationsOnVarargsRecComp() {
|
||||||
assertOK(
|
assertOK(
|
||||||
"""
|
"""
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
@ -2119,7 +2156,8 @@ public class RecordCompilationTests extends CompilationTestCase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSaveVarargsAnno() {
|
@Test
|
||||||
|
void testSaveVarargsAnno() {
|
||||||
// the compiler would generate an erronous accessor
|
// the compiler would generate an erronous accessor
|
||||||
assertFail("compiler.err.varargs.invalid.trustme.anno",
|
assertFail("compiler.err.varargs.invalid.trustme.anno",
|
||||||
"""
|
"""
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -33,20 +33,14 @@
|
|||||||
* jdk.compiler/com.sun.tools.javac.api
|
* jdk.compiler/com.sun.tools.javac.api
|
||||||
* jdk.compiler/com.sun.tools.javac.main
|
* jdk.compiler/com.sun.tools.javac.main
|
||||||
* @build toolbox.ToolBox toolbox.JavacTask
|
* @build toolbox.ToolBox toolbox.JavacTask
|
||||||
* @run testng/othervm -DuseAP=false SealedCompilationTests
|
* @run junit/othervm -DuseAP=false SealedCompilationTests
|
||||||
* @run testng/othervm -DuseAP=true SealedCompilationTests
|
* @run junit/othervm -DuseAP=true SealedCompilationTests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.constant.ClassDesc;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -54,16 +48,12 @@ import java.util.stream.Collectors;
|
|||||||
import javax.annotation.processing.AbstractProcessor;
|
import javax.annotation.processing.AbstractProcessor;
|
||||||
import javax.annotation.processing.RoundEnvironment;
|
import javax.annotation.processing.RoundEnvironment;
|
||||||
import javax.annotation.processing.SupportedAnnotationTypes;
|
import javax.annotation.processing.SupportedAnnotationTypes;
|
||||||
|
|
||||||
import javax.lang.model.element.TypeElement;
|
import javax.lang.model.element.TypeElement;
|
||||||
import javax.lang.model.SourceVersion;
|
import javax.lang.model.SourceVersion;
|
||||||
|
|
||||||
import com.sun.tools.javac.util.Assert;
|
import com.sun.tools.javac.util.Assert;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.testng.Assert.assertTrue;
|
|
||||||
import static org.testng.Assert.fail;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
import tools.javac.combo.CompilationTestCase;
|
import tools.javac.combo.CompilationTestCase;
|
||||||
|
|
||||||
import toolbox.ToolBox;
|
import toolbox.ToolBox;
|
||||||
@ -71,8 +61,9 @@ import toolbox.JavacTask;
|
|||||||
import toolbox.Task;
|
import toolbox.Task;
|
||||||
import toolbox.Task.OutputKind;
|
import toolbox.Task.OutputKind;
|
||||||
|
|
||||||
@Test
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
public class SealedCompilationTests extends CompilationTestCase {
|
|
||||||
|
class SealedCompilationTests extends CompilationTestCase {
|
||||||
|
|
||||||
ToolBox tb = new ToolBox();
|
ToolBox tb = new ToolBox();
|
||||||
|
|
||||||
@ -94,7 +85,7 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SealedCompilationTests() {
|
SealedCompilationTests() {
|
||||||
boolean useAP = System.getProperty("useAP") == null ? false : System.getProperty("useAP").equals("true");
|
boolean useAP = System.getProperty("useAP") == null ? false : System.getProperty("useAP").equals("true");
|
||||||
setDefaultFilename("SealedTest.java");
|
setDefaultFilename("SealedTest.java");
|
||||||
setCompileOptions(useAP ? OPTIONS_WITH_AP : new String[]{});
|
setCompileOptions(useAP ? OPTIONS_WITH_AP : new String[]{});
|
||||||
@ -116,7 +107,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
""";
|
""";
|
||||||
private static final List<String> SHELLS = List.of(NO_SHELL, NEST_SHELL, AUX_SHELL);
|
private static final List<String> SHELLS = List.of(NO_SHELL, NEST_SHELL, AUX_SHELL);
|
||||||
|
|
||||||
public void testSimpleExtension() {
|
@Test
|
||||||
|
void testSimpleExtension() {
|
||||||
String CC1 =
|
String CC1 =
|
||||||
"""
|
"""
|
||||||
sealed class Sup # { }
|
sealed class Sup # { }
|
||||||
@ -194,7 +186,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.non.sealed.sealed.or.final.expected", shell, expandMarkers(b, p, m));
|
assertFail("compiler.err.non.sealed.sealed.or.final.expected", shell, expandMarkers(b, p, m));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSealedAndRecords() {
|
@Test
|
||||||
|
void testSealedAndRecords() {
|
||||||
String P =
|
String P =
|
||||||
"""
|
"""
|
||||||
sealed interface Sup # { }
|
sealed interface Sup # { }
|
||||||
@ -210,7 +203,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test that a type that explicitly permits one type, can't be extended by another
|
// Test that a type that explicitly permits one type, can't be extended by another
|
||||||
public void testBadExtension() {
|
@Test
|
||||||
|
void testBadExtension() {
|
||||||
String CC2 =
|
String CC2 =
|
||||||
"""
|
"""
|
||||||
sealed class Sup permits Sub1 { }
|
sealed class Sup permits Sub1 { }
|
||||||
@ -241,7 +235,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.cant.inherit.from.sealed", shell, b);
|
assertFail("compiler.err.cant.inherit.from.sealed", shell, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRestrictedKeyword() {
|
@Test
|
||||||
|
void testRestrictedKeyword() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"class SealedTest { String sealed; }",
|
"class SealedTest { String sealed; }",
|
||||||
"class SealedTest { int sealed = 0; int non = 0; int ns = non-sealed; }",
|
"class SealedTest { int sealed = 0; int non = 0; int ns = non-sealed; }",
|
||||||
@ -289,7 +284,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRejectPermitsInNonSealedClass() {
|
@Test
|
||||||
|
void testRejectPermitsInNonSealedClass() {
|
||||||
assertFail("compiler.err.invalid.permits.clause",
|
assertFail("compiler.err.invalid.permits.clause",
|
||||||
"class SealedTest {\n" +
|
"class SealedTest {\n" +
|
||||||
" class NotSealed permits Sub {}\n" +
|
" class NotSealed permits Sub {}\n" +
|
||||||
@ -302,7 +298,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
"}");
|
"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTypeInPermitsIsSameClassOrSuper() {
|
@Test
|
||||||
|
void testTypeInPermitsIsSameClassOrSuper() {
|
||||||
assertFail("compiler.err.invalid.permits.clause",
|
assertFail("compiler.err.invalid.permits.clause",
|
||||||
"""
|
"""
|
||||||
sealed class Sealed permits Sealed {}
|
sealed class Sealed permits Sealed {}
|
||||||
@ -326,7 +323,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
/* It is a compile-time error if a class declaration has more than one of the class modifiers
|
/* It is a compile-time error if a class declaration has more than one of the class modifiers
|
||||||
* sealed, non-sealed and final
|
* sealed, non-sealed and final
|
||||||
*/
|
*/
|
||||||
public void testBadModifiers() {
|
@Test
|
||||||
|
void testBadModifiers() {
|
||||||
assertFail("compiler.err.non.sealed.with.no.sealed.supertype",
|
assertFail("compiler.err.non.sealed.with.no.sealed.supertype",
|
||||||
"class SealedTest { non-sealed class NoSealedSuper {} }");
|
"class SealedTest { non-sealed class NoSealedSuper {} }");
|
||||||
assertFail("compiler.err.mod.not.allowed.here",
|
assertFail("compiler.err.mod.not.allowed.here",
|
||||||
@ -344,7 +342,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.illegal.combination.of.modifiers", s);
|
assertFail("compiler.err.illegal.combination.of.modifiers", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAnonymous_FunctionalExpr_and_Sealed() {
|
@Test
|
||||||
|
void testAnonymous_FunctionalExpr_and_Sealed() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed interface I extends Runnable {
|
sealed interface I extends Runnable {
|
||||||
@ -403,7 +402,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.local.classes.cant.extend.sealed", s);
|
assertFail("compiler.err.local.classes.cant.extend.sealed", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoLocalSealedClasses() {
|
@Test
|
||||||
|
void testNoLocalSealedClasses() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed class C {
|
sealed class C {
|
||||||
@ -422,7 +422,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.sealed.or.non.sealed.local.classes.not.allowed", s);
|
assertFail("compiler.err.sealed.or.non.sealed.local.classes.not.allowed", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLocalCantExtendSealed() {
|
@Test
|
||||||
|
void testLocalCantExtendSealed() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed class C {
|
sealed class C {
|
||||||
@ -454,7 +455,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.local.classes.cant.extend.sealed", s);
|
assertFail("compiler.err.local.classes.cant.extend.sealed", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSealedInterfaceAndAbstracClasses() {
|
@Test
|
||||||
|
void testSealedInterfaceAndAbstracClasses() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed interface I {}
|
sealed interface I {}
|
||||||
@ -496,7 +498,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertOK(s);
|
assertOK(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEnumsCantBeSealedOrNonSealed() {
|
@Test
|
||||||
|
void testEnumsCantBeSealedOrNonSealed() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed interface I {}
|
sealed interface I {}
|
||||||
@ -511,7 +514,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertFail("compiler.err.mod.not.allowed.here", s);
|
assertFail("compiler.err.mod.not.allowed.here", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEnumsCanImplementSealedInterfaces() {
|
@Test
|
||||||
|
void testEnumsCanImplementSealedInterfaces() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed interface I {}
|
sealed interface I {}
|
||||||
@ -521,7 +525,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
assertOK(s);
|
assertOK(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testClassesCanExtendNonSealed() {
|
@Test
|
||||||
|
void testClassesCanExtendNonSealed() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed class C {}
|
sealed class C {}
|
||||||
@ -534,7 +539,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEmptyPermits() {
|
@Test
|
||||||
|
void testEmptyPermits() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed class C permits {}
|
sealed class C permits {}
|
||||||
@ -544,7 +550,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTypeVarInPermits() {
|
@Test
|
||||||
|
void testTypeVarInPermits() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
class Outer<T> {
|
class Outer<T> {
|
||||||
@ -555,7 +562,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRepeatedTypeInPermits() {
|
@Test
|
||||||
|
void testRepeatedTypeInPermits() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed class C permits Sub, Sub {}
|
sealed class C permits Sub, Sub {}
|
||||||
@ -566,7 +574,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSubtypeDoesntExtendSealed() {
|
@Test
|
||||||
|
void testSubtypeDoesntExtendSealed() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed class C permits Sub {}
|
sealed class C permits Sub {}
|
||||||
@ -590,7 +599,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAPIForPrimitiveAndArrayClasses() {
|
@Test
|
||||||
|
void testAPIForPrimitiveAndArrayClasses() {
|
||||||
for (Class<?> c : new Class[]{byte.class, byte[].class, short.class, short[].class, int.class, int[].class, long.class, long[].class,
|
for (Class<?> c : new Class[]{byte.class, byte[].class, short.class, short[].class, int.class, int[].class, long.class, long[].class,
|
||||||
float.class, float[].class, double.class, double[].class, char.class, char[].class, boolean.class, boolean[].class, void.class,
|
float.class, float[].class, double.class, double[].class, char.class, char[].class, boolean.class, boolean[].class, void.class,
|
||||||
String[].class}) {
|
String[].class}) {
|
||||||
@ -599,7 +609,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPrinting() throws Exception {
|
@Test
|
||||||
|
void testPrinting() throws Exception {
|
||||||
Path base = Paths.get("testPrinting");
|
Path base = Paths.get("testPrinting");
|
||||||
Path src = base.resolve("src");
|
Path src = base.resolve("src");
|
||||||
Path test = src.resolve("Test");
|
Path test = src.resolve("Test");
|
||||||
@ -715,7 +726,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNonSealedErroneousSuper() {
|
@Test
|
||||||
|
void testNonSealedErroneousSuper() {
|
||||||
assertFail("compiler.err.cant.resolve",
|
assertFail("compiler.err.cant.resolve",
|
||||||
d -> {
|
d -> {
|
||||||
if (diags.keys().size() != 1) {
|
if (diags.keys().size() != 1) {
|
||||||
@ -727,7 +739,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNonSealedErroneousSuperInterface() {
|
@Test
|
||||||
|
void testNonSealedErroneousSuperInterface() {
|
||||||
assertFail("compiler.err.cant.resolve",
|
assertFail("compiler.err.cant.resolve",
|
||||||
d -> {
|
d -> {
|
||||||
if (diags.keys().size() != 1) {
|
if (diags.keys().size() != 1) {
|
||||||
@ -739,7 +752,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIllFormedNonSealed() {
|
@Test
|
||||||
|
void testIllFormedNonSealed() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed class C permits Sub {}
|
sealed class C permits Sub {}
|
||||||
@ -767,7 +781,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
"byte[]", "short[]", "int[]", "long[]", "float[]", "double[]", "char[]", "boolean[]"
|
"byte[]", "short[]", "int[]", "long[]", "float[]", "double[]", "char[]", "boolean[]"
|
||||||
};
|
};
|
||||||
|
|
||||||
public void testPermitsClause() {
|
@Test
|
||||||
|
void testPermitsClause() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
// can't include a parameterized type
|
// can't include a parameterized type
|
||||||
"""
|
"""
|
||||||
@ -829,7 +844,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
return tb.findJavaFiles(paths);
|
return tb.findJavaFiles(paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSealedNonSealedWithOtherModifiers() {
|
@Test
|
||||||
|
void testSealedNonSealedWithOtherModifiers() {
|
||||||
String template1 =
|
String template1 =
|
||||||
"""
|
"""
|
||||||
@interface A {}
|
@interface A {}
|
||||||
@ -872,7 +888,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSubClassBeforeSealedClassInSameCU() {
|
@Test
|
||||||
|
void testSubClassBeforeSealedClassInSameCU() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
final class Sub extends Sealed {}
|
final class Sub extends Sealed {}
|
||||||
@ -951,7 +968,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDoNotAllowSealedAnnotation() {
|
@Test
|
||||||
|
void testDoNotAllowSealedAnnotation() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
sealed @interface A {}
|
sealed @interface A {}
|
||||||
@ -962,7 +980,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNarrowConversion() {
|
@Test
|
||||||
|
void testNarrowConversion() {
|
||||||
for (String s : List.of(
|
for (String s : List.of(
|
||||||
"""
|
"""
|
||||||
interface I {}
|
interface I {}
|
||||||
@ -1264,7 +1283,8 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIntersectionWithSealedClasses() {
|
@Test
|
||||||
|
void testIntersectionWithSealedClasses() {
|
||||||
assertOK(
|
assertOK(
|
||||||
"""
|
"""
|
||||||
class A { }
|
class A { }
|
||||||
|
Loading…
Reference in New Issue
Block a user