/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
/*
* @test
* @bug 7004029
* @summary Basher for star-import scopes
*/
public class StarImportTest {
}
int count = 1;
else
}
for (int i = 0; i < count; i++) {
t.run();
}
if (errors > 0)
}
/**
* Select a random element from an array of choices.
*/
}
/**
* Write a message to stderr.
*/
}
/**
* Write a message to stderr, and dump a scope.
*/
sep = ",";
}
sep = ", (";
}
}
/**
* Write an error message to stderr.
*/
errors++;
}
int errors;
/** Class to encapsulate a test run. */
class Test {
/** Run the test. */
log ("starting test");
setup();
test();
}
/**
* Setup env by creating pseudo-random collection of names, packages and classes.
*/
void setup() {
log ("setup");
for (int i = 0; i < setupCount; i++) {
case NAMES:
setupNames();
break;
case PACKAGE:
setupPackage();
break;
case CLASS:
setupClass();
break;
}
}
}
/**
* Set up a random number of names.
*/
void setupNames() {
for (int i = 0; i < count; i++) {
}
}
/**
* Set up a package containing a random number of member elements.
*/
void setupPackage() {
p.members_field = new Scope(p);
for (int i = 0; i < count; i++) {
// log("setup: created " + c1);
// log("setup: created " + c2);
}
}
// log("package " + p, p.members_field);
}
/**
* Set up a class containing a random number of member elements.
*/
void setupClass() {
// log("setup: created " + c);
for (int i = 0; i < count; i++) {
// log("setup: created " + ic);
}
}
/**
* Create a star-import scope and a model therof, from the packages and
* classes created by setupPackages and setupClasses.
* @throws Exception for fatal errors, such as from reflection
*/
log ("createStarImportScope");
// if StarImportScope exists, use it, otherwise, for testing legacy code,
// fall back on ImportScope
try {
} catch (ClassNotFoundException e) {
}
starImportModel = new Model();
// log("importAll", members);
} else {
// The following lines are taken from MemberEnter.importAll,
// before the use of StarImportScope.importAll.
}
}
}
}
// log("star-import scope", starImportScope);
}
/**
* The core of the test. In a random order, move nested classes from
* the package in which they created to the class which should own them.
*/
void test() {
log ("test");
for (PackageSymbol p: packages) {
}
}
// select a random nested class to move from package to class
// remove from star import model
// owner should be a package
// determine new owner
// log(sym + " owner: " + sym.owner, sym.owner.members());
// log("outer: " + outerName + " " + outer);
// remove from package
// rename and insert into class
// verify
}
}
return sym;
}
int nextNameSerial;
int nextPackageSerial;
int nextClassSerial;
}
class Model {
}
else {
if (ok) {
// log(sym.name + "(" + sym + ") removed from reference model");
} else {
}
}
}
/**
* Check the contents of a scope
*/
// First, check all entries in scope are in map
int bogusCount = 0;
bogusCount++;
} else {
}
} else {
}
}
}
if (bogusCount > 0) {
}
// Second, check all entries in map are in scope
continue;
}
continue nextSym;
}
}
}
}
}
}