undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8264258
|
||||
* @summary Unknown lookups in the java package give misleading compilation errors
|
||||
* @compile/fail/ref=MisleadingNonExistentPathError.out -XDrawDiagnostics MisleadingNonExistentPathError.java
|
||||
*/
|
||||
package knownpkg;
|
||||
|
||||
public class MisleadingNonExistentPathError {
|
||||
|
||||
void classNotFound() {
|
||||
// Not found, but in an existing package
|
||||
Class<?> c1 = knownpkg.NotFound.class;
|
||||
|
||||
// Not found, but in a (system) package which exists and is in scope
|
||||
Class<?> c2 = java.lang.NotFound.class;
|
||||
|
||||
// Not found, on a genuinely unknown package
|
||||
Class<?> c3 = unknownpkg.NotFound.class;
|
||||
|
||||
// Not found, but in the 'java' package which is in scope as per JLS 6.3 and observable as per JLS 7.4.3
|
||||
Class<?> c4 = java.NotFound.class;
|
||||
|
||||
// Not found, but in a (system) package which exists and is in scope
|
||||
Object c5 = new java.lang();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue