This commit is contained in:
Lana Steuck 2017-02-02 21:55:45 +00:00
commit b03d5ca97d
45 changed files with 788 additions and 264 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -264,7 +264,7 @@ public interface Filer {
* @param moduleAndPkg module and/or package relative to which the file
* should be named, or the empty string if none
* @param relativeName final pathname components of the file
* @param originatingElements type or package elements causally
* @param originatingElements type or package or module elements causally
* associated with the creation of this file, may be elided or
* {@code null}
* @return a {@code FileObject} to write the new resource

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -31,7 +31,7 @@ import java.io.IOException;
* Indicates a {@link Filer} detected an attempt to open a file that
* would violate the guarantees provided by the {@code Filer}. Those
* guarantees include not creating the same file more than once, not
* creating multiple files corresponding to the same type, and not
* creating multiple files corresponding to the same type or package, and not
* creating files for types with invalid names.
*
* @author Joseph D. Darcy

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -194,7 +194,7 @@ import javax.lang.model.SourceVersion;
* <p>The {@link Filer} interface discusses restrictions on how
* processors can operate on files.
*
* <p>Note that implementors of this interface may find it convenient
* @apiNote Implementors of this interface may find it convenient
* to extend {@link AbstractProcessor} rather than implementing this
* interface directly.
*
@ -315,7 +315,7 @@ public interface Processor {
* is returned, the annotation types are unclaimed and subsequent
* processors may be asked to process them. A processor may
* always return the same boolean value or may vary the result
* based on chosen criteria.
* based on its own chosen criteria.
*
* <p>The input set will be empty if the processor supports {@code
* "*"} and the root elements have no annotations. A {@code
@ -343,8 +343,8 @@ public interface Processor {
* <p>Since incomplete programs are being modeled, some of the
* parameters may only have partial information or may be {@code
* null}. At least one of {@code element} and {@code userText}
* must be non-{@code null}. If {@code element} is non-{@code
* null}, {@code annotation} and {@code member} may be {@code
* must be non-{@code null}. If {@code element} is non-{@code null},
* {@code annotation} and {@code member} may be {@code
* null}. Processors may not throw a {@code NullPointerException}
* if some parameters are {@code null}; if a processor has no
* completions to offer based on the provided information, an

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -65,7 +65,7 @@ public interface RoundEnvironment {
boolean errorRaised();
/**
* Returns the root elements for annotation processing generated
* Returns the {@linkplain Processor root elements} for annotation processing generated
* by the prior round.
*
* @return the root elements for annotation processing generated

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, 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
@ -62,7 +62,7 @@ import javax.lang.model.type.*;
*
* If there are multiple annotations of type <i>AT</i> present on
* <i>C</i>, then if <i>AT</i> is repeatable annotation type, an
* annotation of type <i>ATC</i> is implicitly declared on <i>C</i>.
* annotation of type <i>ATC</i> is {@linkplain javax.lang.model.util.Elements#getOrigin(AnnotatedConstruct, AnnotationMirror) implicitly declared} on <i>C</i>.
*
* <li> A representation of <i>A</i> appears in the executable output
* for <i>C</i>, such as the {@code RuntimeVisibleAnnotations} or

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2017, 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
@ -32,8 +32,9 @@ package javax.lang.model;
* this exception may be thrown by visitors to indicate that the
* visitor was created for a prior version of the language.
*
* <p>A common superclass for those exceptions allows a single catch
* block to have code handling them uniformly.
* @apiNote A common superclass for exceptions specific to different
* kinds of unknown entities allows a single catch block to easily
* provide uniform handling of those related conditions.
*
* @author Joseph D. Darcy
* @see javax.lang.model.element.UnknownElementException

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -37,7 +37,7 @@ import javax.lang.model.util.*;
/**
* Represents a program element such as a package, class, or method.
* Represents a program element such as a module, package, class, or method.
* Each element represents a static, language-level construct
* (and not, for example, a runtime construct of the virtual machine).
*
@ -139,7 +139,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct {
*
* <li> If this is a {@linkplain
* PackageElement#getEnclosingElement package}, its module is
* returned.
* returned if such a module exists. Otherwise, {@code null} is returned.
*
* <li> If this is a {@linkplain
* TypeParameterElement#getEnclosingElement type parameter},
@ -180,7 +180,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct {
* any elements; however, that may change as this API or the
* programming language evolves.
*
* <p>Note that elements of certain kinds can be isolated using
* @apiNote Elements of certain kinds can be isolated using
* methods in {@link ElementFilter}.
*
* @return the enclosed elements, or an empty list if none
@ -197,7 +197,7 @@ public interface Element extends javax.lang.model.AnnotatedConstruct {
* Returns {@code true} if the argument represents the same
* element as {@code this}, or {@code false} otherwise.
*
* <p>Note that the identity of an element involves implicit state
* @apiNote The identity of an element involves implicit state
* not directly accessible from the element's methods, including
* state about the presence of unrelated types. Element objects
* created by different implementations of these interfaces should

View File

@ -37,17 +37,18 @@ import java.util.List;
public interface ModuleElement extends Element, QualifiedNameable {
/**
* Returns the fully qualified name of this module.
* Returns the fully qualified name of this module. For an
* {@linkplain #isUnnamed() unnamed module}, an empty name is returned.
*
* @return the qualified name of this module, or an
* @return the fully qualified name of this module, or an
* empty name if this is an unnamed module
*/
@Override
Name getQualifiedName();
/**
* Returns the simple name of this module. For an unnamed
* module, an empty name is returned.
* Returns the simple name of this module. For an {@linkplain
* #isUnnamed() unnamed module}, an empty name is returned.
*
* @return the simple name of this module or an empty name if
* this is an unnamed module

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -89,25 +89,29 @@ public enum NestingKind {
/**
* A type that is a named member of another type.
* @jls 8.5 Member Type Declarations
*/
MEMBER,
/**
* A named type declared within a construct other than a type.
* @jls 14.3 Local Class Declarations
*/
LOCAL,
/**
* A type without a name.
* @jls 15.9.5 Anonymous Class Declarations
*/
ANONYMOUS;
/**
* Does this constant correspond to a nested type element?
* A <i>nested</i> type element is any that is not top-level.
* An <i>inner</i> type element is any nested type element that
* More specifically, an <i>inner</i> type element is any nested type element that
* is not {@linkplain Modifier#STATIC static}.
* @return whether or not the constant is nested
* @jls 14.3 Inner Classes and Enclosing Instances
*/
public boolean isNested() {
return this != TOP_LEVEL;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -42,6 +42,7 @@ public interface PackageElement extends Element, QualifiedNameable {
/**
* Returns the fully qualified name of this package.
* This is also known as the package's <i>canonical</i> name.
* For an {@linkplain #isUnnamed() unnamed package}, an empty name is returned.
*
* @return the fully qualified name of this package, or an
* empty name if this is an unnamed package
@ -50,8 +51,8 @@ public interface PackageElement extends Element, QualifiedNameable {
Name getQualifiedName();
/**
* Returns the simple name of this package. For an unnamed
* package, an empty name is returned.
* Returns the simple name of this package. For an {@linkplain
* #isUnnamed() unnamed package}, an empty name is returned.
*
* @return the simple name of this package or an empty name if
* this is an unnamed package
@ -82,9 +83,16 @@ public interface PackageElement extends Element, QualifiedNameable {
boolean isUnnamed();
/**
* Returns the enclosing module.
* Returns the enclosing module if such a module exists; otherwise
* returns {@code null}.
*
* @return the enclosing module
* One situation where a module does not exist for a package is if
* the environment does not include modules, such as an annotation
* processing environment configured for a {@linkplain
* javax.annotation.processing.ProcessingEnvironment#getSourceVersion
* source version} without modules.
*
* @return the enclosing module or {@code null} if no such module exists
*/
@Override
Element getEnclosingElement();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2017, 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
@ -35,7 +35,7 @@ import java.util.List;
*/
public interface Parameterizable extends Element {
/**
* Returns the formal type parameters of the type element in
* Returns the formal type parameters of an element in
* declaration order.
*
* @return the formal type parameters, or an empty list

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -67,14 +67,14 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable
* the implicit {@code values} and {@code valueOf} methods of an
* enum type.
*
* <p> Note that as a particular instance of the {@linkplain
* @apiNote As a particular instance of the {@linkplain
* javax.lang.model.element general accuracy requirements} and the
* ordering behavior required of this interface, the list of
* enclosed elements will be returned in the natural order for the
* originating source of information about the type. For example,
* if the information about the type is originating from a source
* file, the elements will be returned in source code order.
* (However, in that case the the ordering of synthesized
* (However, in that case the the ordering of {@linkplain Elements.Origin#MANDATED mandated}
* elements, such as a default constructor, is not specified.)
*
* @return the enclosed elements in proper order, or an empty list if none

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -79,7 +79,7 @@ public class UnknownAnnotationValueException extends UnknownEntityException {
/**
* Returns the additional argument.
*
* @return the additional argument
* @return the additional argument, or {@code null} if unavailable
*/
public Object getArgument() {
return parameter;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -77,7 +77,7 @@ public class UnknownElementException extends UnknownEntityException {
/**
* Returns the additional argument.
*
* @return the additional argument
* @return the additional argument, or {@code null} if unavailable
*/
public Object getArgument() {
return parameter;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -87,14 +87,14 @@
* If a program is syntactically valid but erroneous in some other
* fashion, any returned model must have no less information than if
* all the method bodies in the program were replaced by {@code "throw
* new RuntimeException();"}. If a program refers to a missing type XYZ,
* new RuntimeException();"}. If a program refers to a missing type Xyz,
* the returned model must contain no less information than if the
* declaration of type XYZ were assumed to be {@code "class XYZ {}"},
* {@code "interface XYZ {}"}, {@code "enum XYZ {}"}, or {@code
* "@interface XYZ {}"}. If a program refers to a missing type {@code
* XYZ<K1, ... ,Kn>}, the returned model must contain no less
* information than if the declaration of XYZ were assumed to be
* {@code "class XYZ<T1, ... ,Tn> {}"} or {@code "interface XYZ<T1,
* declaration of type Xyz were assumed to be {@code "class Xyz {}"},
* {@code "interface Xyz {}"}, {@code "enum Xyz {}"}, or {@code
* "@interface Xyz {}"}. If a program refers to a missing type {@code
* Xyz<K1, ... ,Kn>}, the returned model must contain no less
* information than if the declaration of Xyz were assumed to be
* {@code "class Xyz<T1, ... ,Tn> {}"} or {@code "interface Xyz<T1,
* ... ,Tn> {}"}
*
* <p> Unless otherwise specified in a particular implementation, the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, 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
@ -33,14 +33,12 @@ import java.util.List;
* <p>An intersection type can be either implicitly or explicitly
* declared in a program. For example, the bound of the type parameter
* {@code <T extends Number & Runnable>} is an (implicit) intersection
* type. As of {@link javax.lang.model.SourceVersion#RELEASE_8
* RELEASE_8}, this is represented by an {@code IntersectionType} with
* type. This is represented by an {@code IntersectionType} with
* {@code Number} and {@code Runnable} as its bounds.
*
* @implNote Also as of {@link
* javax.lang.model.SourceVersion#RELEASE_8 RELEASE_8}, in the
* reference implementation an {@code IntersectionType} is used to
* model the explicit target type of a cast expression.
* @implNote In the reference implementation an {@code
* IntersectionType} is used to model the explicit target type of a
* cast expression.
*
* @since 1.8
*/
@ -49,7 +47,7 @@ public interface IntersectionType extends TypeMirror {
/**
* Return the bounds comprising this intersection type.
*
* @return the bounds of this intersection types.
* @return the bounds of this intersection type
*/
List<? extends TypeMirror> getBounds();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -34,6 +34,7 @@ import javax.lang.model.element.ExecutableElement;
* <ul>
* <li>{@link TypeKind#VOID VOID} - corresponds to the keyword {@code void}.
* <li>{@link TypeKind#PACKAGE PACKAGE} - the pseudo-type of a package element.
* <li>{@link TypeKind#MODULE MODULE} - the pseudo-type of a module element.
* <li>{@link TypeKind#NONE NONE} - used in other cases
* where no actual type is appropriate; for example, the superclass
* of {@code java.lang.Object}.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2017, 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
@ -30,9 +30,8 @@ import java.util.List;
/**
* Represents a union type.
*
* As of the {@link javax.lang.model.SourceVersion#RELEASE_7
* RELEASE_7} source version, union types can appear as the type
* of a multi-catch exception parameter.
* Union types can appear as the type of a multi-catch exception
* parameter.
*
* @since 1.7
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -77,7 +77,7 @@ public class UnknownTypeException extends UnknownEntityException {
/**
* Returns the additional argument.
*
* @return the additional argument
* @return the additional argument, or {@code null} if unavailable
*/
public Object getArgument() {
return parameter;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -55,15 +55,6 @@ import javax.lang.model.element.ModuleElement.UsesDirective;
* arguments to methods in this class, a {@code NullPointerException}
* will be thrown.
*
* <p>Note that a <i>static import</i> statement can make the text of
* calls to the methods in this class more concise; for example:
*
* <blockquote><pre>
* import static javax.lang.model.util.ElementFilter.*;
* ...
* {@code List<VariableElement>} fs = fieldsIn(someClass.getEnclosedElements());
* </pre></blockquote>
*
* @author Joseph D. Darcy
* @author Scott Seligman
* @author Peter von der Ah&eacute;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -59,12 +59,17 @@ public interface Elements {
/**
* Returns a package given its fully qualified name, as seen from the given module.
*
* @implSpec The default implementation of this method returns
* {@code null}.
*
* @param name fully qualified package name, or an empty string for an unnamed package
* @param module module relative to which the lookup should happen
* @return the specified package, or {@code null} if it cannot be found
* @since 9
*/
PackageElement getPackageElement(ModuleElement module, CharSequence name);
default PackageElement getPackageElement(ModuleElement module, CharSequence name) {
return null;
}
/**
* Returns a type element given its canonical name if the type element is unique in the environment.
@ -79,12 +84,17 @@ public interface Elements {
/**
* Returns a type element given its canonical name, as seen from the given module.
*
* @implSpec The default implementation of this method returns
* {@code null}.
*
* @param name the canonical name
* @param module module relative to which the lookup should happen
* @return the named type element, or {@code null} if it cannot be found
* @since 9
*/
TypeElement getTypeElement(ModuleElement module, CharSequence name);
default TypeElement getTypeElement(ModuleElement module, CharSequence name) {
return null;
}
/**
* Returns a module element given its fully qualified name.
@ -95,11 +105,16 @@ public interface Elements {
* javax.annotation.processing.ProcessingEnvironment#getSourceVersion
* source version} without modules.
*
* @implSpec The default implementation of this method returns
* {@code null}.
*
* @param name the name
* @return the named module element, or {@code null} if it cannot be found
* @since 9
*/
ModuleElement getModuleElement(CharSequence name);
default ModuleElement getModuleElement(CharSequence name) {
return null;
}
/**
* Returns the values of an annotation's elements, including defaults.
@ -337,18 +352,23 @@ public interface Elements {
* javax.annotation.processing.ProcessingEnvironment#getSourceVersion
* source version} without modules.
*
* @implSpec The default implementation of this method returns
* {@code null}.
*
* @param type the element being examined
* @return the module of an element
* @since 9
*/
ModuleElement getModuleOf(Element type);
default ModuleElement getModuleOf(Element type) {
return null;
}
/**
* Returns all members of a type element, whether inherited or
* declared directly. For a class the result also includes its
* constructors, but not local or anonymous classes.
*
* <p>Note that elements of certain kinds can be isolated using
* @apiNote Elements of certain kinds can be isolated using
* methods in {@link ElementFilter}.
*
* @param type the type being examined

View File

@ -502,7 +502,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
private final class ArchiveContainer implements Container {
private final Path archivePath;
private final FileSystem fileSystem;
private final Map<RelativePath, Path> pathCache = new HashMap<>();
private final Map<RelativePath, Path> packages;
public ArchiveContainer(Path archivePath) throws IOException, ProviderNotFoundException, SecurityException {
this.archivePath = archivePath;
@ -514,6 +514,21 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
} else {
this.fileSystem = FileSystems.newFileSystem(archivePath, null);
}
packages = new HashMap<>();
for (Path root : fileSystem.getRootDirectories()) {
Files.walkFileTree(root, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE,
new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
if (isValid(dir.getFileName())) {
packages.put(new RelativeDirectory(root.relativize(dir).toString()), dir);
return FileVisitResult.CONTINUE;
} else {
return FileVisitResult.SKIP_SUBTREE;
}
}
});
}
}
/**
@ -526,7 +541,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
Set<JavaFileObject.Kind> fileKinds,
boolean recurse,
ListBuffer<JavaFileObject> resultList) throws IOException {
Path resolvedSubdirectory = resolvePath(subdirectory);
Path resolvedSubdirectory = packages.get(subdirectory);
if (resolvedSubdirectory == null)
return ;
@ -544,18 +559,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
}
}
boolean isValid(Path fileName) {
if (fileName == null) {
return true;
} else {
String name = fileName.toString();
if (name.endsWith("/")) {
name = name.substring(0, name.length() - 1);
}
return SourceVersion.isIdentifier(name);
}
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
if (attrs.isRegularFile() && fileKinds.contains(getKind(file.getFileName().toString()))) {
@ -569,27 +572,29 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
}
@Override
public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
Path p = resolvePath(name);
if (p != null)
return PathFileObject.forJarPath(JavacFileManager.this, p, userPath);
return null;
private boolean isValid(Path fileName) {
if (fileName == null) {
return true;
} else {
String name = fileName.toString();
if (name.endsWith("/")) {
name = name.substring(0, name.length() - 1);
}
return SourceVersion.isIdentifier(name);
}
}
private synchronized Path resolvePath(RelativePath path) {
if (!pathCache.containsKey(path)) {
Path relativePath = path.resolveAgainst(fileSystem);
if (!Files.exists(relativePath)) {
relativePath = null;
@Override
public JavaFileObject getFileObject(Path userPath, RelativeFile name) throws IOException {
RelativeDirectory root = name.dirname();
Path packagepath = packages.get(root);
if (packagepath != null) {
Path relpath = packagepath.resolve(name.basename());
if (Files.exists(relpath)) {
return PathFileObject.forJarPath(JavacFileManager.this, relpath, userPath);
}
pathCache.put(path, relativePath);
return relativePath;
}
return pathCache.get(path);
return null;
}
@Override

View File

@ -43,6 +43,7 @@ import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.ProviderNotFoundException;
import java.nio.file.spi.FileSystemProvider;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -1119,8 +1120,12 @@ public class Locations {
}
if (p.getFileName().toString().endsWith(".jar") && fsInfo.exists(p)) {
URI uri = URI.create("jar:" + p.toUri());
try (FileSystem fs = FileSystems.newFileSystem(uri, fsEnv, null)) {
FileSystemProvider jarFSProvider = fsInfo.getJarFSProvider();
if (jarFSProvider == null) {
log.error(Errors.NoZipfsForArchive(p));
return null;
}
try (FileSystem fs = jarFSProvider.newFileSystem(p, fsEnv)) {
Path moduleInfoClass = fs.getPath("module-info.class");
if (Files.exists(moduleInfoClass)) {
String moduleName = readModuleName(moduleInfoClass);
@ -1132,9 +1137,6 @@ public class Locations {
} catch (IOException e) {
log.error(Errors.LocnCantReadFile(p));
return null;
} catch (ProviderNotFoundException e) {
log.error(Errors.NoZipfsForArchive(p));
return null;
}
//automatic module:
@ -1177,8 +1179,12 @@ public class Locations {
// workaround for now
FileSystem fs = fileSystems.get(p);
if (fs == null) {
URI uri = URI.create("jar:" + p.toUri());
fs = FileSystems.newFileSystem(uri, Collections.emptyMap(), null);
FileSystemProvider jarFSProvider = fsInfo.getJarFSProvider();
if (jarFSProvider == null) {
log.error(Errors.LocnCantReadFile(p));
return null;
}
fs = jarFSProvider.newFileSystem(p, Collections.emptyMap());
try {
Path moduleInfoClass = fs.getPath("classes/module-info.class");
String moduleName = readModuleName(moduleInfoClass);
@ -1194,7 +1200,7 @@ public class Locations {
}
} catch (ModuleNameReader.BadClassFile e) {
log.error(Errors.LocnBadModuleInfo(p));
} catch (IOException | ProviderNotFoundException e) {
} catch (IOException e) {
log.error(Errors.LocnCantReadFile(p));
return null;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2017, 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
@ -1723,9 +1723,29 @@ public class HtmlDocletWriter extends HtmlDocWriter {
break main;
ch = text.charAt(currPos);
}
if (ch == '>' && blockTags.contains(StringUtils.toLowerCase(text.substring(tagPos, currPos)))) {
String tagFound = StringUtils.toLowerCase(text.substring(tagPos, currPos));
if (blockTags.contains(tagFound)) {
result.append(text, startPos, lessThanPos);
currPos = tagPos + tagFound.length();
boolean foundGT = false;
Character quoteKind = null;
while (!foundGT) {
if (ch == '\"' || ch == '\'') {
if (quoteKind == null) {
quoteKind = ch;
} else if (quoteKind == ch) {
quoteKind = null;
}
}
if (ch == '>' && quoteKind == null) {
foundGT = true;
}
if (++currPos == len)
break;
ch = text.charAt(currPos);
}
startPos = currPos + 1;
currPos = startPos;
}
lessThanPos = text.indexOf('<', currPos);
}
@ -1740,6 +1760,10 @@ public class HtmlDocletWriter extends HtmlDocWriter {
('1' <= ch && ch <= '6');
}
private static boolean isWhitespace(char ch) {
return Character.isWhitespace(ch);
}
/**
* Add a link to the stylesheet file.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -74,6 +74,11 @@ public class PropertyWriterImpl extends AbstractMemberWriter
return memberTree;
}
@Override
public boolean showTabs() {
return false;
}
/**
* {@inheritDoc}
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, 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
@ -1773,14 +1773,14 @@ public class Utils {
/**
* Returns a Comparator for index file presentations, and are sorted as follows.
* If comparing modules then simply compare the simple names,
* comparing packages then simply compare the qualified names, otherwise
* 1. if equal, then compare the ElementKind ex: Module, Package, Interface etc.
* 2. sort on simple names of entities
* 3a. if equal and if the type is of ExecutableElement(Constructor, Methods),
* comparing packages then simply compare the qualified names, if comparing a package with a
* module/type/member then compare the FullyQualifiedName of the package
* with the SimpleName of the entity, otherwise
* 1. compare the ElementKind ex: Module, Package, Interface etc.
* 2a. if equal and if the type is of ExecutableElement(Constructor, Methods),
* a case insensitive comparison of parameter the type signatures
* 3b. if equal, case sensitive comparison of the type signatures
* 4. finally, if equal, compare the FQNs of the entities
* Iff comparing packages then simply sort on qualified names.
* 2b. if equal, case sensitive comparison of the type signatures
* 3. finally, if equal, compare the FQNs of the entities
* @return a comparator for index file use
*/
public Comparator<Element> makeIndexUseComparator() {
@ -1788,8 +1788,10 @@ public class Utils {
/**
* Compare two given elements, if comparing two modules, return the
* comparison of SimpleName, if comparing two packages, return the
* comparison of FullyQualifiedName, first sort on kinds, then on the
* names, then on the parameters only if the type is an ExecutableElement,
* comparison of FullyQualifiedName, if comparing a package with a
* module/type/member then compare the FullyQualifiedName of the package
* with the SimpleName of the entity, then sort on the kinds, then on
* the parameters only if the type is an ExecutableElement,
* the parameters are compared and finally the qualified names.
*
* @param e1 - an element.
@ -1806,11 +1808,17 @@ public class Utils {
if (isPackage(e1) && isPackage(e2)) {
return compareFullyQualifiedNames(e1, e2);
}
result = compareElementTypeKinds(e1, e2);
if (isPackage(e1) || isPackage(e2)) {
result = (isPackage(e1))
? compareStrings(getFullyQualifiedName(e1), getSimpleName(e2))
: compareStrings(getSimpleName(e1), getFullyQualifiedName(e2));
} else {
result = compareNames(e1, e2);
}
if (result != 0) {
return result;
}
result = compareNames(e1, e2);
result = compareElementTypeKinds(e1, e2);
if (result != 0) {
return result;
}

View File

@ -33,16 +33,20 @@ main.usage=Usage:\n\
where options include:
main.opt.public.desc=\
Show only public classes and members
Show only public types and members. For named modules,\n\
show exported packages and the module''s API.
main.opt.protected.desc=\
Show protected/public classes and members (default)
Show protected/public types and members (default). For\n\
named modules, show exported packages and the module''s API.
main.opt.package.desc=\
Show package/protected/public classes and members
Show package/protected/public types and members. For \n\
named modules, show all packages and all module details.
main.opt.private.desc=\
Show all classes and members
Show all types and members. For named modules,\n\
show all packages and all module details.
main.opt.show.members.arg=\
<value>

View File

@ -197,7 +197,6 @@ public class JShellTool implements MessageHandler {
private boolean debug = false;
public boolean testPrompt = false;
private String defaultStartup = null;
private Startup startup = null;
private String executionControlSpec = null;
private EditorSetting editor = BUILT_IN_EDITOR;
@ -205,9 +204,9 @@ public class JShellTool implements MessageHandler {
private static final String[] EDITOR_ENV_VARS = new String[] {
"JSHELLEDITOR", "VISUAL", "EDITOR"};
// Commands and snippets which should be replayed
private List<String> replayableHistory;
private List<String> replayableHistoryPrevious;
// Commands and snippets which can be replayed
private ReplayableHistory replayableHistory;
private ReplayableHistory replayableHistoryPrevious;
static final String STARTUP_KEY = "STARTUP";
static final String EDITOR_KEY = "EDITOR";
@ -506,6 +505,76 @@ public class JShellTool implements MessageHandler {
}
}
/**
* Encapsulate a history of snippets and commands which can be replayed.
*/
private static class ReplayableHistory {
// the history
private List<String> hist;
// the length of the history as of last save
private int lastSaved;
private ReplayableHistory(List<String> hist) {
this.hist = hist;
this.lastSaved = 0;
}
// factory for empty histories
static ReplayableHistory emptyHistory() {
return new ReplayableHistory(new ArrayList<>());
}
// factory for history stored in persistent storage
static ReplayableHistory fromPrevious(PersistentStorage prefs) {
// Read replay history from last jshell session
String prevReplay = prefs.get(REPLAY_RESTORE_KEY);
if (prevReplay == null) {
return null;
} else {
return new ReplayableHistory(Arrays.asList(prevReplay.split(RECORD_SEPARATOR)));
}
}
// store the history in persistent storage
void storeHistory(PersistentStorage prefs) {
if (hist.size() > lastSaved) {
// Prevent history overflow by calculating what will fit, starting
// with most recent
int sepLen = RECORD_SEPARATOR.length();
int length = 0;
int first = hist.size();
while (length < Preferences.MAX_VALUE_LENGTH && --first >= 0) {
length += hist.get(first).length() + sepLen;
}
if (first >= 0) {
hist = hist.subList(first + 1, hist.size());
}
String shist = String.join(RECORD_SEPARATOR, hist);
prefs.put(REPLAY_RESTORE_KEY, shist);
markSaved();
}
prefs.flush();
}
// add a snippet or command to the history
void add(String s) {
hist.add(s);
}
// return history to reloaded
Iterable<String> iterable() {
return hist;
}
// mark that persistent storage and current history are in sync
void markSaved() {
lastSaved = hist.size();
}
}
/**
* Is the input/output currently interactive
*
@ -756,10 +825,7 @@ public class JShellTool implements MessageHandler {
// initialize JShell instance
resetState();
// Read replay history from last jshell session into previous history
String prevReplay = prefs.get(REPLAY_RESTORE_KEY);
if (prevReplay != null) {
replayableHistoryPrevious = Arrays.asList(prevReplay.split(RECORD_SEPARATOR));
}
replayableHistoryPrevious = ReplayableHistory.fromPrevious(prefs);
// load snippet/command files given on command-line
for (String loadFile : commandLineArgs.nonOptions()) {
runFile(loadFile, "jshell");
@ -775,6 +841,13 @@ public class JShellTool implements MessageHandler {
if (feedback.shouldDisplayCommandFluff()) {
hardmsg("jshell.msg.welcome", version());
}
// Be sure history is always saved so that user code isn't lost
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
replayableHistory.storeHistory(prefs);
}
});
// execute from user input
try (IOContext in = new ConsoleIOContext(this, cmdin, console)) {
start(in);
@ -868,7 +941,7 @@ public class JShellTool implements MessageHandler {
// Reset the replayable history, saving the old for restore
replayableHistoryPrevious = replayableHistory;
replayableHistory = new ArrayList<>();
replayableHistory = ReplayableHistory.emptyHistory();
JShell.Builder builder =
JShell.builder()
.in(userin)
@ -1933,20 +2006,7 @@ public class JShellTool implements MessageHandler {
private boolean cmdExit() {
regenerateOnDeath = false;
live = false;
if (!replayableHistory.isEmpty()) {
// Prevent history overflow by calculating what will fit, starting
// with most recent
int sepLen = RECORD_SEPARATOR.length();
int length = 0;
int first = replayableHistory.size();
while(length < Preferences.MAX_VALUE_LENGTH && --first >= 0) {
length += replayableHistory.get(first).length() + sepLen;
}
String hist = String.join(RECORD_SEPARATOR,
replayableHistory.subList(first + 1, replayableHistory.size()));
prefs.put(REPLAY_RESTORE_KEY, hist);
}
prefs.flush();
replayableHistory.storeHistory(prefs);
fluffmsg("jshell.msg.goodbye");
return true;
}
@ -2420,7 +2480,7 @@ public class JShellTool implements MessageHandler {
if (!parseCommandLineLikeFlags(rawargs, ap)) {
return false;
}
Iterable<String> history;
ReplayableHistory history;
if (ap.restore()) {
if (replayableHistoryPrevious == null) {
errormsg("jshell.err.reload.no.previous");
@ -2432,7 +2492,13 @@ public class JShellTool implements MessageHandler {
history = replayableHistory;
fluffmsg("jshell.err.reload.restarting.state");
}
return doReload(history, !ap.quiet());
boolean success = doReload(history, !ap.quiet());
if (success && ap.restore()) {
// if we are restoring from previous, then if nothing was added
// before time of exit, there is nothing to save
replayableHistory.markSaved();
}
return success;
}
private boolean cmdEnv(String rawargs) {
@ -2460,9 +2526,9 @@ public class JShellTool implements MessageHandler {
return doReload(replayableHistory, false);
}
private boolean doReload(Iterable<String> history, boolean echo) {
private boolean doReload(ReplayableHistory history, boolean echo) {
resetState();
run(new ReloadIOContext(history,
run(new ReloadIOContext(history.iterable(),
echo ? cmdout : null));
return true;
}

View File

@ -111,7 +111,8 @@ public class FailOverExecutionControlProvider implements ExecutionControlProvid
PrintWriter log = new PrintWriter(writer);
log.println("FailOverExecutionControlProvider:");
ex.printStackTrace(log);
logger().fine(log.toString());
log.flush();
logger().fine(writer.toString());
// only care about the first, and only if they all fail
if (thrown == null) {
thrown = ex;

View File

@ -102,7 +102,6 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl {
Process process = jdii.process();
List<Consumer<String>> deathListeners = new ArrayList<>();
deathListeners.add(s -> env.closeDown());
Util.detectJdiExitEvent(vm, s -> {
for (Consumer<String> h : deathListeners) {
h.accept(s);
@ -120,7 +119,8 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl {
Map<String, InputStream> input = new HashMap<>();
input.put("in", env.userIn());
return remoteInputOutput(socket.getInputStream(), out, outputs, input,
(objIn, objOut) -> new JdiDefaultExecutionControl(objOut, objIn, vm, process, remoteAgent, deathListeners));
(objIn, objOut) -> new JdiDefaultExecutionControl(env,
objOut, objIn, vm, process, remoteAgent, deathListeners));
}
}
@ -130,15 +130,20 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl {
* @param cmdout the output for commands
* @param cmdin the input for responses
*/
private JdiDefaultExecutionControl(ObjectOutput cmdout, ObjectInput cmdin,
private JdiDefaultExecutionControl(ExecutionEnv env,
ObjectOutput cmdout, ObjectInput cmdin,
VirtualMachine vm, Process process, String remoteAgent,
List<Consumer<String>> deathListeners) {
super(cmdout, cmdin);
this.vm = vm;
this.process = process;
this.remoteAgent = remoteAgent;
// We have now succeeded in establishing the connection.
// If there is an exit now it propagates all the way up
// and the VM should be disposed of.
deathListeners.add(s -> env.closeDown());
deathListeners.add(s -> disposeVM());
}
}
@Override
public String invoke(String classname, String methodname)

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2017, 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.
*/
public class C {
/**
* case1 <ul> <li> end of sentence. <li> more </ul>
*/
public void case1() {}
/**
* case2 <ul compact> <li> end of sentence. <li> more </ul>
*/
public void case2() {}
/**
* case3 <ul type="square"> <li> end of sentence. <li> more </ul>
*/
public void case3() {}
/**
* case4 <ul type="a<b"> <li> end of sentence. <li> more </ul>
*/
public void case4() {}
/**
* case5 <ul type="a>b"> <li> end of sentence. <li> more </ul>
*/
public void case5() {}
/**
* case6 <ul type='a>b'> <li> end of sentence. <li> more </ul>
*/
public void case6() {}
/**
* case7 <ul type='"a>b"'> <li> end of sentence. <li> more </ul>
*/
public void case7() {}
/**
* case8 <ul type="'a>b'"> <li> end of sentence. <li> more </ul>
*/
public void case8() {}
/**
* case9 <ul type="'a'>b"> <li> end of sentence. <li> more </ul>
*/
public void case9() {}
/**
* caseA <ul type='"a">b'> <li> end of sentence. <li> more </ul>
*/
public void caseA() {}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2017, 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
* @bug 8048628
* @summary Verify html inline tags are removed correctly in the first sentence.
* @library ../lib
* @modules jdk.javadoc
* @build JavadocTester
* @run main TestNonInlineHtmlTagRemoval
*/
public class TestNonInlineHtmlTagRemoval extends JavadocTester {
public static void main(String... args) throws Exception {
TestNonInlineHtmlTagRemoval tester = new TestNonInlineHtmlTagRemoval();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
testSrc("C.java"));
checkExit(Exit.OK);
checkOutput("C.html", true,
"<div class=\"block\">case1 end of sentence.</div>",
"<div class=\"block\">case2 end of sentence.</div>",
"<div class=\"block\">case3 end of sentence.</div>",
"<div class=\"block\">case4 end of sentence.</div>",
"<div class=\"block\">case5 end of sentence.</div>",
"<div class=\"block\">case6 end of sentence.</div>",
"<div class=\"block\">case7 end of sentence.</div>",
"<div class=\"block\">case8 end of sentence.</div>",
"<div class=\"block\">case9 end of sentence.</div>",
"<div class=\"block\">caseA end of sentence.</div>");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 8167967
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 8167967 8172528
* @summary Test of the JavaFX doclet features.
* @author jvalenta
* @library ../lib
@ -50,93 +50,103 @@ public class TestJavaFX extends JavadocTester {
checkOutput("pkg1/C.html", true,
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"../pkg1/C.html#getRate--\"><code>getRate()</code></a>, \n"
+ "<a href=\"../pkg1/C.html#setRate-double-\">"
+ "<code>setRate(double)</code></a></dd>",
+ "<dd><a href=\"../pkg1/C.html#getRate--\"><code>getRate()</code></a>, \n"
+ "<a href=\"../pkg1/C.html#setRate-double-\">"
+ "<code>setRate(double)</code></a></dd>",
"<pre>public final&nbsp;void&nbsp;setRate(double&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
+ "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
"<pre>public final&nbsp;double&nbsp;getRate()</pre>\n"
+ "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
+ "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
"<td class=\"colFirst\"><code><a href=\"../pkg1/C.DoubleProperty.html\" "
+ "title=\"class in pkg1\">C.DoubleProperty</a></code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"../pkg1/C.html#rateProperty\">rate</a></span></code></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"block\">Defines the direction/speed at which the "
+ "<code>Timeline</code> is expected to\n"
+ " be played.</div>\n</td>",
+ "title=\"class in pkg1\">C.DoubleProperty</a></code></td>\n"
+ "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"../pkg1/C.html#rateProperty\">rate</a></span></code></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"block\">Defines the direction/speed at which the "
+ "<code>Timeline</code> is expected to\n"
+ " be played.</div>\n</td>",
"<span class=\"simpleTagLabel\">Default value:</span>",
"<span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>",
+ "<dd>JavaFX 8.0</dd>",
"<p>Sets the value of the property <code>Property</code>",
"<p>Gets the value of the property <code>Property</code>",
"<span class=\"simpleTagLabel\">Property description:</span>",
"<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"../pkg1/C.html#setTestMethodProperty--\">"
+ "setTestMethodProperty</a></span>()</code></th>",
+ "<a href=\"../pkg1/C.html#setTestMethodProperty--\">"
+ "setTestMethodProperty</a></span>()</code></th>",
"<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
+ "<a href=\"../pkg1/C.html#pausedProperty\">paused</a></span></code></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"block\">Defines if paused.</div>",
+ "<a href=\"../pkg1/C.html#pausedProperty\">paused</a></span></code></th>\n"
+ "<td class=\"colLast\">\n"
+ "<div class=\"block\">Defines if paused.</div>",
"<h4>paused</h4>\n"
+ "<pre>public final&nbsp;<a href=\"../pkg1/C.BooleanProperty.html\" "
+ "title=\"class in pkg1\">C.BooleanProperty</a> pausedProperty</pre>\n"
+ "<div class=\"block\">Defines if paused. The second line.</div>",
+ "<pre>public final&nbsp;<a href=\"../pkg1/C.BooleanProperty.html\" "
+ "title=\"class in pkg1\">C.BooleanProperty</a> pausedProperty</pre>\n"
+ "<div class=\"block\">Defines if paused. The second line.</div>",
"<h4>isPaused</h4>\n"
+ "<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>",
+ "<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>",
"<h4>setPaused</h4>\n"
+ "<pre>public final&nbsp;void&nbsp;setPaused(boolean&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property paused.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
+ "<dd>Defines if paused. The second line.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>false</dd>",
+ "<pre>public final&nbsp;void&nbsp;setPaused(boolean&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property paused.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
+ "<dd>Defines if paused. The second line.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>false</dd>",
"<h4>isPaused</h4>\n"
+ "<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
+ "<dd>Defines if paused. The second line.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>false</dd>",
+ "<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
+ "<dd>Defines if paused. The second line.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>false</dd>",
"<h4>rate</h4>\n"
+ "<pre>public final&nbsp;<a href=\"../pkg1/C.DoubleProperty.html\" "
+ "title=\"class in pkg1\">C.DoubleProperty</a> rateProperty</pre>\n"
+ "<div class=\"block\">Defines the direction/speed at which the "
+ "<code>Timeline</code> is expected to\n"
+ " be played. This is the second line.</div>",
+ "<pre>public final&nbsp;<a href=\"../pkg1/C.DoubleProperty.html\" "
+ "title=\"class in pkg1\">C.DoubleProperty</a> rateProperty</pre>\n"
+ "<div class=\"block\">Defines the direction/speed at which the "
+ "<code>Timeline</code> is expected to\n"
+ " be played. This is the second line.</div>",
"<h4>setRate</h4>\n"
+ "<pre>public final&nbsp;void&nbsp;setRate(double&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
+ "<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to\n"
+ " be played. This is the second line.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>11</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>",
+ "<pre>public final&nbsp;void&nbsp;setRate(double&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
+ "<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to\n"
+ " be played. This is the second line.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>11</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>",
"<h4>getRate</h4>\n"
+ "<pre>public final&nbsp;double&nbsp;getRate()</pre>\n"
+ "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
+ "<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to\n"
+ " be played. This is the second line.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>11</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>",
+ "<pre>public final&nbsp;double&nbsp;getRate()</pre>\n"
+ "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n"
+ "<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to\n"
+ " be played. This is the second line.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n"
+ "<dd>11</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>",
"<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n"
+ "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"");
checkOutput("pkg1/C.html", false,
"A()");
"A()",
"<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n"
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Methods</span><span class=\"tabEnd\">&nbsp;</span>"
+ "</span><span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">Instance Methods</a>"
+ "</span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t4\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(8);\">Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>");
checkOutput("index-all.html", true,
"<div class=\"block\">Gets the value of the property paused.</div>",
@ -193,7 +203,19 @@ public class TestJavaFX extends JavadocTester {
+ "</li>\n"
+ "</ul>\n"
+ "</li>\n"
+ "</ul>");
+ "</ul>",
"<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n"
+ "<caption><span>Properties</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("pkg2/Test.html", false,
"<h3>Property Summary</h3>\n"
+ "<table class=\"memberSummary\" summary=\"Property Summary table, listing properties, and an explanation\">\n"
+ "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All Methods</span><span class=\"tabEnd\">&nbsp;</span>"
+ "</span><span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">Instance Methods</a>"
+ "</span><span class=\"tabEnd\">&nbsp;</span></span><span id=\"t4\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(8);\">Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>");
}
/*

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2017, 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.
*/
public class C {
/**
* case1 <ul> <li> end of sentence. <li> more </ul>
*/
public void case1() {}
/**
* case2 <ul compact> <li> end of sentence. <li> more </ul>
*/
public void case2() {}
/**
* case3 <ul type="square"> <li> end of sentence. <li> more </ul>
*/
public void case3() {}
/**
* case4 <ul type="a<b"> <li> end of sentence. <li> more </ul>
*/
public void case4() {}
/**
* case5 <ul type="a>b"> <li> end of sentence. <li> more </ul>
*/
public void case5() {}
/**
* case6 <ul type='a>b'> <li> end of sentence. <li> more </ul>
*/
public void case6() {}
/**
* case7 <ul type='"a>b"'> <li> end of sentence. <li> more </ul>
*/
public void case7() {}
/**
* case8 <ul type="'a>b'"> <li> end of sentence. <li> more </ul>
*/
public void case8() {}
/**
* case9 <ul type="'a'>b"> <li> end of sentence. <li> more </ul>
*/
public void case9() {}
/**
* caseA <ul type='"a">b'> <li> end of sentence. <li> more </ul>
*/
public void caseA() {}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2017, 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
* @bug 8048628
* @summary Verify html inline tags are removed correctly in the first sentence.
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build JavadocTester
* @run main TestNonInlineHtmlTagRemoval
*/
public class TestNonInlineHtmlTagRemoval extends JavadocTester {
public static void main(String... args) throws Exception {
TestNonInlineHtmlTagRemoval tester = new TestNonInlineHtmlTagRemoval();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
testSrc("C.java"));
checkExit(Exit.OK);
checkOutput("C.html", true,
"<div class=\"block\">case1 end of sentence.</div>",
"<div class=\"block\">case2 end of sentence.</div>",
"<div class=\"block\">case3 end of sentence.</div>",
"<div class=\"block\">case4 end of sentence.</div>",
"<div class=\"block\">case5 end of sentence.</div>",
"<div class=\"block\">case6 end of sentence.</div>",
"<div class=\"block\">case7 end of sentence.</div>",
"<div class=\"block\">case8 end of sentence.</div>",
"<div class=\"block\">case9 end of sentence.</div>",
"<div class=\"block\">caseA end of sentence.</div>");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 8039410 8042601 8042829 8049393 8050031 8155061 8155995 8167967
* @bug 8039410 8042601 8042829 8049393 8050031 8155061 8155995 8167967 8169813
* @summary test to determine if members are ordered correctly
* @library ../lib/
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -494,23 +494,23 @@ public class TestOrdering extends JavadocTester {
String[] composeTestVectors() {
List<String> testList = new ArrayList<>();
testList.addAll(Arrays.asList(expectedPackageOrdering));
for (String x : expectedEnumOrdering) {
testList.add(x.replace("REPLACE_ME", "&lt;Unnamed&gt;"));
for (int i = 0; i < MAX_PACKAGES; i++) {
String wpkg = "add" + i;
testList.add(wpkg + "/" + x.replace("REPLACE_ME",
wpkg));
String dpkg = wpkg;
for (int j = 1; j < MAX_SUBPACKAGES_DEPTH; j++) {
dpkg = dpkg + "/" + "add";
}
for (int i = 0; i < MAX_PACKAGES; i++) {
String wpkg = "add" + i;
for (String x : expectedEnumOrdering) {
testList.add(wpkg + "/" + x.replace("REPLACE_ME", wpkg));
}
String dpkg = wpkg;
for (int j = 1; j < MAX_SUBPACKAGES_DEPTH; j++) {
dpkg = dpkg + "/" + "add";
for (String x : expectedEnumOrdering) {
testList.add(dpkg + "/" + x.replace("REPLACE_ME", pathToPackage(dpkg)));
}
}
}
testList.addAll(Arrays.asList(expectedFieldOrdering));
for (String x : expectedMethodOrdering) {
testList.add(x);
for (int i = 0; i < MAX_PACKAGES; i++) {
@ -523,6 +523,8 @@ public class TestOrdering extends JavadocTester {
}
}
}
testList.addAll(Arrays.asList(expectedPackageOrdering));
testList.addAll(Arrays.asList(expectedFieldOrdering));
return testList.toArray(new String[testList.size()]);
}

View File

@ -23,6 +23,7 @@
import javax.tools.Diagnostic;
import org.testng.annotations.Test;
import jdk.jshell.VarSnippet;
import static jdk.jshell.Snippet.Status.VALID;
@ -30,6 +31,7 @@ import static jdk.jshell.Snippet.SubKind.*;
public class ExecutionControlTestBase extends KullaTesting {
@Test
public void classesDeclaration() {
assertEval("interface A { }");
assertEval("class B implements A { }");
@ -45,6 +47,7 @@ public class ExecutionControlTestBase extends KullaTesting {
assertActiveKeys();
}
@Test
public void interfaceTest() {
String interfaceSource
= "interface A {\n"
@ -72,6 +75,7 @@ public class ExecutionControlTestBase extends KullaTesting {
assertEval("new B.Inner2();");
}
@Test
public void variables() {
VarSnippet snx = varKey(assertEval("int x = 10;"));
VarSnippet sny = varKey(assertEval("String y = \"hi\";"));
@ -83,6 +87,7 @@ public class ExecutionControlTestBase extends KullaTesting {
assertActiveKeys();
}
@Test
public void methodOverload() {
assertEval("int m() { return 1; }");
assertEval("int m(int x) { return 2; }");
@ -107,6 +112,7 @@ public class ExecutionControlTestBase extends KullaTesting {
assertActiveKeys();
}
@Test
public void testExprSanity() {
assertEval("int x = 3;", "3");
assertEval("int y = 4;", "4");
@ -114,6 +120,7 @@ public class ExecutionControlTestBase extends KullaTesting {
assertActiveKeys();
}
@Test
public void testImportOnDemand() {
assertImportKeyMatch("import java.util.*;", "java.util.*", TYPE_IMPORT_ON_DEMAND_SUBKIND, added(VALID));
assertEval("List<Integer> list = new ArrayList<>();");

View File

@ -61,7 +61,8 @@ public class FailOverDirectExecutionControlTest extends ExecutionControlTestBase
ClassLoader ccl;
ExecutionControlProvider provider;
Map<Level, List<String>> logged = new HashMap<>();
LogTestHandler hndlr;
Map<Level, List<String>> logged;
private class LogTestHandler extends Handler {
@ -95,7 +96,9 @@ public class FailOverDirectExecutionControlTest extends ExecutionControlTestBase
public void setUp() {
Logger logger = Logger.getLogger("jdk.jshell.execution");
logger.setLevel(Level.ALL);
logger.addHandler(new LogTestHandler());
hndlr = new LogTestHandler();
logger.addHandler(hndlr);
logged = new HashMap<>();
Compiler compiler = new Compiler();
Path modDir = Paths.get("mod");
compiler.compile(modDir,
@ -133,6 +136,8 @@ public class FailOverDirectExecutionControlTest extends ExecutionControlTestBase
@Override
public void tearDown() {
super.tearDown();
Logger logger = Logger.getLogger("jdk.jshell.execution");
logger.removeHandler(hndlr);
Thread.currentThread().setContextClassLoader(ccl);
}

View File

@ -27,7 +27,7 @@
* @summary Test that fail-over works for fail-over ExecutionControl generators.
* @modules jdk.jshell/jdk.jshell.execution
* jdk.jshell/jdk.jshell.spi
* @build KullaTesting ExecutionControlTestBase
* @build KullaTesting ExecutionControlTestBase DyingRemoteAgent
* @run testng FailOverExecutionControlDyingLaunchTest
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, 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
@ -74,6 +74,7 @@ public class LimitedImage {
);
//check proper diagnostics when zip/jar FS not present:
System.err.println("Test " + testJar + " on classpath");
actualOutput = new JavacTask(tb, Mode.CMDLINE)
.classpath(testJar)
.options("-XDrawDiagnostics")
@ -84,9 +85,10 @@ public class LimitedImage {
.getOutputLines(OutputKind.DIRECT);
if (!expectedOutput.equals(actualOutput)) {
throw new AssertionError("Unexpected output: " + actualOutput);
throw new AssertionError("Unexpected output");
}
System.err.println("Test " + testJar + " on sourcepath");
actualOutput = new JavacTask(tb, Mode.CMDLINE)
.sourcepath(testJar)
.options("-XDrawDiagnostics")
@ -97,9 +99,10 @@ public class LimitedImage {
.getOutputLines(OutputKind.DIRECT);
if (!expectedOutput.equals(actualOutput)) {
throw new AssertionError("Unexpected output: " + actualOutput);
throw new AssertionError("Unexpected output");
}
System.err.println("Test " + testJar + " on modulepath");
actualOutput = new JavacTask(tb, Mode.CMDLINE)
.options("-XDrawDiagnostics",
"--module-path", testJar.toString())
@ -110,7 +113,7 @@ public class LimitedImage {
.getOutputLines(OutputKind.DIRECT);
if (!expectedOutput.equals(actualOutput)) {
throw new AssertionError("Unexpected output: " + actualOutput);
throw new AssertionError("Unexpected output");
}
expectedOutput = Arrays.asList(
@ -118,6 +121,7 @@ public class LimitedImage {
"1 error"
);
System.err.println("Test directory containing " + testJar + " on modulepath");
actualOutput = new JavacTask(tb, Mode.CMDLINE)
.classpath()
.options("-XDrawDiagnostics",
@ -129,7 +133,7 @@ public class LimitedImage {
.getOutputLines(OutputKind.DIRECT);
if (!expectedOutput.equals(actualOutput)) {
throw new AssertionError("Unexpected output: " + actualOutput);
throw new AssertionError("Unexpected output");
}
}

View File

@ -22,7 +22,8 @@
*/
/**
* @test 8165102
* @test
* @bug 8165102
* @summary incorrect message from javac
* @library /tools/lib
* @modules

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2017, 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
@ -23,16 +23,18 @@
/*
* @test
* @bug 6449798 6399404
* @bug 6449798 6399404 8173776
* @summary Test basic workings of PackageElement
* @author Joseph D. Darcy
* @library /tools/javac/lib
* @modules java.compiler
* jdk.compiler
* @build JavacTestingAbstractProcessor TestPackageElement
* @compile -processor TestPackageElement -proc:only TestPackageElement.java
* @compile -processor TestPackageElement -proc:only TestPackageElement.java
* @compile -processor TestPackageElement -proc:only --release 8 TestPackageElement.java
*/
import java.util.Objects;
import java.util.Set;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
@ -67,7 +69,22 @@ public class TestPackageElement extends JavacTestingAbstractProcessor {
PackageElement javaLang = eltUtils.getPackageElement("java.lang");
if (javaLang.isUnnamed())
throw new RuntimeException("Package java.lang is unnamed!");
testEnclosingElement(javaLang);
}
return true;
}
void testEnclosingElement(PackageElement javaLang) {
SourceVersion version = processingEnv.getSourceVersion();
Element enclosing = javaLang.getEnclosingElement();
Element expectedEnclosing =
(version.compareTo(RELEASE_9) < 0) ? // No modules
null :
eltUtils.getModuleElement("java.base");
if (!Objects.equals(enclosing, expectedEnclosing))
throw new RuntimeException("Unexpected enclosing element under source version " +
version);
}
}

View File

@ -0,0 +1,18 @@
/*
* @test
* @bug 8173609
* @summary printing of modules
* @compile/ref=module-info.out -Xprint p/P.java module-info.java
*/
/**
* Printing of modules
*/
@Deprecated
module printing {
requires static transitive java.base;
exports p to m.m1, m.m2;
opens p to m.m1, m.m2;
uses p.P;
provides p.P with p.P.P1, p.P.P2;
}

View File

@ -0,0 +1,27 @@
package p;
public class P {
public static class P1 extends p.P {
public P1();
}
public static class P2 extends p.P {
public P2();
}
public P();
}
/**
* Printing of modules
*/
@java.lang.Deprecated
module printing {
requires static transitive java.base;
exports p to m.m1, m.m2;
opens p to m.m1, m.m2;
uses p.P;
provides p.P with p.P.P1, p.P.P2;
}

View File

@ -0,0 +1,6 @@
package p;
public class P {
public static class P1 extends P {}
public static class P2 extends P {}
}