/*
* 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 6968063 7127924
* @summary provide examples of code that generate diagnostics
* @build Example CheckExamples
*/
/*
* See CR 7127924 for info on why othervm is used.
*/
/**
* Check invariants for a set of examples.
* -- each example should exactly declare the keys that will be generated when
* it is run.
* -- together, the examples should cover the set of resource keys in the
* compiler.properties bundle. A list of exceptions may be given in the
* not-yet.txt file. Entries on the not-yet.txt list should not be
* covered by examples.
* When new keys are added to the resource bundle, it is strongly recommended
* that corresponding new examples be added here, if at all practical, instead
* of simply and lazily being added to the not-yet.txt list.
*/
public class CheckExamples {
/**
* Standard entry point.
*/
new CheckExamples().run();
}
/**
* Run the test.
*/
}
}
for (String k: e.getDeclaredKeys()) {
if (notYetList.contains(k))
declaredKeys.add(k);
}
}
ResourceBundle b =
}
}
}
"prefix", "#keys in tests", "#keys in javac", "%"));
int d = declaredCounts.get(p);
int r = resourceCounts.get(p);
if (r != 0)
}
if (errors > 0)
}
/**
* Get the complete set of examples to be checked.
*/
if (isValidExample(f))
}
return results;
}
}
/**
* Get the contents of the "not-yet" list.
*/
try {
if (hash != -1)
}
} catch (IOException e) {
throw new Error(e);
}
return results;
}
/**
* Read the contents of a file.
*/
try {
} finally {
}
}
/**
* Report an error.
*/
errors++;
}
int errors;
static class Counts {
"compiler.err.",
"compiler.warn.",
"compiler.note.",
"compiler.misc."
};
if (k.startsWith(p)) {
inc(p);
continue nextKey;
}
}
inc("other");
}
}
return (i == null ? 0 : i);
}
}
};
}