This commit is contained in:
Lana Steuck 2015-01-29 15:36:21 -08:00
commit 6fa0aa7e15
32 changed files with 253 additions and 353 deletions

View File

@ -783,45 +783,4 @@ public class Locations {
&& (n.endsWith(".jar") || n.endsWith(".zip"));
}
/**
* Utility method for converting a search path string to an array of directory and JAR file
* URLs.
*
* Note that this method is called by the DocletInvoker.
*
* @param path the search path string
* @return the resulting array of directory and JAR file URLs
*/
public static URL[] pathToURLs(String path) {
java.util.List<URL> urls = new ArrayList<>();
for (String s: path.split(Pattern.quote(File.pathSeparator))) {
if (!s.isEmpty()) {
URL url = fileToURL(Paths.get(s));
if (url != null) {
urls.add(url);
}
}
}
return urls.toArray(new URL[urls.size()]);
}
/**
* Returns the directory or JAR file URL corresponding to the specified local file name.
*
* @param file the Path object
* @return the resulting directory or JAR file URL, or null if unknown
*/
private static URL fileToURL(Path file) {
Path p;
try {
p = file.toRealPath();
} catch (IOException e) {
p = file.toAbsolutePath();
}
try {
return p.normalize().toUri().toURL();
} catch (MalformedURLException e) {
return null;
}
}
}

View File

@ -218,7 +218,7 @@ public class Analyzer {
Archive targetArchive = findArchive(t);
if (filter.accepts(o, archive, t, targetArchive)) {
addDep(o, t);
if (!requires.contains(targetArchive)) {
if (archive != targetArchive && !requires.contains(targetArchive)) {
requires.add(targetArchive);
}
}

View File

@ -75,20 +75,11 @@ public class Archive {
}
public void addClass(Location origin) {
Set<Location> set = deps.get(origin);
if (set == null) {
set = new HashSet<>();
deps.put(origin, set);
}
deps.computeIfAbsent(origin, _k -> new HashSet<>());
}
public void addClass(Location origin, Location target) {
Set<Location> set = deps.get(origin);
if (set == null) {
set = new HashSet<>();
deps.put(origin, set);
}
set.add(target);
deps.computeIfAbsent(origin, _k -> new HashSet<>()).add(target);
}
public Set<Location> getClasses() {
@ -115,6 +106,10 @@ public class Archive {
return filename;
}
public Path path() {
return path;
}
interface Visitor {
void visit(Location origin, Location target);
}

View File

@ -611,6 +611,9 @@ class JdepsTask {
deque.add(cn);
}
a.addClass(d.getOrigin(), d.getTarget());
} else {
// ensure that the parsed class is added the archive
a.addClass(d.getOrigin());
}
}
for (String name : a.reader().skippedEntries()) {
@ -643,6 +646,7 @@ class JdepsTask {
// if name is a fully-qualified class name specified
// from command-line, this class might already be parsed
doneClasses.add(classFileName);
for (Dependency d : finder.findDependencies(cf)) {
if (depth == 0) {
// ignore the dependency
@ -654,6 +658,9 @@ class JdepsTask {
if (!doneClasses.contains(cn) && !deque.contains(cn)) {
deque.add(cn);
}
} else {
// ensure that the parsed class is added the archive
a.addClass(d.getOrigin());
}
}
}
@ -809,36 +816,53 @@ class JdepsTask {
}
}
private List<Archive> getClassPathArchives(String paths) throws IOException {
/*
* Returns the list of Archive specified in cpaths and not included
* initialArchives
*/
private List<Archive> getClassPathArchives(String cpaths)
throws IOException
{
List<Archive> result = new ArrayList<>();
if (paths.isEmpty()) {
if (cpaths.isEmpty()) {
return result;
}
for (String p : paths.split(File.pathSeparator)) {
List<Path> paths = new ArrayList<>();
for (String p : cpaths.split(File.pathSeparator)) {
if (p.length() > 0) {
List<Path> files = new ArrayList<>();
// wildcard to parse all JAR files e.g. -classpath dir/*
int i = p.lastIndexOf(".*");
if (i > 0) {
Path dir = Paths.get(p.substring(0, i));
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.jar")) {
for (Path entry : stream) {
files.add(entry);
paths.add(entry);
}
}
} else {
files.add(Paths.get(p));
}
for (Path f : files) {
if (Files.exists(f)) {
result.add(Archive.getInstance(f));
}
paths.add(Paths.get(p));
}
}
}
for (Path path : paths) {
boolean found = initialArchives.stream()
.map(Archive::path)
.anyMatch(p -> isSameFile(path, p));
if (!found && Files.exists(path)) {
result.add(Archive.getInstance(path));
}
}
return result;
}
private boolean isSameFile(Path p1, Path p2) {
try {
return Files.isSameFile(p1, p2);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
class RawOutputFormatter implements Analyzer.Visitor {
private final PrintWriter writer;
private String pkg = "";

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, 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
@ -26,19 +26,25 @@
package com.sun.tools.javadoc;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.regex.Pattern;
import javax.tools.DocumentationTool;
import javax.tools.JavaFileManager;
import com.sun.javadoc.*;
import com.sun.tools.javac.file.Locations;
import com.sun.tools.javac.util.ClientCodeException;
import com.sun.tools.javac.util.List;
import static com.sun.javadoc.LanguageVersion.*;
@ -108,7 +114,7 @@ public class DocletInvoker {
cpString = appendPath(System.getProperty("env.class.path"), cpString);
cpString = appendPath(System.getProperty("java.class.path"), cpString);
cpString = appendPath(docletPath, cpString);
URL[] urls = Locations.pathToURLs(cpString);
URL[] urls = pathToURLs(cpString);
if (docletParentClassLoader == null)
appClassLoader = new URLClassLoader(urls, getDelegationClassLoader(docletClassName));
else
@ -191,7 +197,7 @@ public class DocletInvoker {
return false;
}
if (retVal instanceof Boolean) {
return ((Boolean)retVal).booleanValue();
return ((Boolean)retVal);
} else {
messager.error(Messager.NOPOS, "main.must_return_boolean",
docletClassName, methodName);
@ -215,7 +221,7 @@ public class DocletInvoker {
return -1;
}
if (retVal instanceof Integer) {
return ((Integer)retVal).intValue();
return ((Integer)retVal);
} else {
messager.error(Messager.NOPOS, "main.must_return_int",
docletClassName, methodName);
@ -240,7 +246,7 @@ public class DocletInvoker {
return false;
}
if (retVal instanceof Boolean) {
return ((Boolean)retVal).booleanValue();
return ((Boolean)retVal);
} else {
messager.error(Messager.NOPOS, "main.must_return_boolean",
docletClassName, methodName);
@ -326,11 +332,53 @@ public class DocletInvoker {
} else {
messager.error(Messager.NOPOS, "main.exception_thrown",
docletClassName, methodName, exc.toString());
exc.getTargetException().printStackTrace();
exc.getTargetException().printStackTrace(System.err);
}
throw new DocletInvokeException();
} finally {
Thread.currentThread().setContextClassLoader(savedCCL);
}
}
/**
* Utility method for converting a search path string to an array of directory and JAR file
* URLs.
*
* Note that this method is called by the DocletInvoker.
*
* @param path the search path string
* @return the resulting array of directory and JAR file URLs
*/
private static URL[] pathToURLs(String path) {
java.util.List<URL> urls = new ArrayList<>();
for (String s: path.split(Pattern.quote(File.pathSeparator))) {
if (!s.isEmpty()) {
URL url = fileToURL(Paths.get(s));
if (url != null) {
urls.add(url);
}
}
}
return urls.toArray(new URL[urls.size()]);
}
/**
* Returns the directory or JAR file URL corresponding to the specified local file name.
*
* @param file the Path object
* @return the resulting directory or JAR file URL, or null if unknown
*/
private static URL fileToURL(Path file) {
Path p;
try {
p = file.toRealPath();
} catch (IOException e) {
p = file.toAbsolutePath();
}
try {
return p.normalize().toUri().toURL();
} catch (MalformedURLException e) {
return null;
}
}
}

View File

@ -1,31 +1,8 @@
/*
* Copyright (c) 2006, 2007, 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.
*/
/**
* @test
* @test /nodynamiccopyright/
* @bug 6359949
* @summary (at)Override of static shouldn't be accepted (compiler shouldissue an error/warning)
* @compile/fail T6359949a.java
* @compile/fail/ref=T6359949a.out -XDrawDiagnostics T6359949a.java
*/
class Example {

View File

@ -0,0 +1,2 @@
T6359949a.java:15:5: compiler.err.method.does.not.override.superclass
1 error

View File

@ -1,37 +1,12 @@
/*
* Copyright (c) 2003, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4901262
* @summary Constraints regarding annotation defaults
* @author gafter
*
* @compile A.java
* @compile B.java
* @compile C.java
* @compile/fail Derr.java
* @compile/fail Eerr.java
* @compile A.java B.java C.java
* @compile/fail/ref=Derr.out -XDrawDiagnostics Derr.java
* @compile/fail/ref=Eerr.out -XDrawDiagnostics Eerr.java
*/
public @interface A {

View File

@ -0,0 +1,2 @@
Derr.java:24:1: compiler.err.annotation.missing.default.value: A, x
1 error

View File

@ -0,0 +1,2 @@
Eerr.java:24:9: compiler.err.duplicate.annotation.member.value: x, A
1 error

View File

@ -1,34 +1,10 @@
/*
* Copyright (c) 2003, 2010, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4903501
* @summary Please add annotation <at>Deprecated to supplant the javadoc tag
* @author gafter
*
* @compile/fail -Xlint:dep-ann -Werror Dep.java
* @compile -Xlint:dep-ann Dep.java
* @compile/fail/ref=Dep.out -XDrawDiagnostics -Xlint:dep-ann -Werror Dep.java
*/
/** @deprecated */

View File

@ -0,0 +1,4 @@
Dep.java:11:1: compiler.warn.missing.deprecated.annotation
- compiler.err.warnings.and.werror
1 error
1 warning

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 2003, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4821359
* @summary Add -Xlint flag
* @author gafter
*
* @compile/fail -Xlint:deprecation -Werror Deprecation.java
* @compile/fail/ref=Deprecation.out -XDrawDiagnostics -Xlint:deprecation -Werror Deprecation.java
*/
/** @deprecated */

View File

@ -0,0 +1,4 @@
Deprecation.java:14:17: compiler.warn.has.been.deprecated: A, compiler.misc.unnamed.package
- compiler.err.warnings.and.werror
1 error
1 warning

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 2003, 2004, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4821359 4981267
* @summary Add -Xlint flag
* @author gafter
*
* @compile/fail -Xlint:fallthrough -Werror FallThrough.java
* @compile/fail/ref=FallThrough.out -XDrawDiagnostics -Xlint:fallthrough -Werror FallThrough.java
*/
class FallThrough {

View File

@ -0,0 +1,4 @@
FallThrough.java:16:9: compiler.warn.possible.fall-through.into.case
- compiler.err.warnings.and.werror
1 error
1 warning

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 2003, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4821359
* @summary Add -Xlint flag
* @author gafter
*
* @compile/fail -Xlint:unchecked -Werror Unchecked.java
* @compile/fail/ref=Unchecked.out -XDrawDiagnostics -Xlint:unchecked -Werror Unchecked.java
*/
class Unchecked<T> {

View File

@ -0,0 +1,4 @@
Unchecked.java:12:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), Unchecked, Unchecked<java.lang.String>
- compiler.err.warnings.and.werror
1 error
1 warning

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 2003, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4929736
* @summary Missing ambiguity error when two methods are equally specific
* @author gafter
*
* @compile/fail Ambig1.java
* @compile/fail/ref=Ambig1.out -XDrawDiagnostics Ambig1.java
*/
package ambig1;

View File

@ -0,0 +1,2 @@
Ambig1.java:24:9: compiler.err.ref.ambiguous: f, kindname.method, f(int), ambig1.B, kindname.method, f(int), ambig1.A
1 error

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 2004, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4979456
* @summary NPE while compiling static import of inaccessible class member
* @author gafter
*
* @compile/fail ImportPrivate.java
* @compile/fail/ref=ImportPrivate.out -XDrawDiagnostics ImportPrivate.java
*/
package importPrivate;

View File

@ -0,0 +1,3 @@
ImportPrivate.java:12:1: compiler.err.cant.resolve.location: kindname.static, m, , , kindname.class, importPrivate.A
ImportPrivate.java:22:9: compiler.err.cant.resolve.location.args: kindname.method, m, , , (compiler.misc.location: kindname.class, importPrivate.MyTest, null)
2 errors

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 2004, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4912075
* @summary static import of private field crashes compiler
* @author gafter
*
* @compile/fail PrivateStaticImport.java
* @compile/fail/ref=PrivateStaticImport.out -XDrawDiagnostics PrivateStaticImport.java
*/
package psi;

View File

@ -0,0 +1,2 @@
PrivateStaticImport.java:18:17: compiler.err.cant.resolve.location: kindname.variable, FOO_VALUE, , , (compiler.misc.location: kindname.class, psi.Bar, null)
1 error

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 2004, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 5017254
* @summary compiler fails to shadow inapplicable method with static import
* @author gafter
*
* @compile/fail Shadow.java
* @compile/fail/ref=Shadow.out -XDrawDiagnostics Shadow.java
*/
package shadow;

View File

@ -0,0 +1,2 @@
Shadow.java:25:9: compiler.err.cant.apply.symbol: kindname.method, m1, int, compiler.misc.no.args, kindname.class, shadow.T2, (compiler.misc.arg.length.mismatch)
1 error

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 2003, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4855358
* @summary add support for JSR 201's static import facility
* @author gafter
*
* @compile/fail StaticImport2.java
* @compile/fail/ref=StaticImport2.out -XDrawDiagnostics StaticImport2.java
*/
package p;

View File

@ -0,0 +1,2 @@
StaticImport2.java:24:17: compiler.err.ref.ambiguous: K, kindname.variable, K, p.B, kindname.variable, K, p.A
1 error

View File

@ -23,9 +23,9 @@
/*
* @test
* @bug 8003562 8005428 8015912 8027481 8048063
* @bug 8003562 8005428 8015912 8027481 8048063 8068937
* @summary Basic tests for jdeps tool
* @build Test p.Foo p.Bar javax.activity.NotCompactProfile
* @build Test p.Foo p.Bar p.C p.SubClass q.Gee javax.activity.NotCompactProfile
* @run main Basic
*/
@ -90,6 +90,18 @@ public class Basic {
new String[] {"compact1"},
new String[] {"-verbose:package", "-e", "java\\.lang\\..*"});
// parse p.C, p.SubClass and q.*
// p.SubClass have no dependency other than p.C
// q.Gee depends on p.SubClass that should be found
test(testDir,
new String[] {"java.lang", "p"},
new String[] {"compact1", testDir.getName()},
new String[] {"-include", "p.C|p.SubClass|q\\..*"});
test(testDir,
new String[] {"java.lang", "p"},
new String[] {"compact1", testDir.getName()},
new String[] {"-classpath", testDir.getPath(), "-include", "p.C|p.SubClass|q\\..*"});
// test -classpath and -include options
test(null,
new String[] {"java.lang", "java.util", "java.lang.management",

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2015, 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 p;
public class C {
public String name() {
return "C";
}
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2015, 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 p;
// SubClass only references types in package p
public class SubClass extends C {
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2015, 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 q;
public class Gee extends p.SubClass {
}