Merge
This commit is contained in:
commit
071f4e022d
@ -243,9 +243,9 @@ public interface Processor {
|
||||
* Returns the names of the annotation types supported by this
|
||||
* processor. An element of the result may be the canonical
|
||||
* (fully qualified) name of a supported annotation type.
|
||||
* Alternately it may be of the form "<tt><i>name</i>.*</tt>"
|
||||
* Alternately it may be of the form "<code><i>name</i>.*</code>"
|
||||
* representing the set of all annotation types with canonical
|
||||
* names beginning with "<tt><i>name.</i></tt>".
|
||||
* names beginning with "<code><i>name.</i></code>".
|
||||
*
|
||||
* In either of those cases, the name of the annotation type can
|
||||
* be optionally preceded by a module name followed by a {@code
|
||||
@ -267,13 +267,13 @@ public interface Processor {
|
||||
* <dl>
|
||||
* <dt><i>SupportedAnnotationTypeString:</i>
|
||||
* <dd><i>ModulePrefix</i><sub><i>opt</i></sub> <i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub>
|
||||
* <dd><tt>*</tt>
|
||||
* <dd><code>*</code>
|
||||
*
|
||||
* <dt><i>ModulePrefix:</i>
|
||||
* <dd><i>TypeName</i> <tt>/</tt>
|
||||
* <dd><i>TypeName</i> <code>/</code>
|
||||
*
|
||||
* <dt><i>DotStar:</i>
|
||||
* <dd><tt>.</tt> <tt>*</tt>
|
||||
* <dd><code>.</code> <code>*</code>
|
||||
* </dl>
|
||||
* </blockquote>
|
||||
*
|
||||
|
@ -41,7 +41,7 @@ import javax.lang.model.type.TypeMirror;
|
||||
* implementing this interface are used to operate on a value when the
|
||||
* type of that value is unknown at compile time. When a visitor is
|
||||
* passed to a value's {@link AnnotationValue#accept accept} method,
|
||||
* the <tt>visit<i>XYZ</i></tt> method applicable to that value is
|
||||
* the <code>visit<i>XYZ</i></code> method applicable to that value is
|
||||
* invoked.
|
||||
*
|
||||
* <p> Classes implementing this interface may or may not throw a
|
||||
|
@ -32,7 +32,7 @@ import javax.lang.model.util.*;
|
||||
* pattern. Classes implementing this interface are used to operate
|
||||
* on an element when the kind of element is unknown at compile time.
|
||||
* When a visitor is passed to an element's {@link Element#accept
|
||||
* accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
|
||||
* accept} method, the <code>visit<i>XYZ</i></code> method most applicable
|
||||
* to that element is invoked.
|
||||
*
|
||||
* <p> Classes implementing this interface may or may not throw a
|
||||
|
@ -32,7 +32,7 @@ import javax.lang.model.element.*;
|
||||
* visitor design pattern. Classes implementing this
|
||||
* interface are used to operate on a type when the kind of
|
||||
* type is unknown at compile time. When a visitor is passed to a
|
||||
* type's {@link TypeMirror#accept accept} method, the <tt>visit<i>XYZ</i></tt>
|
||||
* type's {@link TypeMirror#accept accept} method, the <code>visit<i>XYZ</i></code>
|
||||
* method most applicable to that type is invoked.
|
||||
*
|
||||
* <p> Classes implementing this interface may or may not throw a
|
||||
|
@ -28,11 +28,11 @@ package javax.lang.model.type;
|
||||
|
||||
/**
|
||||
* Represents a wildcard type argument.
|
||||
* Examples include: <pre><tt>
|
||||
* Examples include: <pre><code>
|
||||
* ?
|
||||
* ? extends Number
|
||||
* ? super T
|
||||
* </tt></pre>
|
||||
* </code></pre>
|
||||
*
|
||||
* <p> A wildcard may have its upper bound explicitly set by an
|
||||
* {@code extends} clause, its lower bound explicitly set by a
|
||||
|
@ -36,10 +36,10 @@ import javax.lang.model.SourceVersion;
|
||||
* A visitor of program elements based on their {@linkplain
|
||||
* ElementKind kind} with default behavior appropriate for the {@link
|
||||
* SourceVersion#RELEASE_6 RELEASE_6} source version. For {@linkplain
|
||||
* Element elements} <tt><i>XYZ</i></tt> that may have more than one
|
||||
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
|
||||
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
|
||||
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
|
||||
* Element elements} <code><i>XYZ</i></code> that may have more than one
|
||||
* kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
|
||||
* to the <code>visit<i>XYZKind</i></code> method corresponding to the
|
||||
* first argument's kind. The <code>visit<i>XYZKind</i></code> methods
|
||||
* call {@link #defaultAction defaultAction}, passing their arguments
|
||||
* to {@code defaultAction}'s corresponding parameters.
|
||||
*
|
||||
|
@ -34,10 +34,10 @@ import static javax.lang.model.SourceVersion.*;
|
||||
* A visitor of program elements based on their {@linkplain
|
||||
* ElementKind kind} with default behavior appropriate for the {@link
|
||||
* SourceVersion#RELEASE_7 RELEASE_7} source version. For {@linkplain
|
||||
* Element elements} <tt><i>XYZ</i></tt> that may have more than one
|
||||
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
|
||||
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
|
||||
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
|
||||
* Element elements} <code><i>XYZ</i></code> that may have more than one
|
||||
* kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
|
||||
* to the <code>visit<i>XYZKind</i></code> method corresponding to the
|
||||
* first argument's kind. The <code>visit<i>XYZKind</i></code> methods
|
||||
* call {@link #defaultAction defaultAction}, passing their arguments
|
||||
* to {@code defaultAction}'s corresponding parameters.
|
||||
*
|
||||
|
@ -34,10 +34,10 @@ import javax.lang.model.SourceVersion;
|
||||
* A visitor of program elements based on their {@linkplain
|
||||
* ElementKind kind} with default behavior appropriate for the {@link
|
||||
* SourceVersion#RELEASE_8 RELEASE_8} source version. For {@linkplain
|
||||
* Element elements} <tt><i>XYZ</i></tt> that may have more than one
|
||||
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
|
||||
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
|
||||
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
|
||||
* Element elements} <code><i>XYZ</i></code> that may have more than one
|
||||
* kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
|
||||
* to the <code>visit<i>XYZKind</i></code> method corresponding to the
|
||||
* first argument's kind. The <code>visit<i>XYZKind</i></code> methods
|
||||
* call {@link #defaultAction defaultAction}, passing their arguments
|
||||
* to {@code defaultAction}'s corresponding parameters.
|
||||
*
|
||||
|
@ -34,10 +34,10 @@ import javax.lang.model.SourceVersion;
|
||||
* A visitor of program elements based on their {@linkplain
|
||||
* ElementKind kind} with default behavior appropriate for the {@link
|
||||
* SourceVersion#RELEASE_9 RELEASE_9} source version. For {@linkplain
|
||||
* Element elements} <tt><i>XYZ</i></tt> that may have more than one
|
||||
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
|
||||
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
|
||||
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
|
||||
* Element elements} <code><i>XYZ</i></code> that may have more than one
|
||||
* kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
|
||||
* to the <code>visit<i>XYZKind</i></code> method corresponding to the
|
||||
* first argument's kind. The <code>visit<i>XYZKind</i></code> methods
|
||||
* call {@link #defaultAction defaultAction}, passing their arguments
|
||||
* to {@code defaultAction}'s corresponding parameters.
|
||||
*
|
||||
|
@ -34,26 +34,26 @@ import static javax.lang.model.SourceVersion.*;
|
||||
/**
|
||||
* A scanning visitor of program elements with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6}
|
||||
* source version. The <tt>visit<i>XYZ</i></tt> methods in this
|
||||
* source version. The <code>visit<i>XYZ</i></code> methods in this
|
||||
* class scan their component elements by calling {@code scan} on
|
||||
* their {@linkplain Element#getEnclosedElements enclosed elements},
|
||||
* {@linkplain ExecutableElement#getParameters parameters}, etc., as
|
||||
* indicated in the individual method specifications. A subclass can
|
||||
* control the order elements are visited by overriding the
|
||||
* <tt>visit<i>XYZ</i></tt> methods. Note that clients of a scanner
|
||||
* <code>visit<i>XYZ</i></code> methods. Note that clients of a scanner
|
||||
* may get the desired behavior be invoking {@code v.scan(e, p)} rather
|
||||
* than {@code v.visit(e, p)} on the root objects of interest.
|
||||
*
|
||||
* <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
|
||||
* <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the
|
||||
* new method can cause the enclosed elements to be scanned in the
|
||||
* default way by calling <tt>super.visit<i>XYZ</i></tt>. In this
|
||||
* default way by calling <code>super.visit<i>XYZ</i></code>. In this
|
||||
* fashion, the concrete visitor can control the ordering of traversal
|
||||
* over the component elements with respect to the additional
|
||||
* processing; for example, consistently calling
|
||||
* <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
|
||||
* <code>super.visit<i>XYZ</i></code> at the start of the overridden
|
||||
* methods will yield a preorder traversal, etc. If the component
|
||||
* elements should be traversed in some other order, instead of
|
||||
* calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
|
||||
* calling <code>super.visit<i>XYZ</i></code>, an overriding visit method
|
||||
* should call {@code scan} with the elements in the desired order.
|
||||
*
|
||||
* <p> Methods in this class may be overridden subject to their
|
||||
|
@ -34,26 +34,26 @@ import static javax.lang.model.SourceVersion.*;
|
||||
/**
|
||||
* A scanning visitor of program elements with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_7 RELEASE_7}
|
||||
* source version. The <tt>visit<i>XYZ</i></tt> methods in this
|
||||
* source version. The <code>visit<i>XYZ</i></code> methods in this
|
||||
* class scan their component elements by calling {@code scan} on
|
||||
* their {@linkplain Element#getEnclosedElements enclosed elements},
|
||||
* {@linkplain ExecutableElement#getParameters parameters}, etc., as
|
||||
* indicated in the individual method specifications. A subclass can
|
||||
* control the order elements are visited by overriding the
|
||||
* <tt>visit<i>XYZ</i></tt> methods. Note that clients of a scanner
|
||||
* <code>visit<i>XYZ</i></code> methods. Note that clients of a scanner
|
||||
* may get the desired behavior be invoking {@code v.scan(e, p)} rather
|
||||
* than {@code v.visit(e, p)} on the root objects of interest.
|
||||
*
|
||||
* <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
|
||||
* <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the
|
||||
* new method can cause the enclosed elements to be scanned in the
|
||||
* default way by calling <tt>super.visit<i>XYZ</i></tt>. In this
|
||||
* default way by calling <code>super.visit<i>XYZ</i></code>. In this
|
||||
* fashion, the concrete visitor can control the ordering of traversal
|
||||
* over the component elements with respect to the additional
|
||||
* processing; for example, consistently calling
|
||||
* <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
|
||||
* <code>super.visit<i>XYZ</i></code> at the start of the overridden
|
||||
* methods will yield a preorder traversal, etc. If the component
|
||||
* elements should be traversed in some other order, instead of
|
||||
* calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
|
||||
* calling <code>super.visit<i>XYZ</i></code>, an overriding visit method
|
||||
* should call {@code scan} with the elements in the desired order.
|
||||
*
|
||||
* <p> Methods in this class may be overridden subject to their
|
||||
|
@ -34,26 +34,26 @@ import static javax.lang.model.SourceVersion.*;
|
||||
/**
|
||||
* A scanning visitor of program elements with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
|
||||
* source version. The <tt>visit<i>XYZ</i></tt> methods in this
|
||||
* source version. The <code>visit<i>XYZ</i></code> methods in this
|
||||
* class scan their component elements by calling {@code scan} on
|
||||
* their {@linkplain Element#getEnclosedElements enclosed elements},
|
||||
* {@linkplain ExecutableElement#getParameters parameters}, etc., as
|
||||
* indicated in the individual method specifications. A subclass can
|
||||
* control the order elements are visited by overriding the
|
||||
* <tt>visit<i>XYZ</i></tt> methods. Note that clients of a scanner
|
||||
* <code>visit<i>XYZ</i></code> methods. Note that clients of a scanner
|
||||
* may get the desired behavior be invoking {@code v.scan(e, p)} rather
|
||||
* than {@code v.visit(e, p)} on the root objects of interest.
|
||||
*
|
||||
* <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
|
||||
* <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the
|
||||
* new method can cause the enclosed elements to be scanned in the
|
||||
* default way by calling <tt>super.visit<i>XYZ</i></tt>. In this
|
||||
* default way by calling <code>super.visit<i>XYZ</i></code>. In this
|
||||
* fashion, the concrete visitor can control the ordering of traversal
|
||||
* over the component elements with respect to the additional
|
||||
* processing; for example, consistently calling
|
||||
* <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
|
||||
* <code>super.visit<i>XYZ</i></code> at the start of the overridden
|
||||
* methods will yield a preorder traversal, etc. If the component
|
||||
* elements should be traversed in some other order, instead of
|
||||
* calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
|
||||
* calling <code>super.visit<i>XYZ</i></code>, an overriding visit method
|
||||
* should call {@code scan} with the elements in the desired order.
|
||||
*
|
||||
* <p> Methods in this class may be overridden subject to their
|
||||
|
@ -34,26 +34,26 @@ import static javax.lang.model.SourceVersion.*;
|
||||
/**
|
||||
* A scanning visitor of program elements with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
|
||||
* source version. The <tt>visit<i>XYZ</i></tt> methods in this
|
||||
* source version. The <code>visit<i>XYZ</i></code> methods in this
|
||||
* class scan their component elements by calling {@code scan} on
|
||||
* their {@linkplain Element#getEnclosedElements enclosed elements},
|
||||
* {@linkplain ExecutableElement#getParameters parameters}, etc., as
|
||||
* indicated in the individual method specifications. A subclass can
|
||||
* control the order elements are visited by overriding the
|
||||
* <tt>visit<i>XYZ</i></tt> methods. Note that clients of a scanner
|
||||
* <code>visit<i>XYZ</i></code> methods. Note that clients of a scanner
|
||||
* may get the desired behavior be invoking {@code v.scan(e, p)} rather
|
||||
* than {@code v.visit(e, p)} on the root objects of interest.
|
||||
*
|
||||
* <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
|
||||
* <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the
|
||||
* new method can cause the enclosed elements to be scanned in the
|
||||
* default way by calling <tt>super.visit<i>XYZ</i></tt>. In this
|
||||
* default way by calling <code>super.visit<i>XYZ</i></code>. In this
|
||||
* fashion, the concrete visitor can control the ordering of traversal
|
||||
* over the component elements with respect to the additional
|
||||
* processing; for example, consistently calling
|
||||
* <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
|
||||
* <code>super.visit<i>XYZ</i></code> at the start of the overridden
|
||||
* methods will yield a preorder traversal, etc. If the component
|
||||
* elements should be traversed in some other order, instead of
|
||||
* calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
|
||||
* calling <code>super.visit<i>XYZ</i></code>, an overriding visit method
|
||||
* should call {@code scan} with the elements in the desired order.
|
||||
*
|
||||
* <p> Methods in this class may be overridden subject to their
|
||||
|
@ -34,10 +34,10 @@ import static javax.lang.model.SourceVersion.*;
|
||||
* A visitor of types based on their {@linkplain TypeKind kind} with
|
||||
* default behavior appropriate for the {@link SourceVersion#RELEASE_6
|
||||
* RELEASE_6} source version. For {@linkplain
|
||||
* TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
|
||||
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
|
||||
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
|
||||
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
|
||||
* TypeMirror types} <code><i>XYZ</i></code> that may have more than one
|
||||
* kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
|
||||
* to the <code>visit<i>XYZKind</i></code> method corresponding to the
|
||||
* first argument's kind. The <code>visit<i>XYZKind</i></code> methods
|
||||
* call {@link #defaultAction defaultAction}, passing their arguments
|
||||
* to {@code defaultAction}'s corresponding parameters.
|
||||
*
|
||||
|
@ -34,10 +34,10 @@ import javax.lang.model.SourceVersion;
|
||||
* A visitor of types based on their {@linkplain TypeKind kind} with
|
||||
* default behavior appropriate for the {@link SourceVersion#RELEASE_7
|
||||
* RELEASE_7} source version. For {@linkplain
|
||||
* TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
|
||||
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
|
||||
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
|
||||
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
|
||||
* TypeMirror types} <code><i>XYZ</i></code> that may have more than one
|
||||
* kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
|
||||
* to the <code>visit<i>XYZKind</i></code> method corresponding to the
|
||||
* first argument's kind. The <code>visit<i>XYZKind</i></code> methods
|
||||
* call {@link #defaultAction defaultAction}, passing their arguments
|
||||
* to {@code defaultAction}'s corresponding parameters.
|
||||
*
|
||||
|
@ -34,10 +34,10 @@ import static javax.lang.model.SourceVersion.*;
|
||||
* A visitor of types based on their {@linkplain TypeKind kind} with
|
||||
* default behavior appropriate for the {@link SourceVersion#RELEASE_8
|
||||
* RELEASE_8} source version. For {@linkplain
|
||||
* TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
|
||||
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
|
||||
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
|
||||
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
|
||||
* TypeMirror types} <code><i>XYZ</i></code> that may have more than one
|
||||
* kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
|
||||
* to the <code>visit<i>XYZKind</i></code> method corresponding to the
|
||||
* first argument's kind. The <code>visit<i>XYZKind</i></code> methods
|
||||
* call {@link #defaultAction defaultAction}, passing their arguments
|
||||
* to {@code defaultAction}'s corresponding parameters.
|
||||
*
|
||||
|
@ -34,10 +34,10 @@ import static javax.lang.model.SourceVersion.*;
|
||||
* A visitor of types based on their {@linkplain TypeKind kind} with
|
||||
* default behavior appropriate for the {@link SourceVersion#RELEASE_9
|
||||
* RELEASE_9} source version. For {@linkplain
|
||||
* TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
|
||||
* kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
|
||||
* to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
|
||||
* first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
|
||||
* TypeMirror types} <code><i>XYZ</i></code> that may have more than one
|
||||
* kind, the <code>visit<i>XYZ</i></code> methods in this class delegate
|
||||
* to the <code>visit<i>XYZKind</i></code> method corresponding to the
|
||||
* first argument's kind. The <code>visit<i>XYZKind</i></code> methods
|
||||
* call {@link #defaultAction defaultAction}, passing their arguments
|
||||
* to {@code defaultAction}'s corresponding parameters.
|
||||
*
|
||||
|
@ -921,6 +921,7 @@ public abstract class Symbol extends AnnoConstruct implements Element {
|
||||
|
||||
public PackageSymbol unnamedPackage;
|
||||
public Map<Name, PackageSymbol> visiblePackages;
|
||||
public Set<ModuleSymbol> readModules;
|
||||
public List<Symbol> enclosedPackages = List.nil();
|
||||
|
||||
public Completer usesProvidesCompleter = Completer.NULL_COMPLETER;
|
||||
|
@ -61,7 +61,6 @@ import com.sun.tools.javac.util.JavacMessages;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.Name;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
import com.sun.tools.javac.util.Options;
|
||||
|
||||
import static com.sun.tools.javac.code.Flags.*;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.*;
|
||||
@ -469,9 +468,7 @@ public class Symtab {
|
||||
scope.enter(errSymbol);
|
||||
|
||||
Source source = Source.instance(context);
|
||||
Options options = Options.instance(context);
|
||||
boolean noModules = options.isSet("noModules");
|
||||
if (source.allowModules() && !noModules) {
|
||||
if (source.allowModules()) {
|
||||
java_base = enterModule(names.java_base);
|
||||
//avoid completing java.base during the Symtab initialization
|
||||
java_base.completer = Completer.NULL_COMPLETER;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -47,6 +47,7 @@ import java.util.*;
|
||||
import static com.sun.tools.javac.code.Flags.SYNTHETIC;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.MDL;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.MTH;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.PCK;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.VAR;
|
||||
import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
|
||||
import static com.sun.tools.javac.code.TypeTag.ARRAY;
|
||||
@ -228,7 +229,14 @@ public class Annotate {
|
||||
s.resetAnnotations(); // mark Annotations as incomplete for now
|
||||
|
||||
normal(() -> {
|
||||
Assert.check(s.annotationsPendingCompletion());
|
||||
// Packages are unusual, in that they are the only type of declaration that can legally appear
|
||||
// more than once in a compilation, and in all cases refer to the same underlying symbol.
|
||||
// This means they are the only kind of declaration that syntactically may have multiple sets
|
||||
// of annotations, each on a different package declaration, even though that is ultimately
|
||||
// forbidden by JLS 8 section 7.4.
|
||||
// The corollary here is that all of the annotations on a package symbol may have already
|
||||
// been handled, meaning that the set of annotations pending completion is now empty.
|
||||
Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
|
||||
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
|
||||
DiagnosticPosition prevLintPos =
|
||||
deferPos != null
|
||||
|
@ -353,7 +353,7 @@ public class Attr extends JCTree.Visitor {
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Symbol visitMemberSelect(MemberSelectTree node, Env<AttrContext> env) {
|
||||
Symbol site = visit(node.getExpression(), env);
|
||||
if (site.kind == ERR || site.kind == ABSENT_TYP)
|
||||
if (site.kind == ERR || site.kind == ABSENT_TYP || site.kind == HIDDEN)
|
||||
return site;
|
||||
Name name = (Name)node.getIdentifier();
|
||||
if (site.kind == PCK) {
|
||||
|
@ -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
|
||||
@ -436,8 +436,10 @@ public class Check {
|
||||
}
|
||||
|
||||
void clearLocalClassNameIndexes(ClassSymbol c) {
|
||||
localClassNameIndexes.remove(new Pair<>(
|
||||
c.owner.enclClass().flatname, c.name));
|
||||
if (c.owner != null && c.owner.kind != NIL) {
|
||||
localClassNameIndexes.remove(new Pair<>(
|
||||
c.owner.enclClass().flatname, c.name));
|
||||
}
|
||||
}
|
||||
|
||||
public void newRound() {
|
||||
|
@ -1327,6 +1327,7 @@ public class Modules extends JCTree.Visitor {
|
||||
initAddExports();
|
||||
|
||||
msym.visiblePackages = new LinkedHashMap<>();
|
||||
msym.readModules = new HashSet<>(readable);
|
||||
|
||||
Map<Name, ModuleSymbol> seen = new HashMap<>();
|
||||
|
||||
|
@ -54,14 +54,19 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.lang.model.element.ElementVisitor;
|
||||
|
||||
import com.sun.tools.javac.code.Directive.ExportsDirective;
|
||||
import static com.sun.tools.javac.code.Flags.*;
|
||||
import static com.sun.tools.javac.code.Flags.BLOCK;
|
||||
import static com.sun.tools.javac.code.Flags.STATIC;
|
||||
@ -69,6 +74,8 @@ import static com.sun.tools.javac.code.Kinds.*;
|
||||
import static com.sun.tools.javac.code.Kinds.Kind.*;
|
||||
import static com.sun.tools.javac.code.TypeTag.*;
|
||||
import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*;
|
||||
import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
||||
import com.sun.tools.javac.resources.CompilerProperties.Fragments;
|
||||
import static com.sun.tools.javac.tree.JCTree.Tag.*;
|
||||
|
||||
/** Helper class for name resolution, used mostly by the attribution phase.
|
||||
@ -89,6 +96,7 @@ public class Resolve {
|
||||
Check chk;
|
||||
Infer infer;
|
||||
ClassFinder finder;
|
||||
ModuleFinder moduleFinder;
|
||||
Types types;
|
||||
JCDiagnostic.Factory diags;
|
||||
public final boolean allowMethodHandles;
|
||||
@ -98,8 +106,6 @@ public class Resolve {
|
||||
private final boolean compactMethodDiags;
|
||||
final EnumSet<VerboseResolutionMode> verboseResolutionMode;
|
||||
|
||||
private final boolean checkModuleAccess;
|
||||
|
||||
WriteableScope polymorphicSignatureScope;
|
||||
|
||||
protected Resolve(Context context) {
|
||||
@ -118,6 +124,7 @@ public class Resolve {
|
||||
chk = Check.instance(context);
|
||||
infer = Infer.instance(context);
|
||||
finder = ClassFinder.instance(context);
|
||||
moduleFinder = ModuleFinder.instance(context);
|
||||
types = Types.instance(context);
|
||||
diags = JCDiagnostic.Factory.instance(context);
|
||||
Source source = Source.instance(context);
|
||||
@ -135,10 +142,6 @@ public class Resolve {
|
||||
inapplicableMethodException = new InapplicableMethodException(diags);
|
||||
|
||||
allowModules = source.allowModules();
|
||||
|
||||
// The following is required, for now, to support building
|
||||
// Swing beaninfo via javadoc.
|
||||
checkModuleAccess = !options.isSet("noModules");
|
||||
}
|
||||
|
||||
/** error symbols, which are returned when resolution fails
|
||||
@ -321,8 +324,7 @@ public class Resolve {
|
||||
isAccessible = true;
|
||||
break;
|
||||
case PUBLIC:
|
||||
isAccessible = true;
|
||||
if (allowModules && checkModuleAccess) {
|
||||
if (allowModules) {
|
||||
ModuleSymbol currModule = env.toplevel.modle;
|
||||
currModule.complete();
|
||||
PackageSymbol p = c.packge();
|
||||
@ -497,7 +499,7 @@ public class Resolve {
|
||||
public Void visitClassType(ClassType t, Env<AttrContext> env) {
|
||||
visit(t.getTypeArguments(), env);
|
||||
if (!isAccessible(env, t, true)) {
|
||||
accessBase(new AccessError(t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
|
||||
accessBase(new AccessError(env, null, t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1971,7 +1973,7 @@ public class Resolve {
|
||||
Symbol loadClass(Env<AttrContext> env, Name name) {
|
||||
try {
|
||||
ClassSymbol c = finder.loadClass(env.toplevel.modle, name);
|
||||
return isAccessible(env, c) ? c : new AccessError(c);
|
||||
return isAccessible(env, c) ? c : new AccessError(env, null, c);
|
||||
} catch (ClassFinder.BadClassFile err) {
|
||||
throw err;
|
||||
} catch (CompletionFailure ex) {
|
||||
@ -1989,20 +1991,29 @@ public class Resolve {
|
||||
Symbol loadClass(Env<AttrContext> env, Name name);
|
||||
}
|
||||
|
||||
private RecoveryLoadClass recoveryLoadClass = (env, name) -> {
|
||||
//even if a class cannot be found in the current module and packages in modules it depends on that
|
||||
//are exported for any or this module, the class may exist internally in some of these modules,
|
||||
//or may exist in a module on which this module does not depend. Provide better diagnostic in
|
||||
//such cases by looking for the class in any module:
|
||||
for (ModuleSymbol ms : syms.getAllModules()) {
|
||||
//do not load currently unloaded classes, to avoid too eager completion of random things in other modules:
|
||||
ClassSymbol clazz = syms.getClass(ms, name);
|
||||
private RecoveryLoadClass recoveryLoadClass = new RecoveryLoadClass() {
|
||||
@Override
|
||||
public Symbol loadClass(Env<AttrContext> env, Name name) {
|
||||
if (allowModules) {
|
||||
Scope importScope = env.toplevel.namedImportScope;
|
||||
Symbol existing = importScope.findFirst(Convert.shortName(name),
|
||||
sym -> sym.kind == TYP && sym.flatName() == name);
|
||||
|
||||
if (clazz != null) {
|
||||
return new AccessError(clazz);
|
||||
if (existing != null) {
|
||||
return new InvisibleSymbolError(env, true, existing);
|
||||
}
|
||||
|
||||
return lookupInvisibleSymbol(env, name, syms::getClass, (ms, n) -> {
|
||||
try {
|
||||
return finder.loadClass(ms, n);
|
||||
} catch (CompletionFailure cf) {
|
||||
//ignore
|
||||
return null;
|
||||
}
|
||||
}, sym -> sym.kind == Kind.TYP, false, typeNotFound);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
public RecoveryLoadClass setRecoveryLoadClass(RecoveryLoadClass recovery) {
|
||||
@ -2011,6 +2022,84 @@ public class Resolve {
|
||||
return prev;
|
||||
}
|
||||
|
||||
Symbol lookupPackage(Env<AttrContext> env, Name name) {
|
||||
PackageSymbol pack = syms.lookupPackage(env.toplevel.modle, name);
|
||||
|
||||
if (allowModules && isImportOnDemand(env, name)) {
|
||||
pack.complete();
|
||||
if (!pack.exists()) {
|
||||
Name nameAndDot = name.append('.', names.empty);
|
||||
boolean prefixOfKnown =
|
||||
env.toplevel.modle.visiblePackages.values()
|
||||
.stream()
|
||||
.anyMatch(p -> p.fullname.startsWith(nameAndDot));
|
||||
|
||||
return lookupInvisibleSymbol(env, name, syms::getPackage, syms::enterPackage, sym -> {
|
||||
sym.complete();
|
||||
return sym.exists();
|
||||
}, prefixOfKnown, pack);
|
||||
}
|
||||
}
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
private boolean isImportOnDemand(Env<AttrContext> env, Name name) {
|
||||
if (!env.tree.hasTag(IMPORT))
|
||||
return false;
|
||||
|
||||
JCTree qualid = ((JCImport) env.tree).qualid;
|
||||
|
||||
if (!qualid.hasTag(SELECT))
|
||||
return false;
|
||||
|
||||
if (TreeInfo.name(qualid) != names.asterisk)
|
||||
return false;
|
||||
|
||||
return TreeInfo.fullName(((JCFieldAccess) qualid).selected) == name;
|
||||
}
|
||||
|
||||
private Symbol lookupInvisibleSymbol(Env<AttrContext> env,
|
||||
Name name,
|
||||
BiFunction<ModuleSymbol, Name, Symbol> get,
|
||||
BiFunction<ModuleSymbol, Name, Symbol> load,
|
||||
Predicate<Symbol> validate,
|
||||
boolean suppressError,
|
||||
Symbol defaultResult) {
|
||||
//even if a class/package cannot be found in the current module and among packages in modules
|
||||
//it depends on that are exported for any or this module, the class/package may exist internally
|
||||
//in some of these modules, or may exist in a module on which this module does not depend.
|
||||
//Provide better diagnostic in such cases by looking for the class in any module:
|
||||
Set<ModuleSymbol> recoverableModules = new HashSet<>(syms.getAllModules());
|
||||
|
||||
recoverableModules.remove(env.toplevel.modle);
|
||||
|
||||
for (ModuleSymbol ms : recoverableModules) {
|
||||
Symbol sym = get.apply(ms, name);
|
||||
|
||||
//avoid overly eager completing classes from source-based modules, as those
|
||||
//may not be completable with the current compiler settings:
|
||||
if (sym == null && (ms.sourceLocation == null)) {
|
||||
if (ms.classLocation == null) {
|
||||
ms = moduleFinder.findModule(ms);
|
||||
}
|
||||
|
||||
if (ms.kind != ERR) {
|
||||
sym = load.apply(ms, name);
|
||||
}
|
||||
}
|
||||
|
||||
if (sym == null)
|
||||
continue;
|
||||
|
||||
if (validate.test(sym)) {
|
||||
return new InvisibleSymbolError(env, suppressError, sym);
|
||||
}
|
||||
}
|
||||
|
||||
return defaultResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a type declared in a scope (not inherited). Return null
|
||||
* if none is found.
|
||||
@ -2211,7 +2300,7 @@ public class Resolve {
|
||||
}
|
||||
|
||||
if (kind.contains(KindSelector.PCK))
|
||||
return syms.lookupPackage(env.toplevel.modle, name);
|
||||
return lookupPackage(env, name);
|
||||
else return bestSoFar;
|
||||
}
|
||||
|
||||
@ -2225,11 +2314,6 @@ public class Resolve {
|
||||
Name name, KindSelector kind) {
|
||||
Name fullname = TypeSymbol.formFullName(name, pck);
|
||||
Symbol bestSoFar = typeNotFound;
|
||||
PackageSymbol pack = null;
|
||||
if (kind.contains(KindSelector.PCK)) {
|
||||
pack = syms.lookupPackage(env.toplevel.modle, fullname);
|
||||
if (pack.exists()) return pack;
|
||||
}
|
||||
if (kind.contains(KindSelector.TYP)) {
|
||||
Symbol sym = loadClass(env, fullname);
|
||||
if (sym.exists()) {
|
||||
@ -2238,7 +2322,10 @@ public class Resolve {
|
||||
}
|
||||
else bestSoFar = bestOf(bestSoFar, sym);
|
||||
}
|
||||
return (pack != null) ? pack : bestSoFar;
|
||||
if (kind.contains(KindSelector.PCK)) {
|
||||
return lookupPackage(env, fullname);
|
||||
}
|
||||
return bestSoFar;
|
||||
}
|
||||
|
||||
/** Find an identifier among the members of a given type `site'.
|
||||
@ -3947,10 +4034,6 @@ public class Resolve {
|
||||
private Env<AttrContext> env;
|
||||
private Type site;
|
||||
|
||||
AccessError(Symbol sym) {
|
||||
this(null, null, sym);
|
||||
}
|
||||
|
||||
AccessError(Env<AttrContext> env, Type site, Symbol sym) {
|
||||
super(HIDDEN, sym, "access error");
|
||||
this.env = env;
|
||||
@ -3983,7 +4066,14 @@ public class Resolve {
|
||||
if (sym.owner.kind == PCK) {
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "not.def.access.package.cant.access",
|
||||
sym, sym.location());
|
||||
sym, sym.location(), inaccessiblePackageReason(env, sym.packge()));
|
||||
} else if ( sym.packge() != syms.rootPackage
|
||||
&& sym.packge().modle != env.toplevel.modle
|
||||
&& !isAccessible(env, sym.outermostClass())) {
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "not.def.access.class.intf.cant.access.reason",
|
||||
sym, sym.location(), sym.location().packge(),
|
||||
inaccessiblePackageReason(env, sym.packge()));
|
||||
} else {
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "not.def.access.class.intf.cant.access",
|
||||
@ -4015,6 +4105,90 @@ public class Resolve {
|
||||
}
|
||||
}
|
||||
|
||||
class InvisibleSymbolError extends InvalidSymbolError {
|
||||
|
||||
private final Env<AttrContext> env;
|
||||
private final boolean suppressError;
|
||||
|
||||
InvisibleSymbolError(Env<AttrContext> env, boolean suppressError, Symbol sym) {
|
||||
super(HIDDEN, sym, "invisible class error");
|
||||
this.env = env;
|
||||
this.suppressError = suppressError;
|
||||
this.name = sym.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
|
||||
DiagnosticPosition pos,
|
||||
Symbol location,
|
||||
Type site,
|
||||
Name name,
|
||||
List<Type> argtypes,
|
||||
List<Type> typeargtypes) {
|
||||
if (suppressError)
|
||||
return null;
|
||||
|
||||
if (sym.kind == PCK) {
|
||||
JCDiagnostic details = inaccessiblePackageReason(env, sym.packge());
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "package.not.visible", sym, details);
|
||||
}
|
||||
|
||||
JCDiagnostic details = inaccessiblePackageReason(env, sym.packge());
|
||||
|
||||
if (pos.getTree() != null && pos.getTree().hasTag(SELECT) && sym.owner.kind == PCK) {
|
||||
pos = ((JCFieldAccess) pos.getTree()).selected.pos();
|
||||
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "package.not.visible", sym.packge(), details);
|
||||
}
|
||||
|
||||
return diags.create(dkind, log.currentSource(),
|
||||
pos, "not.def.access.package.cant.access", sym, sym.packge(), details);
|
||||
}
|
||||
}
|
||||
|
||||
JCDiagnostic inaccessiblePackageReason(Env<AttrContext> env, PackageSymbol sym) {
|
||||
//no dependency:
|
||||
if (!env.toplevel.modle.readModules.contains(sym.modle)) {
|
||||
//does not read:
|
||||
if (sym.modle != syms.unnamedModule) {
|
||||
if (env.toplevel.modle != syms.unnamedModule) {
|
||||
return diags.fragment(Fragments.NotDefAccessDoesNotRead(env.toplevel.modle,
|
||||
sym,
|
||||
sym.modle));
|
||||
} else {
|
||||
return diags.fragment(Fragments.NotDefAccessDoesNotReadFromUnnamed(sym,
|
||||
sym.modle));
|
||||
}
|
||||
} else {
|
||||
return diags.fragment(Fragments.NotDefAccessDoesNotReadUnnamed(sym,
|
||||
env.toplevel.modle));
|
||||
}
|
||||
} else {
|
||||
if (sym.packge().modle.exports.stream().anyMatch(e -> e.packge == sym)) {
|
||||
//not exported to this module:
|
||||
if (env.toplevel.modle != syms.unnamedModule) {
|
||||
return diags.fragment(Fragments.NotDefAccessNotExportedToModule(sym,
|
||||
sym.modle,
|
||||
env.toplevel.modle));
|
||||
} else {
|
||||
return diags.fragment(Fragments.NotDefAccessNotExportedToModuleFromUnnamed(sym,
|
||||
sym.modle));
|
||||
}
|
||||
} else {
|
||||
//not exported:
|
||||
if (env.toplevel.modle != syms.unnamedModule) {
|
||||
return diags.fragment(Fragments.NotDefAccessNotExported(sym,
|
||||
sym.modle));
|
||||
} else {
|
||||
return diags.fragment(Fragments.NotDefAccessNotExportedFromUnnamed(sym,
|
||||
sym.modle));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* InvalidSymbolError error class indicating that an instance member
|
||||
* has erroneously been accessed from a static context.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -410,7 +410,9 @@ public class TypeEnter implements Completer {
|
||||
importNamedStatic(tree, p, name, localEnv);
|
||||
chk.checkCanonical(imp.selected);
|
||||
} else {
|
||||
TypeSymbol c = attribImportType(imp, localEnv).tsym;
|
||||
Type importedType = attribImportType(imp, localEnv);
|
||||
Type originalType = importedType.getOriginalType();
|
||||
TypeSymbol c = originalType.hasTag(CLASS) ? originalType.tsym : importedType.tsym;
|
||||
chk.checkCanonical(imp);
|
||||
importNamed(tree.pos(), c, env, tree);
|
||||
}
|
||||
@ -938,6 +940,7 @@ public class TypeEnter implements Completer {
|
||||
*/
|
||||
void finishClass(JCClassDecl tree, Env<AttrContext> env) {
|
||||
if ((tree.mods.flags & Flags.ENUM) != 0 &&
|
||||
!tree.sym.type.hasTag(ERROR) &&
|
||||
(types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
|
||||
addEnumMembers(tree, env);
|
||||
}
|
||||
|
@ -681,7 +681,7 @@ public class JavaCompiler {
|
||||
if (sep == -1) {
|
||||
msym = modules.getDefaultModule();
|
||||
typeName = name;
|
||||
} else if (source.allowModules() && !options.isSet("noModules")) {
|
||||
} else if (source.allowModules()) {
|
||||
Name modName = names.fromString(name.substring(0, sep));
|
||||
|
||||
msym = moduleFinder.findModule(modName);
|
||||
|
@ -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
|
||||
@ -222,41 +222,6 @@ public class JavacElements implements Elements {
|
||||
}
|
||||
}
|
||||
|
||||
public JavacSourcePosition getSourcePosition(Element e) {
|
||||
Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e);
|
||||
if (treeTop == null)
|
||||
return null;
|
||||
JCTree tree = treeTop.fst;
|
||||
JCCompilationUnit toplevel = treeTop.snd;
|
||||
JavaFileObject sourcefile = toplevel.sourcefile;
|
||||
if (sourcefile == null)
|
||||
return null;
|
||||
return new JavacSourcePosition(sourcefile, tree.pos, toplevel.lineMap);
|
||||
}
|
||||
|
||||
public JavacSourcePosition getSourcePosition(Element e, AnnotationMirror a) {
|
||||
Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e);
|
||||
if (treeTop == null)
|
||||
return null;
|
||||
JCTree tree = treeTop.fst;
|
||||
JCCompilationUnit toplevel = treeTop.snd;
|
||||
JavaFileObject sourcefile = toplevel.sourcefile;
|
||||
if (sourcefile == null)
|
||||
return null;
|
||||
|
||||
JCTree annoTree = matchAnnoToTree(a, e, tree);
|
||||
if (annoTree == null)
|
||||
return null;
|
||||
return new JavacSourcePosition(sourcefile, annoTree.pos,
|
||||
toplevel.lineMap);
|
||||
}
|
||||
|
||||
public JavacSourcePosition getSourcePosition(Element e, AnnotationMirror a,
|
||||
AnnotationValue v) {
|
||||
// TODO: better accuracy in getSourcePosition(... AnnotationValue)
|
||||
return getSourcePosition(e, a);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tree for an annotation given the annotated element
|
||||
* and the element's own tree. Returns null if the tree cannot be found.
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 com.sun.tools.javac.model;
|
||||
|
||||
import javax.tools.JavaFileObject;
|
||||
import com.sun.tools.javac.util.Position;
|
||||
|
||||
/**
|
||||
* Implementation of model API SourcePosition based on javac internal state.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own
|
||||
* risk. This code and its internal interfaces are subject to change
|
||||
* or deletion without notice.</b></p>
|
||||
*/
|
||||
class JavacSourcePosition {
|
||||
|
||||
final JavaFileObject sourcefile;
|
||||
final int pos;
|
||||
final Position.LineMap lineMap;
|
||||
|
||||
JavacSourcePosition(JavaFileObject sourcefile,
|
||||
int pos,
|
||||
Position.LineMap lineMap) {
|
||||
this.sourcefile = sourcefile;
|
||||
this.pos = pos;
|
||||
this.lineMap = (pos != Position.NOPOS) ? lineMap : null;
|
||||
}
|
||||
|
||||
public JavaFileObject getFile() {
|
||||
return sourcefile;
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return pos; // makes use of fact that Position.NOPOS == -1
|
||||
}
|
||||
|
||||
public int getLine() {
|
||||
return (lineMap != null) ? lineMap.getLineNumber(pos) : -1;
|
||||
}
|
||||
|
||||
public int getColumn() {
|
||||
return (lineMap != null) ? lineMap.getColumnNumber(pos) : -1;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
int line = getLine();
|
||||
return (line > 0)
|
||||
? sourcefile + ":" + line
|
||||
: sourcefile.toString();
|
||||
}
|
||||
}
|
@ -230,7 +230,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
|
||||
chk = Check.instance(context);
|
||||
initProcessorLoader();
|
||||
|
||||
allowModules = source.allowModules() && options.isUnset("noModules");
|
||||
allowModules = source.allowModules();
|
||||
}
|
||||
|
||||
public void setProcessors(Iterable<? extends Processor> processors) {
|
||||
|
@ -823,17 +823,87 @@ compiler.err.no.match.entry=\
|
||||
compiler.err.not.annotation.type=\
|
||||
{0} is not an annotation type
|
||||
|
||||
# 0: symbol, 1: symbol
|
||||
# 0: symbol, 1: symbol, 2: message segment
|
||||
compiler.err.not.def.access.package.cant.access=\
|
||||
{0} is not visible because package {1} is not visible
|
||||
{0} is not visible\n\
|
||||
({2})
|
||||
|
||||
# 0: symbol, 1: symbol, 2: message segment
|
||||
compiler.misc.not.def.access.package.cant.access=\
|
||||
{0} is not visible\n\
|
||||
({2})
|
||||
|
||||
# 0: symbol, 1: message segment
|
||||
compiler.err.package.not.visible=\
|
||||
package {0} is not visible\n\
|
||||
({1})
|
||||
|
||||
# 0: symbol, 1: message segment
|
||||
compiler.misc.package.not.visible=\
|
||||
package {0} is not visible\n\
|
||||
({1})
|
||||
|
||||
# {0} - current module
|
||||
# {1} - package in which the invisible class is declared
|
||||
# {2} - module in which {1} is declared
|
||||
# 0: symbol, 1: symbol, 2: symbol
|
||||
compiler.misc.not.def.access.does.not.read=\
|
||||
package {1} is declared in module {2}, but module {0} does not read it
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.does.not.read.from.unnamed=\
|
||||
package {0} is declared in module {1}, which is not in the module graph
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - current module
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.does.not.read.unnamed=\
|
||||
package {0} is declared in the unnamed module, but module {0} does not read it
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.not.exported=\
|
||||
package {0} is declared in module {1}, which does not export it
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.not.exported.from.unnamed=\
|
||||
package {0} is declared in module {1}, which does not export it
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# {2} - current module
|
||||
# 0: symbol, 1: symbol, 2: symbol
|
||||
compiler.misc.not.def.access.not.exported.to.module=\
|
||||
package {0} is declared in module {1}, which does not export it to module {2}
|
||||
|
||||
# {0} - package in which the invisible class is declared
|
||||
# {1} - module in which {0} is declared
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.not.exported.to.module.from.unnamed=\
|
||||
package {0} is declared in module {1}, which does not export it to the unnamed module
|
||||
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.err.not.def.access.class.intf.cant.access=\
|
||||
{0} in {1} is defined in an inaccessible class or interface
|
||||
{1}.{0} is defined in an inaccessible class or interface
|
||||
|
||||
# 0: symbol, 1: symbol
|
||||
compiler.misc.not.def.access.class.intf.cant.access=\
|
||||
{0} in {1} is defined in an inaccessible class or interface
|
||||
{1}.{0} is defined in an inaccessible class or interface
|
||||
|
||||
# 0: symbol, 1: symbol, 2: symbol, 3: message segment
|
||||
compiler.err.not.def.access.class.intf.cant.access.reason=\
|
||||
{1}.{0} in package {2} is not accessible\n\
|
||||
({3})
|
||||
|
||||
# 0: symbol, 1: symbol, 2: symbol, 3: message segment
|
||||
compiler.misc.not.def.access.class.intf.cant.access.reason=\
|
||||
{1}.{0} in package {2} is not accessible\n\
|
||||
({3})
|
||||
|
||||
# 0: symbol, 1: list of type, 2: type
|
||||
compiler.misc.cant.access.inner.cls.constr=\
|
||||
|
@ -68,6 +68,11 @@ public class InternalDebugControl {
|
||||
*/
|
||||
public static final int DBG_EVNT = 0b0010000;
|
||||
|
||||
/**
|
||||
* Event debugging.
|
||||
*/
|
||||
public static final int DBG_WRAP = 0b0100000;
|
||||
|
||||
private static Map<JShell, Integer> debugMap = null;
|
||||
|
||||
/**
|
||||
|
@ -119,6 +119,7 @@ import static jdk.internal.jshell.debug.InternalDebugControl.DBG_DEP;
|
||||
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_EVNT;
|
||||
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_FMGR;
|
||||
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
|
||||
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_WRAP;
|
||||
import static jdk.internal.jshell.tool.ContinuousCompletionProvider.STARTSWITH_MATCHER;
|
||||
|
||||
/**
|
||||
@ -217,7 +218,7 @@ public class JShellTool implements MessageHandler {
|
||||
|
||||
static final String DEFAULT_STARTUP_NAME = "DEFAULT";
|
||||
static final Pattern BUILTIN_FILE_PATTERN = Pattern.compile("\\w+");
|
||||
static final String BUILTIN_FILE_PATH_FORMAT = "jrt:/jdk.jshell/jdk/jshell/tool/resources/%s.jsh";
|
||||
static final String BUILTIN_FILE_PATH_FORMAT = "/jdk/jshell/tool/resources/%s.jsh";
|
||||
|
||||
// match anything followed by whitespace
|
||||
private static final Pattern OPTION_PRE_PATTERN =
|
||||
@ -1919,9 +1920,13 @@ public class JShellTool implements MessageHandler {
|
||||
flags |= DBG_EVNT;
|
||||
fluff("Event debugging on");
|
||||
break;
|
||||
case 'w':
|
||||
flags |= DBG_WRAP;
|
||||
fluff("Wrap debugging on");
|
||||
break;
|
||||
default:
|
||||
hard("Unknown debugging option: %c", ch);
|
||||
fluff("Use: 0 r g f c d");
|
||||
fluff("Use: 0 r g f c d e w");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2421,9 +2426,11 @@ public class JShellTool implements MessageHandler {
|
||||
String readResource(String name) throws IOException {
|
||||
// Attempt to find the file as a resource
|
||||
String spec = String.format(BUILTIN_FILE_PATH_FORMAT, name);
|
||||
URL url = new URL(spec);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||
return reader.lines().collect(Collectors.joining("\n"));
|
||||
|
||||
try (InputStream in = JShellTool.class.getResourceAsStream(spec);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
|
||||
return reader.lines().collect(Collectors.joining("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
// retrieve the default startup string
|
||||
|
@ -66,7 +66,7 @@ public final class StopDetectingInputStream extends InputStream {
|
||||
if ((read = input.read()) == (-1)) {
|
||||
break;
|
||||
}
|
||||
if (read == 3 && currentState == State.BUFFER) {
|
||||
if (read == 3 && getState() == State.BUFFER) {
|
||||
stop.run();
|
||||
} else {
|
||||
write(read);
|
||||
@ -141,6 +141,10 @@ public final class StopDetectingInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
private synchronized State waitInputNeeded() {
|
||||
while (state == State.WAIT) {
|
||||
try {
|
||||
|
@ -49,6 +49,7 @@ import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import jdk.jshell.ExpressionToTypeInfo.ExpressionInfo;
|
||||
import jdk.jshell.Key.ErroneousKey;
|
||||
import jdk.jshell.Key.MethodKey;
|
||||
import jdk.jshell.Key.TypeDeclKey;
|
||||
@ -58,7 +59,6 @@ import jdk.jshell.TaskFactory.AnalyzeTask;
|
||||
import jdk.jshell.TaskFactory.BaseTask;
|
||||
import jdk.jshell.TaskFactory.CompileTask;
|
||||
import jdk.jshell.TaskFactory.ParseTask;
|
||||
import jdk.jshell.TreeDissector.ExpressionInfo;
|
||||
import jdk.jshell.Wrap.Range;
|
||||
import jdk.jshell.Snippet.Status;
|
||||
import jdk.jshell.spi.ExecutionControl.ClassBytecodes;
|
||||
@ -296,7 +296,7 @@ class Eval {
|
||||
|
||||
private List<Snippet> processExpression(String userSource, String compileSource) {
|
||||
String name = null;
|
||||
ExpressionInfo ei = typeOfExpression(compileSource);
|
||||
ExpressionInfo ei = ExpressionToTypeInfo.expressionInfo(compileSource, state);
|
||||
ExpressionTree assignVar;
|
||||
Wrap guts;
|
||||
Snippet snip;
|
||||
@ -499,16 +499,6 @@ class Eval {
|
||||
return singletonList(snip);
|
||||
}
|
||||
|
||||
private ExpressionInfo typeOfExpression(String expression) {
|
||||
Wrap guts = Wrap.methodReturnWrap(expression);
|
||||
TaskFactory.AnalyzeTask at = trialCompile(guts);
|
||||
if (!at.hasErrors() && at.firstCuTree() != null) {
|
||||
return TreeDissector.createByFirstClass(at)
|
||||
.typeOfReturnStatement(at, state);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a temp var wrap the expression. TODO make this user configurable.
|
||||
*
|
||||
|
@ -0,0 +1,216 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jshell;
|
||||
|
||||
import com.sun.source.tree.ReturnTree;
|
||||
import com.sun.source.tree.ClassTree;
|
||||
import com.sun.source.tree.CompilationUnitTree;
|
||||
import com.sun.source.tree.ConditionalExpressionTree;
|
||||
import com.sun.source.tree.ExpressionTree;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
import com.sun.source.tree.Tree;
|
||||
import com.sun.source.util.TreePath;
|
||||
import com.sun.source.util.TreePathScanner;
|
||||
import com.sun.tools.javac.code.Symtab;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import com.sun.tools.javac.code.Types;
|
||||
import jdk.jshell.TaskFactory.AnalyzeTask;
|
||||
|
||||
/**
|
||||
* Compute information about an expression string, particularly its type name.
|
||||
*/
|
||||
class ExpressionToTypeInfo {
|
||||
|
||||
private static final String OBJECT_TYPE_NAME = "Object";
|
||||
|
||||
final AnalyzeTask at;
|
||||
final CompilationUnitTree cu;
|
||||
final JShell state;
|
||||
final Symtab syms;
|
||||
final Types types;
|
||||
|
||||
private ExpressionToTypeInfo(AnalyzeTask at, CompilationUnitTree cu, JShell state) {
|
||||
this.at = at;
|
||||
this.cu = cu;
|
||||
this.state = state;
|
||||
this.syms = Symtab.instance(at.context);
|
||||
this.types = Types.instance(at.context);
|
||||
}
|
||||
|
||||
public static class ExpressionInfo {
|
||||
ExpressionTree tree;
|
||||
String typeName;
|
||||
boolean isNonVoid;
|
||||
}
|
||||
|
||||
// return mechanism and other general structure from TreePath.getPath()
|
||||
private static class Result extends Error {
|
||||
|
||||
static final long serialVersionUID = -5942088234594905629L;
|
||||
final TreePath expressionPath;
|
||||
|
||||
Result(TreePath path) {
|
||||
this.expressionPath = path;
|
||||
}
|
||||
}
|
||||
|
||||
private static class PathFinder extends TreePathScanner<TreePath, Boolean> {
|
||||
|
||||
// Optimize out imports etc
|
||||
@Override
|
||||
public TreePath visitCompilationUnit(CompilationUnitTree node, Boolean isTargetContext) {
|
||||
return scan(node.getTypeDecls(), isTargetContext);
|
||||
}
|
||||
|
||||
// Only care about members
|
||||
@Override
|
||||
public TreePath visitClass(ClassTree node, Boolean isTargetContext) {
|
||||
return scan(node.getMembers(), isTargetContext);
|
||||
}
|
||||
|
||||
// Only want the doit method where the code is
|
||||
@Override
|
||||
public TreePath visitMethod(MethodTree node, Boolean isTargetContext) {
|
||||
if (Util.isDoIt(node.getName())) {
|
||||
return scan(node.getBody(), true);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreePath visitReturn(ReturnTree node, Boolean isTargetContext) {
|
||||
ExpressionTree tree = node.getExpression();
|
||||
TreePath tp = new TreePath(getCurrentPath(), tree);
|
||||
if (isTargetContext) {
|
||||
throw new Result(tp);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Type pathToType(TreePath tp) {
|
||||
return (Type) at.trees().getTypeMirror(tp);
|
||||
}
|
||||
|
||||
private Type pathToType(TreePath tp, Tree tree) {
|
||||
if (tree instanceof ConditionalExpressionTree) {
|
||||
// Conditionals always wind up as Object -- this corrects
|
||||
ConditionalExpressionTree cet = (ConditionalExpressionTree) tree;
|
||||
Type tmt = pathToType(new TreePath(tp, cet.getTrueExpression()));
|
||||
Type tmf = pathToType(new TreePath(tp, cet.getFalseExpression()));
|
||||
if (!tmt.isPrimitive() && !tmf.isPrimitive()) {
|
||||
Type lub = types.lub(tmt, tmf);
|
||||
// System.err.printf("cond ? %s : %s -- lub = %s\n",
|
||||
// varTypeName(tmt), varTypeName(tmf), varTypeName(lub));
|
||||
return lub;
|
||||
}
|
||||
}
|
||||
return pathToType(tp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry method: get expression info
|
||||
* @param code the expression as a string
|
||||
* @param state a JShell instance
|
||||
* @return type information
|
||||
*/
|
||||
public static ExpressionInfo expressionInfo(String code, JShell state) {
|
||||
if (code == null || code.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
OuterWrap codeWrap = state.outerMap.wrapInTrialClass(Wrap.methodReturnWrap(code));
|
||||
AnalyzeTask at = state.taskFactory.new AnalyzeTask(codeWrap);
|
||||
CompilationUnitTree cu = at.firstCuTree();
|
||||
if (at.hasErrors() || cu == null) {
|
||||
return null;
|
||||
}
|
||||
return new ExpressionToTypeInfo(at, cu, state).typeOfExpression();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private ExpressionInfo typeOfExpression() {
|
||||
return treeToInfo(findExpressionPath());
|
||||
}
|
||||
|
||||
private TreePath findExpressionPath() {
|
||||
try {
|
||||
new PathFinder().scan(new TreePath(cu), false);
|
||||
} catch (Result result) {
|
||||
return result.expressionPath;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ExpressionInfo treeToInfo(TreePath tp) {
|
||||
if (tp != null) {
|
||||
Tree tree = tp.getLeaf();
|
||||
if (tree instanceof ExpressionTree) {
|
||||
ExpressionInfo ei = new ExpressionInfo();
|
||||
ei.tree = (ExpressionTree) tree;
|
||||
Type type = pathToType(tp, tree);
|
||||
if (type != null) {
|
||||
switch (type.getKind()) {
|
||||
case VOID:
|
||||
case NONE:
|
||||
case ERROR:
|
||||
case OTHER:
|
||||
break;
|
||||
case NULL:
|
||||
ei.isNonVoid = true;
|
||||
ei.typeName = OBJECT_TYPE_NAME;
|
||||
break;
|
||||
default: {
|
||||
ei.isNonVoid = true;
|
||||
ei.typeName = varTypeName(type);
|
||||
if (ei.typeName == null) {
|
||||
ei.typeName = OBJECT_TYPE_NAME;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ei;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String varTypeName(Type type) {
|
||||
try {
|
||||
TypePrinter tp = new VarTypePrinter(at.messages(),
|
||||
state.maps::fullClassNameAndPackageToClass, syms, types);
|
||||
return tp.toString(type);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -105,7 +105,6 @@ import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.collectingAndThen;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
import static java.util.stream.Collectors.toCollection;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
@ -128,6 +127,7 @@ import javax.lang.model.util.Types;
|
||||
import javax.tools.JavaFileManager.Location;
|
||||
import javax.tools.StandardLocation;
|
||||
|
||||
import jdk.jshell.ExpressionToTypeInfo.ExpressionInfo;
|
||||
import static jdk.jshell.Util.REPL_DOESNOTMATTER_CLASS_NAME;
|
||||
import static jdk.jshell.SourceCodeAnalysis.Completeness.DEFINITELY_INCOMPLETE;
|
||||
import static jdk.jshell.TreeDissector.printType;
|
||||
@ -1430,47 +1430,17 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis {
|
||||
|
||||
@Override
|
||||
public String analyzeType(String code, int cursor) {
|
||||
code = code.substring(0, cursor);
|
||||
CompletionInfo completionInfo = analyzeCompletion(code);
|
||||
if (!completionInfo.completeness().isComplete())
|
||||
return null;
|
||||
if (completionInfo.completeness() == Completeness.COMPLETE_WITH_SEMI) {
|
||||
code += ";";
|
||||
}
|
||||
|
||||
OuterWrap codeWrap;
|
||||
switch (guessKind(code)) {
|
||||
case IMPORT: case METHOD: case CLASS: case ENUM:
|
||||
case INTERFACE: case ANNOTATION_TYPE: case VARIABLE:
|
||||
return null;
|
||||
default:
|
||||
codeWrap = proc.outerMap.wrapInTrialClass(Wrap.methodWrap(code));
|
||||
break;
|
||||
}
|
||||
AnalyzeTask at = proc.taskFactory.new AnalyzeTask(codeWrap);
|
||||
SourcePositions sp = at.trees().getSourcePositions();
|
||||
CompilationUnitTree topLevel = at.firstCuTree();
|
||||
int pos = codeWrap.snippetIndexToWrapIndex(code.length());
|
||||
TreePath tp = pathFor(topLevel, sp, pos);
|
||||
while (ExpressionTree.class.isAssignableFrom(tp.getParentPath().getLeaf().getKind().asInterface()) &&
|
||||
tp.getParentPath().getLeaf().getKind() != Kind.ERRONEOUS &&
|
||||
tp.getParentPath().getParentPath() != null)
|
||||
tp = tp.getParentPath();
|
||||
TypeMirror type = at.trees().getTypeMirror(tp);
|
||||
|
||||
if (type == null)
|
||||
return null;
|
||||
|
||||
switch (type.getKind()) {
|
||||
case ERROR: case NONE: case OTHER:
|
||||
case PACKAGE: case VOID:
|
||||
return null; //not usable
|
||||
case NULL:
|
||||
type = at.getElements().getTypeElement("java.lang.Object").asType();
|
||||
break;
|
||||
}
|
||||
|
||||
return TreeDissector.printType(at, proc, type);
|
||||
ExpressionInfo ei = ExpressionToTypeInfo.expressionInfo(code, proc);
|
||||
return (ei == null || !ei.isNonVoid)
|
||||
? null
|
||||
: ei.typeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -321,7 +321,7 @@ class TaskFactory {
|
||||
final JavacTaskImpl task;
|
||||
private DiagList diags = null;
|
||||
private final SourceHandler<?> sourceHandler;
|
||||
private final Context context = new Context();
|
||||
final Context context = new Context();
|
||||
private Types types;
|
||||
private JavacMessages messages;
|
||||
private Trees trees;
|
||||
|
@ -28,14 +28,11 @@ package jdk.jshell;
|
||||
|
||||
import com.sun.source.tree.ClassTree;
|
||||
import com.sun.source.tree.CompilationUnitTree;
|
||||
import com.sun.source.tree.ExpressionTree;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
import com.sun.source.tree.ReturnTree;
|
||||
import com.sun.source.tree.StatementTree;
|
||||
import com.sun.source.tree.Tree;
|
||||
import com.sun.source.tree.VariableTree;
|
||||
import com.sun.source.util.SourcePositions;
|
||||
import com.sun.source.util.TreePath;
|
||||
import com.sun.source.util.Trees;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import com.sun.tools.javac.code.Type.MethodType;
|
||||
@ -47,7 +44,6 @@ import jdk.jshell.TaskFactory.AnalyzeTask;
|
||||
import jdk.jshell.Wrap.Range;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
@ -61,16 +57,6 @@ import jdk.jshell.Util.Pair;
|
||||
|
||||
class TreeDissector {
|
||||
|
||||
private static final String OBJECT_TYPE = "Object";
|
||||
|
||||
static class ExpressionInfo {
|
||||
|
||||
boolean isNonVoid;
|
||||
String typeName;
|
||||
ExpressionTree tree;
|
||||
String signature;
|
||||
}
|
||||
|
||||
private final TaskFactory.BaseTask bt;
|
||||
private final ClassTree targetClass;
|
||||
private final CompilationUnitTree targetCompilationUnit;
|
||||
@ -219,41 +205,6 @@ class TreeDissector {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
ExpressionInfo typeOfReturnStatement(AnalyzeTask at, JShell state) {
|
||||
ExpressionInfo ei = new ExpressionInfo();
|
||||
Tree unitTree = firstStatement();
|
||||
if (unitTree instanceof ReturnTree) {
|
||||
ei.tree = ((ReturnTree) unitTree).getExpression();
|
||||
if (ei.tree != null) {
|
||||
TreePath viPath = trees().getPath(targetCompilationUnit, ei.tree);
|
||||
if (viPath != null) {
|
||||
TypeMirror tm = trees().getTypeMirror(viPath);
|
||||
if (tm != null) {
|
||||
ei.typeName = printType(at, state, tm);
|
||||
switch (tm.getKind()) {
|
||||
case VOID:
|
||||
case NONE:
|
||||
case ERROR:
|
||||
case OTHER:
|
||||
break;
|
||||
case NULL:
|
||||
ei.isNonVoid = true;
|
||||
ei.typeName = OBJECT_TYPE;
|
||||
break;
|
||||
default: {
|
||||
ei.isNonVoid = true;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ei;
|
||||
}
|
||||
|
||||
String typeOfMethod(MethodSnippet msn) {
|
||||
Tree unitTree = method(msn);
|
||||
if (unitTree instanceof JCMethodDecl) {
|
||||
@ -274,8 +225,13 @@ class TreeDissector {
|
||||
|
||||
public static String printType(AnalyzeTask at, JShell state, TypeMirror type) {
|
||||
Type typeImpl = (Type) type;
|
||||
TypePrinter tp = new TypePrinter(at.messages(), state.maps::fullClassNameAndPackageToClass, typeImpl);
|
||||
return tp.visit(typeImpl, Locale.getDefault());
|
||||
try {
|
||||
TypePrinter tp = new TypePrinter(at.messages(),
|
||||
state.maps::fullClassNameAndPackageToClass);
|
||||
return tp.toString(typeImpl);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,6 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jshell;
|
||||
|
||||
import static com.sun.tools.javac.code.Flags.COMPOUND;
|
||||
@ -41,17 +40,21 @@ import java.util.function.BinaryOperator;
|
||||
* Print types in source form.
|
||||
*/
|
||||
class TypePrinter extends Printer {
|
||||
|
||||
private static final String OBJECT = "Object";
|
||||
|
||||
private final JavacMessages messages;
|
||||
private final BinaryOperator<String> fullClassNameAndPackageToClass;
|
||||
private boolean useWildCard = false;
|
||||
|
||||
TypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass, Type typeToPrint) {
|
||||
TypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass) {
|
||||
this.messages = messages;
|
||||
this.fullClassNameAndPackageToClass = fullClassNameAndPackageToClass;
|
||||
}
|
||||
|
||||
String toString(Type t) {
|
||||
return visit(t, Locale.getDefault());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String localize(Locale locale, String key, Object... args) {
|
||||
return messages.getLocalizedString(locale, key, args);
|
||||
@ -67,18 +70,6 @@ class TypePrinter extends Printer {
|
||||
return visit(t.wildcard, locale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitWildcardType(Type.WildcardType wt, Locale locale) {
|
||||
if (useWildCard) { // at TypeArgument(ex: List<? extends T>)
|
||||
return super.visitWildcardType(wt, locale);
|
||||
} else { // at TopLevelType(ex: ? extends List<T>, ? extends Number[][])
|
||||
Type extendsBound = wt.getExtendsBound();
|
||||
return extendsBound == null
|
||||
? OBJECT
|
||||
: visit(extendsBound, locale);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitType(Type t, Locale locale) {
|
||||
String s = (t.tsym == null || t.tsym.name == null)
|
||||
@ -87,20 +78,9 @@ class TypePrinter extends Printer {
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitClassType(ClassType ct, Locale locale) {
|
||||
boolean prevUseWildCard = useWildCard;
|
||||
try {
|
||||
useWildCard = true;
|
||||
return super.visitClassType(ct, locale);
|
||||
} finally {
|
||||
useWildCard = prevUseWildCard;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a class name into a (possibly localized) string. Anonymous
|
||||
* inner classes get converted into a localized string.
|
||||
* Converts a class name into a (possibly localized) string. Anonymous inner
|
||||
* classes get converted into a localized string.
|
||||
*
|
||||
* @param t the type of the class whose name is to be rendered
|
||||
* @param longform if set, the class' fullname is displayed - if unset the
|
||||
@ -112,21 +92,13 @@ class TypePrinter extends Printer {
|
||||
protected String className(ClassType t, boolean longform, Locale locale) {
|
||||
Symbol sym = t.tsym;
|
||||
if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
|
||||
/***
|
||||
StringBuilder s = new StringBuilder(visit(t.supertype_field, locale));
|
||||
for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) {
|
||||
s.append('&');
|
||||
s.append(visit(is.head, locale));
|
||||
}
|
||||
return s.toString();
|
||||
***/
|
||||
return OBJECT;
|
||||
} else if (sym.name.length() == 0) {
|
||||
// Anonymous
|
||||
String s;
|
||||
ClassType norm = (ClassType) t.tsym.type;
|
||||
if (norm == null) {
|
||||
s = "object";
|
||||
s = OBJECT;
|
||||
} else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
|
||||
s = visit(norm.interfaces_field.head, locale);
|
||||
} else {
|
||||
@ -160,7 +132,7 @@ class TypePrinter extends Printer {
|
||||
@Override
|
||||
public String visitPackageSymbol(PackageSymbol s, Locale locale) {
|
||||
return s.isUnnamed()
|
||||
? "" // Unnamed package
|
||||
? "" // Unnamed package
|
||||
: s.fullname.toString();
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ import static java.util.stream.Collectors.toList;
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_EVNT;
|
||||
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
|
||||
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_WRAP;
|
||||
import static jdk.jshell.Snippet.Status.OVERWRITTEN;
|
||||
import static jdk.jshell.Snippet.Status.RECOVERABLE_DEFINED;
|
||||
import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
|
||||
@ -180,6 +181,8 @@ final class Unit {
|
||||
.collect(toList());
|
||||
// Set the outer wrap for this snippet
|
||||
si.setOuterWrap(state.outerMap.wrapInClass(except, plus, snippets, wraps));
|
||||
state.debug(DBG_WRAP, "++setWrap() %s\n%s\n",
|
||||
si, si.outerWrap().wrapped());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,265 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jshell;
|
||||
|
||||
import java.util.HashSet;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import com.sun.tools.javac.code.Type.ClassType;
|
||||
import com.sun.tools.javac.util.JavacMessages;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.function.BinaryOperator;
|
||||
import com.sun.tools.javac.code.BoundKind;
|
||||
import com.sun.tools.javac.code.Flags;
|
||||
import com.sun.tools.javac.code.Symtab;
|
||||
import com.sun.tools.javac.code.Type.CapturedType;
|
||||
import com.sun.tools.javac.code.Type.TypeMapping;
|
||||
import com.sun.tools.javac.code.Type.TypeVar;
|
||||
import com.sun.tools.javac.code.Type.WildcardType;
|
||||
import com.sun.tools.javac.code.Types;
|
||||
import com.sun.tools.javac.code.Types.SimpleVisitor;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import static com.sun.tools.javac.code.BoundKind.EXTENDS;
|
||||
import static com.sun.tools.javac.code.BoundKind.SUPER;
|
||||
import static com.sun.tools.javac.code.BoundKind.UNBOUND;
|
||||
import static com.sun.tools.javac.code.Type.ArrayType;
|
||||
import static com.sun.tools.javac.code.TypeTag.BOT;
|
||||
import static com.sun.tools.javac.code.TypeTag.WILDCARD;
|
||||
|
||||
/**
|
||||
* Print variable types in source form.
|
||||
* TypeProjection and CaptureScanner are copied from Types in the JEP-286
|
||||
* Sandbox by Maurizio. The checks for Non-Denotable in TypePrinter are
|
||||
* cribbed from denotableChecker of the same source.
|
||||
*
|
||||
* @author Maurizio Cimadamore
|
||||
* @author Robert Field
|
||||
*/
|
||||
class VarTypePrinter extends TypePrinter {
|
||||
private static final String WILD = "?";
|
||||
|
||||
private final Symtab syms;
|
||||
private final Types types;
|
||||
|
||||
VarTypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass,
|
||||
Symtab syms, Types types) {
|
||||
super(messages, fullClassNameAndPackageToClass);
|
||||
this.syms = syms;
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
@Override
|
||||
String toString(Type t) {
|
||||
return super.toString(upward(t));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitTypeVar(TypeVar t, Locale locale) {
|
||||
/* Any type variable mentioned in the inferred type must have been declared as a type parameter
|
||||
(i.e cannot have been produced by inference (18.4))
|
||||
*/
|
||||
// and beyond that, there are no global type vars, so if there are any
|
||||
// type variables left, they need to be eliminated
|
||||
return WILD; // Non-denotable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitCapturedType(CapturedType t, Locale locale) {
|
||||
/* Any type variable mentioned in the inferred type must have been declared as a type parameter
|
||||
(i.e cannot have been produced by capture conversion (5.1.10))
|
||||
*/
|
||||
return WILD; // Non-denotable
|
||||
}
|
||||
|
||||
public Type upward(Type t) {
|
||||
List<Type> captures = captures(t);
|
||||
return upward(t, captures);
|
||||
}
|
||||
|
||||
/************* Following from JEP-286 Types.java ***********/
|
||||
|
||||
public Type upward(Type t, List<Type> vars) {
|
||||
return t.map(new TypeProjection(vars), true);
|
||||
}
|
||||
|
||||
public List<Type> captures(Type t) {
|
||||
CaptureScanner cs = new CaptureScanner();
|
||||
Set<Type> captures = new HashSet<>();
|
||||
cs.visit(t, captures);
|
||||
return List.from(captures);
|
||||
}
|
||||
|
||||
class CaptureScanner extends SimpleVisitor<Void, Set<Type>> {
|
||||
|
||||
@Override
|
||||
public Void visitType(Type t, Set<Type> types) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitClassType(ClassType t, Set<Type> seen) {
|
||||
if (t.isCompound()) {
|
||||
types.directSupertypes(t).forEach(s -> visit(s, seen));
|
||||
} else {
|
||||
t.allparams().forEach(ta -> visit(ta, seen));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitArrayType(ArrayType t, Set<Type> seen) {
|
||||
return visit(t.elemtype, seen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitWildcardType(WildcardType t, Set<Type> seen) {
|
||||
visit(t.type, seen);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitTypeVar(TypeVar t, Set<Type> seen) {
|
||||
if ((t.tsym.flags() & Flags.SYNTHETIC) != 0 && seen.add(t)) {
|
||||
visit(t.getUpperBound(), seen);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visitCapturedType(CapturedType t, Set<Type> seen) {
|
||||
if (seen.add(t)) {
|
||||
visit(t.getUpperBound(), seen);
|
||||
visit(t.getLowerBound(), seen);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class TypeProjection extends TypeMapping<Boolean> {
|
||||
|
||||
List<Type> vars;
|
||||
Set<Type> seen = new HashSet<>();
|
||||
|
||||
public TypeProjection(List<Type> vars) {
|
||||
this.vars = vars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type visitClassType(ClassType t, Boolean upward) {
|
||||
if (upward && !t.isCompound() && t.tsym.name.isEmpty()) {
|
||||
//lift anonymous class type to first supertype (class or interface)
|
||||
return types.directSupertypes(t).last();
|
||||
} else if (t.isCompound()) {
|
||||
List<Type> components = types.directSupertypes(t);
|
||||
List<Type> components1 = components.map(c -> c.map(this, upward));
|
||||
if (components == components1) return t;
|
||||
else return types.makeIntersectionType(components1);
|
||||
} else {
|
||||
Type outer = t.getEnclosingType();
|
||||
Type outer1 = visit(outer, upward);
|
||||
List<Type> typarams = t.getTypeArguments();
|
||||
List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, upward));
|
||||
if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
|
||||
//not defined
|
||||
return syms.botType;
|
||||
}
|
||||
if (outer1 == outer && typarams1 == typarams) return t;
|
||||
else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
|
||||
@Override
|
||||
protected boolean needsStripping() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected Type makeWildcard(Type upper, Type lower) {
|
||||
BoundKind bk;
|
||||
Type bound;
|
||||
if (upper.hasTag(BOT)) {
|
||||
upper = syms.objectType;
|
||||
}
|
||||
boolean isUpperObject = types.isSameType(upper, syms.objectType);
|
||||
if (!lower.hasTag(BOT) && isUpperObject) {
|
||||
bound = lower;
|
||||
bk = SUPER;
|
||||
} else {
|
||||
bound = upper;
|
||||
bk = isUpperObject ? UNBOUND : EXTENDS;
|
||||
}
|
||||
return new WildcardType(bound, bk, syms.boundClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type visitTypeVar(TypeVar t, Boolean upward) {
|
||||
if (vars.contains(t)) {
|
||||
try {
|
||||
if (seen.add(t)) {
|
||||
return (upward ?
|
||||
t.getUpperBound() :
|
||||
(t.getLowerBound() == null) ?
|
||||
syms.botType :
|
||||
t.getLowerBound())
|
||||
.map(this, upward);
|
||||
} else {
|
||||
//cycle
|
||||
return syms.objectType;
|
||||
}
|
||||
} finally {
|
||||
seen.remove(t);
|
||||
}
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type visitWildcardType(WildcardType wt, Boolean upward) {
|
||||
if (upward) {
|
||||
return wt.isExtendsBound() ?
|
||||
wt.type.map(this, upward) :
|
||||
syms.objectType;
|
||||
} else {
|
||||
return wt.isSuperBound() ?
|
||||
wt.type.map(this, upward) :
|
||||
syms.botType;
|
||||
}
|
||||
}
|
||||
|
||||
private Type mapTypeArgument(Type t, boolean upward) {
|
||||
if (!t.containsAny(vars)) {
|
||||
return t;
|
||||
} else if (!t.hasTag(WILDCARD) && !upward) {
|
||||
//not defined
|
||||
return syms.botType;
|
||||
} else {
|
||||
Type upper = t.map(this, upward);
|
||||
Type lower = t.map(this, !upward);
|
||||
return makeWildcard(upper, lower);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -114,12 +114,6 @@ class DefaultLoaderDelegate implements LoaderDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClasspath(String path)
|
||||
throws EngineTerminationException, InternalException {
|
||||
throw new NotImplementedException("setClasspath: Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> findClass(String name) throws ClassNotFoundException {
|
||||
Class<?> klass = klasses.get(name);
|
||||
|
@ -131,12 +131,6 @@ public class DirectExecutionControl implements ExecutionControl {
|
||||
loaderDelegate.addToClasspath(cp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClasspath(String path)
|
||||
throws EngineTerminationException, InternalException {
|
||||
loaderDelegate.setClasspath(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
|
@ -147,12 +147,6 @@ class ExecutionControlForwarder {
|
||||
ec.addToClasspath(cp);
|
||||
return writeSuccess();
|
||||
}
|
||||
case CMD_SET_CLASSPATH: {
|
||||
// Set the claspath
|
||||
String cp = in.readUTF();
|
||||
ec.setClasspath(cp);
|
||||
return writeSuccess();
|
||||
}
|
||||
case CMD_STOP: {
|
||||
// Stop the current execution
|
||||
try {
|
||||
|
@ -59,16 +59,6 @@ public interface LoaderDelegate {
|
||||
void addToClasspath(String path)
|
||||
throws EngineTerminationException, InternalException;
|
||||
|
||||
/**
|
||||
* Sets the execution class path to the specified path.
|
||||
*
|
||||
* @param path the path to add
|
||||
* @throws EngineTerminationException the execution engine has terminated
|
||||
* @throws InternalException an internal problem occurred
|
||||
*/
|
||||
void setClasspath(String path)
|
||||
throws EngineTerminationException, InternalException;
|
||||
|
||||
/**
|
||||
* Finds the class with the specified binary name.
|
||||
*
|
||||
|
@ -65,10 +65,6 @@ class RemoteCodes {
|
||||
* Add to the class-path.
|
||||
*/
|
||||
static final String CMD_ADD_CLASSPATH = "CMD_ADD_CLASSPATH";
|
||||
/**
|
||||
* Set the class-path.
|
||||
*/
|
||||
static final String CMD_SET_CLASSPATH = "CMD_SET_CLASSPATH";
|
||||
/**
|
||||
* Stop an invoke.
|
||||
*/
|
||||
|
@ -136,21 +136,6 @@ public class StreamingExecutionControl implements ExecutionControl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClasspath(String path)
|
||||
throws EngineTerminationException, InternalException {
|
||||
try {
|
||||
// Send the classpath addition command to the remote agent.
|
||||
writeCommand(CMD_SET_CLASSPATH);
|
||||
out.writeUTF(path);
|
||||
out.flush();
|
||||
// Retrieve and report results from the remote agent.
|
||||
readAndReportClassSimpleResult();
|
||||
} catch (IOException ex) {
|
||||
throw new EngineTerminationException("Exception writing remote set classpath: " + ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
throws EngineTerminationException, InternalException {
|
||||
|
@ -117,16 +117,6 @@ public interface ExecutionControl extends AutoCloseable {
|
||||
void addToClasspath(String path)
|
||||
throws EngineTerminationException, InternalException;
|
||||
|
||||
/**
|
||||
* Sets the execution class path to the specified path.
|
||||
*
|
||||
* @param path the path to add
|
||||
* @throws EngineTerminationException the execution engine has terminated
|
||||
* @throws InternalException an internal problem occurred
|
||||
*/
|
||||
void setClasspath(String path)
|
||||
throws EngineTerminationException, InternalException;
|
||||
|
||||
/**
|
||||
* Interrupts a running invoke.
|
||||
*
|
||||
|
@ -99,7 +99,6 @@ public class KullaTesting {
|
||||
|
||||
private Map<String, Snippet> idToSnippet = new LinkedHashMap<>();
|
||||
private Set<Snippet> allSnippets = new LinkedHashSet<>();
|
||||
private List<String> classpath;
|
||||
|
||||
static {
|
||||
JShell js = JShell.create();
|
||||
@ -159,7 +158,6 @@ public class KullaTesting {
|
||||
}
|
||||
|
||||
public void addToClasspath(String path) {
|
||||
classpath.add(path);
|
||||
getState().addToClasspath(path);
|
||||
}
|
||||
|
||||
@ -200,7 +198,6 @@ public class KullaTesting {
|
||||
state = builder.build();
|
||||
allSnippets = new LinkedHashSet<>();
|
||||
idToSnippet = new LinkedHashMap<>();
|
||||
classpath = new ArrayList<>();
|
||||
}
|
||||
|
||||
@AfterMethod
|
||||
@ -210,7 +207,6 @@ public class KullaTesting {
|
||||
analysis = null;
|
||||
allSnippets = null;
|
||||
idToSnippet = null;
|
||||
classpath = null;
|
||||
}
|
||||
|
||||
public ClassLoader createAndRunFromModule(String moduleName, Path modPath) {
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8171385
|
||||
* @summary Test JShell#stop
|
||||
* @modules jdk.jshell/jdk.internal.jshell.tool
|
||||
* @build KullaTesting TestingInputStream
|
||||
@ -30,9 +31,13 @@
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PipedInputStream;
|
||||
import java.io.PipedOutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import jdk.internal.jshell.tool.StopDetectingInputStream;
|
||||
import jdk.internal.jshell.tool.StopDetectingInputStream.State;
|
||||
@ -128,4 +133,31 @@ public class StopExecutionTest extends KullaTesting {
|
||||
}
|
||||
}
|
||||
|
||||
public void testStopDetectingInputBufferWaitStop() throws Exception {
|
||||
Runnable shouldNotHappenRun =
|
||||
() -> { throw new AssertionError("Should not happen."); };
|
||||
Consumer<Exception> shouldNotHappenExc =
|
||||
exc -> { throw new AssertionError("Should not happen.", exc); };
|
||||
StopDetectingInputStream sd = new StopDetectingInputStream(shouldNotHappenRun, shouldNotHappenExc);
|
||||
CountDownLatch reading = new CountDownLatch(1);
|
||||
PipedInputStream is = new PipedInputStream() {
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
reading.countDown();
|
||||
return super.read();
|
||||
}
|
||||
};
|
||||
PipedOutputStream os = new PipedOutputStream(is);
|
||||
|
||||
sd.setInputStream(is);
|
||||
sd.setState(State.BUFFER);
|
||||
reading.await();
|
||||
sd.setState(State.WAIT);
|
||||
os.write(3);
|
||||
int value = sd.read();
|
||||
|
||||
if (value != 3) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,81 +23,229 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8144903
|
||||
* @bug 8144903 8171981
|
||||
* @summary Tests for determining the type from the expression
|
||||
* @build KullaTesting TestingInputStream
|
||||
* @run testng TypeNameTest
|
||||
*/
|
||||
|
||||
import jdk.jshell.Snippet;
|
||||
import jdk.jshell.VarSnippet;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static jdk.jshell.Snippet.Status.VALID;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
@Test
|
||||
public class TypeNameTest extends KullaTesting {
|
||||
|
||||
public void testReplClassName() {
|
||||
assertEval("class C {}");
|
||||
VarSnippet sn = (VarSnippet) varKey(assertEval("new C();"));
|
||||
assertEquals(sn.typeName(), "C");
|
||||
|
||||
private void assertType(String expr, String type) {
|
||||
assertEquals(varKey(assertEval(expr)).typeName(), type);
|
||||
assertInferredType(expr, type);
|
||||
}
|
||||
|
||||
public void testTypeInference() {
|
||||
assertEval("import java.util.List;");
|
||||
assertEval("import java.util.ArrayList;");
|
||||
assertEval("import java.util.Arrays;");
|
||||
|
||||
assertType("new Object().getClass().getSuperclass() ", "Class<?>");
|
||||
assertType("new ArrayList().getClass().getSuperclass()", "Class<?>");
|
||||
assertType("new ArrayList().getClass()", "Class<? extends ArrayList>");
|
||||
assertType("ArrayList.class", "Class<ArrayList>");
|
||||
assertType("ArrayList.class.getSuperclass()", "Class<? super ArrayList>");
|
||||
|
||||
assertEval("class D<T extends CharSequence> { D<? super T> getS() { return null; } }");
|
||||
assertEval("D<?> d = new D<String>();");
|
||||
assertType("d.getS()", "D<? extends CharSequence>");
|
||||
assertType("null", "Object");
|
||||
assertType("Class.forName( \"java.util.ArrayList\" )", "Class<?>");
|
||||
assertType("new ArrayList<Boolean>() {}", "ArrayList<Boolean>");
|
||||
assertType("new ArrayList<String>().stream()", "java.util.stream.Stream<String>");
|
||||
assertType("Arrays.asList( 1, 2, 3)", "List<Integer>");
|
||||
assertType("new ArrayList().getClass().getClass()", "Class<? extends Class>");
|
||||
|
||||
assertEval("interface A {}");
|
||||
assertEval("interface I {}");
|
||||
assertEval("interface J extends A, I {}");
|
||||
assertEval("interface K extends A, I {}");
|
||||
assertEval("class P<T extends A & I> {}");
|
||||
assertType("(P<?>) null", "P<? extends Object>");
|
||||
}
|
||||
|
||||
public void testConditionals() {
|
||||
assertEval("import java.util.List;");
|
||||
assertEval("import java.util.ArrayList;");
|
||||
assertEval("import java.util.Arrays;");
|
||||
|
||||
assertEval("CharSequence cs = \"hi\";");
|
||||
assertEval("String st = \"low\";");
|
||||
assertEval("boolean b;");
|
||||
assertType("b? cs : st", "CharSequence");
|
||||
|
||||
assertEval("List<String> l1 = Arrays.asList(\"hi\");");
|
||||
assertEval("List<? extends String> l2 = Arrays.asList(\"po\");");
|
||||
assertType("b? l1.get(0) : l2.get(0)", "String");
|
||||
|
||||
assertEval("class X {}");
|
||||
assertEval("class B extends X {}");
|
||||
assertEval("class C extends X {}");
|
||||
assertType("b? new B() : new C()", "X");
|
||||
}
|
||||
|
||||
public void testJEP286NonDenotable() {
|
||||
assertEval("import java.util.List;");
|
||||
assertEval("import java.util.Arrays;");
|
||||
assertEval("import java.util.Iterator;");
|
||||
|
||||
assertEval("List<? extends String> extString() { return Arrays.asList( \"hi\", \"low\" ); }");
|
||||
assertEval("List<? super String> supString() { return Arrays.asList( \"hi\", \"low\" ); }");
|
||||
assertEval("List<?> unbString() { return Arrays.asList( \"hi\", \"low\" ); }");
|
||||
assertEval("List<? extends String>[] extStringArr() {" +
|
||||
" @SuppressWarnings(\"unchecked\") " +
|
||||
"List<? extends String>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
|
||||
assertEval("List<? super String>[] supStringArr() {" +
|
||||
" @SuppressWarnings(\"unchecked\") " +
|
||||
"List<? super String>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
|
||||
assertEval("List<?>[] unbStringArr() {" +
|
||||
" @SuppressWarnings(\"unchecked\") " +
|
||||
"List<?>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
|
||||
assertEval("Iterable<? extends List<? extends String>> extStringIter() {" +
|
||||
"return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
|
||||
assertEval("Iterable<? extends List<? super String>> supStringIter() {" +
|
||||
"return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
|
||||
assertEval("Iterable<? extends List<?>> unbStringIter() {" +
|
||||
"return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
|
||||
assertType("extString()", "List<? extends String>");
|
||||
assertType("extString().get(0)", "String");
|
||||
assertType("supString()", "List<? super String>");
|
||||
assertType("supString().get(0)", "Object");
|
||||
assertType("unbString()", "List<?>");
|
||||
assertType("unbString().get(0)", "Object");
|
||||
assertType("supStringArr()", "List<? super String>[]");
|
||||
assertType("supStringArr()[0]", "List<? super String>");
|
||||
assertType("supStringArr()[0].get(0)", "Object");
|
||||
assertType("unbStringArr()", "List<?>[]");
|
||||
assertType("unbStringArr()[0]", "List<?>");
|
||||
assertType("unbStringArr()[0].get(0)", "Object");
|
||||
assertType("extStringIter()", "Iterable<? extends List<? extends String>>");
|
||||
assertType("extStringIter().iterator()", "Iterator<? extends List<? extends String>>");
|
||||
assertType("extStringIter().iterator().next()", "List<? extends String>");
|
||||
assertType("extStringIter().iterator().next().get(0)", "String");
|
||||
assertType("supStringIter()", "Iterable<? extends List<? super String>>");
|
||||
assertType("supStringIter().iterator()", "Iterator<? extends List<? super String>>");
|
||||
assertType("supStringIter().iterator().next()", "List<? super String>");
|
||||
assertType("supStringIter().iterator().next().get(0)", "Object");
|
||||
assertType("unbStringIter()", "Iterable<? extends List<?>>");
|
||||
assertType("unbStringIter().iterator()", "Iterator<? extends List<?>>");
|
||||
assertType("unbStringIter().iterator().next()", "List<?>");
|
||||
assertType("unbStringIter().iterator().next().get(0)", "Object");
|
||||
}
|
||||
|
||||
public void testJEP286NonDenotable2() {
|
||||
assertEval("import java.util.List;");
|
||||
assertEval("import java.util.Arrays;");
|
||||
assertEval("import java.lang.reflect.Array;");
|
||||
|
||||
assertEval("<Z extends Comparable<Z>> List<? extends Z> extFbound() {" +
|
||||
"return Arrays.asList( (Z)null ); }");
|
||||
assertEval("<Z extends Comparable<Z>> List<? super Z> supFbound() {" +
|
||||
"return Arrays.asList( (Z)null ); }");
|
||||
assertEval("<Z extends Comparable<Z>> List<? extends Z>[] extFboundArr() {" +
|
||||
"@SuppressWarnings(\"unchecked\")" +
|
||||
"List<? extends Z>[] a = new List[1]; a[0] = Arrays.asList( (Z)null ); return a; }");
|
||||
assertEval("<Z extends Comparable<Z>> List<? super Z>[] supFboundArr() {" +
|
||||
"@SuppressWarnings(\"unchecked\")" +
|
||||
"List<? super Z>[] a = new List[1]; a[0] = Arrays.asList( (Z)null ); return a; }");
|
||||
assertEval("<Z extends Comparable<Z>> Iterable<? extends List<? extends Z>> extFboundIter() {" +
|
||||
"return Arrays.asList( Arrays.asList( (Z)null ) ); }");
|
||||
assertEval("<Z extends Comparable<Z>> Iterable<? extends List<? super Z>> supFboundIter() {" +
|
||||
"return Arrays.asList( Arrays.asList( (Z)null ) ); }");
|
||||
assertEval("<Z> List<Z> listOf(Z z) { return Arrays.asList( z ); }");
|
||||
assertEval("<Z> Z[] arrayOf(Z z) {" +
|
||||
"@SuppressWarnings(\"unchecked\")" +
|
||||
"final Z[] a = (Z[]) Array.newInstance(z.getClass(), 1); a[0] = z; return a; }");
|
||||
assertType("extFbound()", "List<? extends Comparable<?>>");
|
||||
assertType("extFbound().get(0)", "Comparable<?>");
|
||||
assertType("supFbound()", "List<?>");
|
||||
assertType("supFbound().get(0)", "Object");
|
||||
assertType("extFboundArr()", "List<? extends Comparable<?>>[]");
|
||||
assertType("extFboundArr()[0]", "List<? extends Comparable<?>>");
|
||||
assertType("extFboundArr()[0].get(0)", "Comparable<?>");
|
||||
assertType("supFboundArr()", "List<?>[]");
|
||||
assertType("supFboundArr()[0]", "List<?>");
|
||||
assertType("supFboundArr()[0].get(0)", "Object");
|
||||
assertType("extFboundIter()", "Iterable<? extends List<? extends Comparable<?>>>");
|
||||
assertType("extFboundIter().iterator()", "java.util.Iterator<? extends List<? extends Comparable<?>>>");
|
||||
assertType("extFboundIter().iterator().next()", "List<? extends Comparable<?>>");
|
||||
assertType("extFboundIter().iterator().next().get(0)", "Comparable<?>");
|
||||
assertType("supFboundIter()", "Iterable<? extends List<?>>");
|
||||
assertType("supFboundIter().iterator()", "java.util.Iterator<? extends List<?>>");
|
||||
assertType("supFboundIter().iterator().next()", "List<?>");
|
||||
assertType("supFboundIter().iterator().next().get(0)", "Object");
|
||||
assertType("listOf(23)", "List<Integer>");
|
||||
assertType("listOf(true)", "List<Boolean>");
|
||||
assertType("listOf(true).get(0)", "Boolean");
|
||||
assertType("arrayOf(99)", "Integer[]");
|
||||
assertType("arrayOf(99)[0]", "Integer");
|
||||
|
||||
assertEval("<Z> Z choose(Z z1, Z z2) { return z1; }");
|
||||
assertType("choose(1, 1L);", "Object");
|
||||
}
|
||||
|
||||
public void testVariableTypeName() {
|
||||
assertType("\"x\"", "String");
|
||||
|
||||
assertType("java.util.regex.Pattern.compile(\"x\")", "java.util.regex.Pattern");
|
||||
assertEval("import java.util.regex.*;");
|
||||
assertType("java.util.regex.Pattern.compile(\"x\")", "Pattern");
|
||||
|
||||
assertType("new java.util.ArrayList()", "java.util.ArrayList");
|
||||
assertEval("import java.util.ArrayList;");
|
||||
assertType("new java.util.ArrayList()", "ArrayList");
|
||||
|
||||
assertType("java.util.Locale.Category.FORMAT", "java.util.Locale.Category");
|
||||
assertEval("import static java.util.Locale.Category;");
|
||||
assertType("java.util.Locale.Category.FORMAT", "Category");
|
||||
}
|
||||
|
||||
public void testReplNestedClassName() {
|
||||
assertEval("class D { static class E {} }");
|
||||
VarSnippet sn = (VarSnippet) varKey(assertEval("new D.E();"));
|
||||
assertEquals(sn.typeName(), "D.E");
|
||||
assertType("new D.E();", "D.E");
|
||||
}
|
||||
|
||||
public void testAnonymousClassName() {
|
||||
assertEval("class C {}");
|
||||
VarSnippet sn = (VarSnippet) varKey(assertEval("new C() { int x; };"));
|
||||
assertEquals(sn.typeName(), "C");
|
||||
assertType("new C();", "C");
|
||||
assertType("new C() { int x; };", "C");
|
||||
}
|
||||
|
||||
public void testCapturedTypeName() {
|
||||
VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass();"));
|
||||
assertEquals(sn.typeName(), "Class<? extends String>");
|
||||
}
|
||||
|
||||
public void testArrayTypeOfCapturedTypeName() {
|
||||
VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass().getEnumConstants();"));
|
||||
assertEquals(sn.typeName(), "String[]");
|
||||
assertType("\"\".getClass();", "Class<? extends String>");
|
||||
assertType("\"\".getClass().getEnumConstants();", "String[]");
|
||||
}
|
||||
|
||||
public void testJavaLang() {
|
||||
VarSnippet sn = (VarSnippet) varKey(assertEval("\"\";"));
|
||||
assertEquals(sn.typeName(), "String");
|
||||
assertType("\"\";", "String");
|
||||
}
|
||||
|
||||
public void testNotOverEagerPackageEating() {
|
||||
VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass().getDeclaredMethod(\"hashCode\");"));
|
||||
assertEquals(sn.typeName(), "java.lang.reflect.Method");
|
||||
assertType("\"\".getClass().getDeclaredMethod(\"hashCode\");", "java.lang.reflect.Method");
|
||||
}
|
||||
|
||||
public void testBounds() {
|
||||
assertEval("java.util.List<? extends String> list1 = java.util.Arrays.asList(\"\");");
|
||||
VarSnippet sn1 = (VarSnippet) varKey(assertEval("list1.iterator().next()"));
|
||||
assertEquals(sn1.typeName(), "String");
|
||||
assertType("list1.iterator().next()", "String");
|
||||
assertEval("java.util.List<? super String> list2 = java.util.Arrays.asList(\"\");");
|
||||
VarSnippet sn2 = (VarSnippet) varKey(assertEval("list2.iterator().next()"));
|
||||
assertEquals(sn2.typeName(), "Object");
|
||||
assertType("list2.iterator().next()", "Object");
|
||||
assertEval("java.util.List<?> list3 = java.util.Arrays.asList(\"\");");
|
||||
VarSnippet sn3 = (VarSnippet) varKey(assertEval("list3.iterator().next()"));
|
||||
assertEquals(sn3.typeName(), "Object");
|
||||
assertType("list3.iterator().next()", "Object");
|
||||
assertEval("class Test1<X extends CharSequence> { public X get() { return null; } }");
|
||||
Snippet x = varKey(assertEval("Test1<?> test1 = new Test1<>();"));
|
||||
VarSnippet sn4 = (VarSnippet) varKey(assertEval("test1.get()"));
|
||||
assertEquals(sn4.typeName(), "Object");
|
||||
assertEval("Test1<?> test1 = new Test1<>();");
|
||||
assertType("test1.get()", "CharSequence");
|
||||
assertEval("class Test2<X extends Number & CharSequence> { public X get() { return null; } }");
|
||||
assertEval("Test2<?> test2 = new Test2<>();");
|
||||
VarSnippet sn5 = (VarSnippet) varKey(assertEval("test2.get()"));
|
||||
assertEquals(sn5.typeName(), "Object");
|
||||
assertEval("class Test3<T> { T[][] get() { return null; } }", added(VALID));
|
||||
assertType("test2.get()", "Object");
|
||||
assertEval("class Test3<T> { T[][] get() { return null; } }");
|
||||
assertEval("Test3<? extends String> test3 = new Test3<>();");
|
||||
VarSnippet sn6 = (VarSnippet) varKey(assertEval("test3.get()"));
|
||||
assertEquals(sn6.typeName(), "String[][]");
|
||||
assertType("test3.get()", "String[][]");
|
||||
}
|
||||
}
|
||||
|
@ -337,20 +337,4 @@ public class VariablesTest extends KullaTesting {
|
||||
assertEquals(unr.get(0), "class undefined");
|
||||
assertVariables(variable("undefined", "d"));
|
||||
}
|
||||
|
||||
public void variableTypeName() {
|
||||
assertEquals(varKey(assertEval("\"x\"")).typeName(), "String");
|
||||
|
||||
assertEquals(varKey(assertEval("java.util.regex.Pattern.compile(\"x\")")).typeName(), "java.util.regex.Pattern");
|
||||
assertEval("import java.util.regex.*;", added(VALID));
|
||||
assertEquals(varKey(assertEval("java.util.regex.Pattern.compile(\"x\")")).typeName(), "Pattern");
|
||||
|
||||
assertEquals(varKey(assertEval("new java.util.ArrayList()")).typeName(), "java.util.ArrayList");
|
||||
assertEval("import java.util.ArrayList;", added(VALID));
|
||||
assertEquals(varKey(assertEval("new java.util.ArrayList()")).typeName(), "ArrayList");
|
||||
|
||||
assertEquals(varKey(assertEval("java.util.Locale.Category.FORMAT")).typeName(), "java.util.Locale.Category");
|
||||
assertEval("import static java.util.Locale.Category;", added(VALID));
|
||||
assertEquals(varKey(assertEval("java.util.Locale.Category.FORMAT")).typeName(), "Category");
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @bug 5003235
|
||||
* @summary Private inner class accessible from subclasses
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail/ref=T5003235a.out --diags:layout=%b:%l:%_%m T5003235a.java
|
||||
* @compile/fail/ref=T5003235a.out -XDrawDiagnostics T5003235a.java
|
||||
*/
|
||||
|
||||
class Super {
|
||||
|
@ -1,13 +1,5 @@
|
||||
T5003235a.java:21: defaultM() in Super.Inner is defined in an inaccessible class or interface
|
||||
i.defaultM();
|
||||
^
|
||||
T5003235a.java:22: protectedM() in Super.Inner is defined in an inaccessible class or interface
|
||||
i.protectedM();
|
||||
^
|
||||
T5003235a.java:23: publicM() in Super.Inner is defined in an inaccessible class or interface
|
||||
i.publicM();
|
||||
^
|
||||
T5003235a.java:24: privateM() in Super.Inner is defined in an inaccessible class or interface
|
||||
i.privateM();
|
||||
^
|
||||
T5003235a.java:21:10: compiler.err.not.def.access.class.intf.cant.access: defaultM(), Super.Inner
|
||||
T5003235a.java:22:10: compiler.err.not.def.access.class.intf.cant.access: protectedM(), Super.Inner
|
||||
T5003235a.java:23:10: compiler.err.not.def.access.class.intf.cant.access: publicM(), Super.Inner
|
||||
T5003235a.java:24:10: compiler.err.not.def.access.class.intf.cant.access: privateM(), Super.Inner
|
||||
4 errors
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @bug 5003235
|
||||
* @summary Accessibility of private inner class
|
||||
* @author Peter von der Ah\u00e9
|
||||
* @compile/fail/ref=T5003235b.out --diags:layout=%b:%l:%_%m T5003235b.java
|
||||
* @compile/fail/ref=T5003235b.out -XDrawDiagnostics T5003235b.java
|
||||
*/
|
||||
|
||||
class Outer {
|
||||
|
@ -1,13 +1,5 @@
|
||||
T5003235b.java:28: k in Outer.Inner is defined in an inaccessible class or interface
|
||||
System.out.println("Value of k: " + outer.inner.k);
|
||||
^
|
||||
T5003235b.java:29: l in Outer.Inner is defined in an inaccessible class or interface
|
||||
System.out.println("Value of l: " + outer.inner.l);
|
||||
^
|
||||
T5003235b.java:30: m in Outer.Inner is defined in an inaccessible class or interface
|
||||
System.out.println("Value of m: " + outer.inner.m);
|
||||
^
|
||||
T5003235b.java:31: n in Outer.Inner is defined in an inaccessible class or interface
|
||||
System.out.println("Value of n: " + outer.inner.n);
|
||||
^
|
||||
T5003235b.java:28:56: compiler.err.not.def.access.class.intf.cant.access: k, Outer.Inner
|
||||
T5003235b.java:29:56: compiler.err.not.def.access.class.intf.cant.access: l, Outer.Inner
|
||||
T5003235b.java:30:56: compiler.err.not.def.access.class.intf.cant.access: m, Outer.Inner
|
||||
T5003235b.java:31:56: compiler.err.not.def.access.class.intf.cant.access: n, Outer.Inner
|
||||
4 errors
|
||||
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8171325
|
||||
* @summary NPE in Check.clearLocalClassNameIndexes
|
||||
* @compile/fail/ref=NPEClearingLocalClassNameIndexesTest.out -XDrawDiagnostics NPEClearingLocalClassNameIndexesTest.java
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class NPEClearingLocalClassNameIndexesTest {
|
||||
<A> void f(List<A> t) {}
|
||||
<B, C> C g(C u, Function<B, C> v) { return null; }
|
||||
<D> D g(Supplier<D> w) { return null; }
|
||||
|
||||
public void test() {
|
||||
f(g((String) null, task -> g(new NoSuch() {})));
|
||||
f(g((String) null, task -> g(new NoSuch<int>() {})));
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
NPEClearingLocalClassNameIndexesTest.java:18:9: compiler.err.cant.apply.symbol: kindname.method, f, java.util.List<A>, java.lang.String, kindname.class, NPEClearingLocalClassNameIndexesTest, (compiler.misc.incompatible.upper.lower.bounds: C, java.lang.Object,java.util.List<A>, java.lang.String)
|
||||
NPEClearingLocalClassNameIndexesTest.java:18:42: compiler.err.cant.resolve.location: kindname.class, NoSuch, , , (compiler.misc.location: kindname.class, NPEClearingLocalClassNameIndexesTest, null)
|
||||
NPEClearingLocalClassNameIndexesTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, f, java.util.List<A>, java.lang.String, kindname.class, NPEClearingLocalClassNameIndexesTest, (compiler.misc.incompatible.upper.lower.bounds: C, java.lang.Object,java.util.List<A>, java.lang.String)
|
||||
NPEClearingLocalClassNameIndexesTest.java:19:42: compiler.err.cant.resolve.location: kindname.class, NoSuch, , , (compiler.misc.location: kindname.class, NPEClearingLocalClassNameIndexesTest, null)
|
||||
NPEClearingLocalClassNameIndexesTest.java:19:49: compiler.err.type.found.req: int, (compiler.misc.type.req.ref)
|
||||
5 errors
|
24
langtools/test/tools/javac/T8171332/Buggy.java
Normal file
24
langtools/test/tools/javac/T8171332/Buggy.java
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@Deprecated enum Buggy implements Buggy {}
|
21
langtools/test/tools/javac/T8171332/Processor.java
Normal file
21
langtools/test/tools/javac/T8171332/Processor.java
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8171332
|
||||
* @summary 8171332: NPE in MembersPhase.finishClass
|
||||
* @modules java.compiler
|
||||
* jdk.compiler
|
||||
* @build Processor
|
||||
* @compile/fail/ref=Processor.out -XDrawDiagnostics -processor Processor Buggy.java
|
||||
*/
|
||||
|
||||
import java.util.Set;
|
||||
import javax.annotation.processing.*;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
@SupportedAnnotationTypes("*")
|
||||
public class Processor extends AbstractProcessor {
|
||||
@Override
|
||||
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
|
||||
return false;
|
||||
}
|
||||
}
|
3
langtools/test/tools/javac/T8171332/Processor.out
Normal file
3
langtools/test/tools/javac/T8171332/Processor.out
Normal file
@ -0,0 +1,3 @@
|
||||
Buggy.java:24:35: compiler.err.intf.expected.here
|
||||
Buggy.java:24:13: compiler.err.cyclic.inheritance: Buggy
|
||||
2 errors
|
@ -0,0 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8171528
|
||||
* @summary Crash in Annotate with duplicate package-info declarations
|
||||
* @compile/fail/ref=DuplicatedAnnotatedPackagesTest.out -XDrawDiagnostics pkg1/package-info.java pkg2/package-info.java
|
||||
*/
|
@ -0,0 +1,4 @@
|
||||
package-info.java:2:9: compiler.warn.pkg-info.already.seen: test
|
||||
package-info.java:1:1: compiler.err.already.annotated: kindname.package, test
|
||||
1 error
|
||||
1 warning
|
@ -0,0 +1,2 @@
|
||||
@Deprecated
|
||||
package test;
|
@ -0,0 +1,2 @@
|
||||
@Deprecated
|
||||
package test;
|
@ -61,9 +61,10 @@ class Example implements Comparable<Example> {
|
||||
declaredKeys = new TreeSet<String>();
|
||||
srcFiles = new ArrayList<File>();
|
||||
procFiles = new ArrayList<File>();
|
||||
supportFiles = new ArrayList<File>();
|
||||
srcPathFiles = new ArrayList<File>();
|
||||
moduleSourcePathFiles = new ArrayList<File>();
|
||||
modulePathFiles = new ArrayList<File>();
|
||||
classPathFiles = new ArrayList<File>();
|
||||
additionalFiles = new ArrayList<File>();
|
||||
|
||||
findFiles(file, srcFiles);
|
||||
@ -89,10 +90,13 @@ class Example implements Comparable<Example> {
|
||||
} else if (files == srcFiles && c.getName().equals("additional")) {
|
||||
additionalFilesDir = c;
|
||||
findFiles(c, additionalFiles);
|
||||
} else if (files == srcFiles && c.getName().equals("support"))
|
||||
findFiles(c, supportFiles);
|
||||
else
|
||||
} else if (files == srcFiles && c.getName().equals("modulepath")) {
|
||||
findFiles(c, modulePathFiles);
|
||||
} else if (files == srcFiles && c.getName().equals("classpath")) {
|
||||
findFiles(c, classPathFiles);
|
||||
} else {
|
||||
findFiles(c, files);
|
||||
}
|
||||
}
|
||||
} else if (f.isFile()) {
|
||||
if (f.getName().endsWith(".java")) {
|
||||
@ -194,23 +198,32 @@ class Example implements Comparable<Example> {
|
||||
*/
|
||||
private void run(PrintWriter out, Set<String> keys, boolean raw, boolean verbose)
|
||||
throws IOException {
|
||||
ClassLoader loader = getClass().getClassLoader();
|
||||
if (supportFiles.size() > 0) {
|
||||
File supportDir = new File(tempDir, "support");
|
||||
supportDir.mkdirs();
|
||||
clean(supportDir);
|
||||
List<String> sOpts = Arrays.asList("-d", supportDir.getPath());
|
||||
new Jsr199Compiler(verbose).run(null, null, false, sOpts, procFiles);
|
||||
URLClassLoader ucl =
|
||||
new URLClassLoader(new URL[] { supportDir.toURI().toURL() }, loader);
|
||||
loader = ucl;
|
||||
List<String> opts = new ArrayList<String>();
|
||||
if (!modulePathFiles.isEmpty()) {
|
||||
File modulepathDir = new File(tempDir, "modulepath");
|
||||
modulepathDir.mkdirs();
|
||||
clean(modulepathDir);
|
||||
List<String> sOpts = Arrays.asList("-d", modulepathDir.getPath(),
|
||||
"--module-source-path", new File(file, "modulepath").getAbsolutePath());
|
||||
new Jsr199Compiler(verbose).run(null, null, false, sOpts, modulePathFiles);
|
||||
opts.add("--module-path");
|
||||
opts.add(modulepathDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (!classPathFiles.isEmpty()) {
|
||||
File classpathDir = new File(tempDir, "classpath");
|
||||
classpathDir.mkdirs();
|
||||
clean(classpathDir);
|
||||
List<String> sOpts = Arrays.asList("-d", classpathDir.getPath());
|
||||
new Jsr199Compiler(verbose).run(null, null, false, sOpts, classPathFiles);
|
||||
opts.add("--class-path");
|
||||
opts.add(classpathDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
File classesDir = new File(tempDir, "classes");
|
||||
classesDir.mkdirs();
|
||||
clean(classesDir);
|
||||
|
||||
List<String> opts = new ArrayList<String>();
|
||||
opts.add("-d");
|
||||
opts.add(classesDir.getPath());
|
||||
if (options != null)
|
||||
@ -327,8 +340,9 @@ class Example implements Comparable<Example> {
|
||||
File additionalFilesDir;
|
||||
List<File> srcPathFiles;
|
||||
List<File> moduleSourcePathFiles;
|
||||
List<File> modulePathFiles;
|
||||
List<File> classPathFiles;
|
||||
List<File> additionalFiles;
|
||||
List<File> supportFiles;
|
||||
File infoFile;
|
||||
private List<String> runOpts;
|
||||
private List<String> options;
|
||||
|
@ -239,8 +239,10 @@ public class RunExamples {
|
||||
srcFiles.remove(e.infoFile);
|
||||
showFiles(e, srcFiles);
|
||||
showFiles(e, e.srcPathFiles);
|
||||
showFiles(e, e.moduleSourcePathFiles);
|
||||
showFiles(e, e.modulePathFiles);
|
||||
showFiles(e, e.classPathFiles);
|
||||
showFiles(e, e.procFiles);
|
||||
showFiles(e, e.supportFiles);
|
||||
}
|
||||
run(e);
|
||||
}
|
||||
|
@ -20,11 +20,13 @@ compiler.err.limit.pool.in.class # UNUSED?
|
||||
compiler.err.limit.stack # Code
|
||||
compiler.err.limit.string # Gen
|
||||
compiler.err.limit.string.overflow # JavaCompiler
|
||||
compiler.err.module.non.zero.opens # bad class file
|
||||
compiler.err.name.reserved.for.internal.use # UNUSED
|
||||
compiler.err.no.annotation.member
|
||||
compiler.err.no.encl.instance.of.type.in.scope # cannot occur; always followed by assert false;
|
||||
compiler.err.no.match.entry # UNUSED?
|
||||
compiler.err.not.annotation.type # cannot occur given preceding checkType
|
||||
compiler.err.not.def.access.package.cant.access
|
||||
compiler.err.proc.bad.config.file # JavacProcessingEnvironment
|
||||
compiler.err.proc.cant.access # completion failure
|
||||
compiler.err.proc.cant.access.1 # completion failure, no stack trace
|
||||
@ -69,10 +71,11 @@ compiler.misc.kindname.type.variable.bound
|
||||
compiler.misc.kindname.value
|
||||
compiler.misc.incompatible.eq.lower.bounds # cannot happen?
|
||||
compiler.misc.module.name.mismatch
|
||||
compiler.misc.module.non.zero.opens # bad class file
|
||||
compiler.misc.no.unique.minimal.instance.exists
|
||||
compiler.misc.no.unique.maximal.instance.exists # cannot happen?
|
||||
compiler.err.module.non.zero.opens # bad class file
|
||||
compiler.misc.module.non.zero.opens # bad class file
|
||||
compiler.misc.not.def.access.package.cant.access
|
||||
compiler.misc.package.not.visible
|
||||
compiler.misc.resume.abort # prompt for a response
|
||||
compiler.misc.source.unavailable # DiagnosticSource
|
||||
compiler.misc.token.bad-symbol
|
||||
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
//key: compiler.err.not.def.access.class.intf.cant.access.reason
|
||||
//key: compiler.misc.not.def.access.does.not.read
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 api1;
|
||||
|
||||
public class Api {
|
||||
public static void test() {}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module apia {
|
||||
exports api1;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 api2;
|
||||
|
||||
public class Api {
|
||||
public static api1.Api get() { return null; }
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module apib {
|
||||
requires apia;
|
||||
exports api2;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 impl;
|
||||
|
||||
public class Impl {
|
||||
void test() {
|
||||
api2.Api.get().test();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
requires apib;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
// key: compiler.err.prob.found.req
|
||||
// key: compiler.misc.invalid.mref
|
||||
// key: compiler.misc.not.def.access.class.intf.cant.access.reason
|
||||
// key: compiler.misc.not.def.access.does.not.read
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 api1;
|
||||
|
||||
public class Api {
|
||||
public static void test() {}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module apia {
|
||||
exports api1;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 api2;
|
||||
|
||||
public class Api {
|
||||
public static api1.Api get() { return null; }
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module apib {
|
||||
requires apia;
|
||||
exports api2;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 impl;
|
||||
|
||||
public class Impl {
|
||||
void test(api2.Api a2) {
|
||||
Runnable r = a2.get() :: test;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
requires apib;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.does.not.read
|
@ -21,8 +21,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package p2;
|
||||
package api;
|
||||
|
||||
public class C2 {
|
||||
p1.C1 c1;
|
||||
public class Api {
|
||||
}
|
@ -21,6 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package p1;
|
||||
|
||||
public class C1 {}
|
||||
module api {
|
||||
exports api;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 impl;
|
||||
|
||||
public class Impl {
|
||||
api.Api api;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.does.not.read.from.unnamed
|
||||
|
||||
public class NotDefAccessDoesNotReadFromUnnamed {
|
||||
api.Api api;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 api;
|
||||
|
||||
public class Api {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module api {
|
||||
exports api;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
//key: compiler.err.not.def.access.class.intf.cant.access.reason
|
||||
//key: compiler.misc.not.def.access.does.not.read.unnamed
|
||||
//options: --add-reads=auxiliary=ALL-UNNAMED
|
@ -21,4 +21,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
// key: compiler.err.not.def.access.package.cant.access
|
||||
package api;
|
||||
|
||||
public class Api {
|
||||
public void test() {}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 auxiliary;
|
||||
|
||||
public class Auxiliary {
|
||||
public static api.Api get() { return null; }
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module auxiliary {
|
||||
exports auxiliary;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 impl;
|
||||
|
||||
public class Impl {
|
||||
{
|
||||
auxiliary.Auxiliary.get().test();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
module impl {
|
||||
requires auxiliary;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.
|
||||
*/
|
||||
|
||||
//key: compiler.err.package.not.visible
|
||||
//key: compiler.misc.not.def.access.not.exported
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 api;
|
||||
|
||||
public class Api {
|
||||
}
|
@ -21,4 +21,5 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module m2x {}
|
||||
module api {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 impl;
|
||||
|
||||
public class Impl {
|
||||
api.Api api;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user