--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/apt/main/AptJavaCompiler.java Sun Dec 12 10:05:40 2010 -0800
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.apt.main;
+
+import java.io.*;
+import java.util.Map;
+
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.jvm.*;
+
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.tree.JCTree.*;
+
+import com.sun.tools.apt.comp.*;
+import com.sun.tools.apt.util.Bark;
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.tools.javac.parser.DocCommentScanner;
+
+/**
+ * <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>
+ */
+@SuppressWarnings("deprecation")
+public class AptJavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
+ /** The context key for the compiler. */
+ protected static final Context.Key<AptJavaCompiler> compilerKey =
+ new Context.Key<AptJavaCompiler>();
+
+ /** Get the JavaCompiler instance for this context. */
+ public static AptJavaCompiler instance(Context context) {
+ AptJavaCompiler instance = context.get(compilerKey);
+ if (instance == null)
+ instance = new AptJavaCompiler(context);
+ return instance;
+ }
+
+
+ java.util.Set<String> genSourceFileNames;
+ java.util.Set<String> genClassFileNames;
+
+ public java.util.Set<String> getSourceFileNames() {
+ return genSourceFileNames;
+ }
+
+ /** List of names of generated class files.
+ */
+ public java.util.Set<String> getClassFileNames() {
+ return genClassFileNames;
+ }
+
+ java.util.Set<java.io.File> aggregateGenFiles = java.util.Collections.emptySet();
+
+ public java.util.Set<java.io.File> getAggregateGenFiles() {
+ return aggregateGenFiles;
+ }
+
+ /** The bark to be used for error reporting.
+ */
+ Bark bark;
+
+ /** The log to be used for error reporting.
+ */
+ Log log;
+
+ /** The annotation framework
+ */
+ Apt apt;
+
+ private static Context preRegister(Context context) {
+ Bark.preRegister(context);
+
+ if (context.get(JavaFileManager.class) == null)
+ JavacFileManager.preRegister(context);
+
+ return context;
+ }
+
+ /** Construct a new compiler from a shared context.
+ */
+ public AptJavaCompiler(Context context) {
+ super(preRegister(context));
+
+ context.put(compilerKey, this);
+ apt = Apt.instance(context);
+
+ ClassReader classReader = ClassReader.instance(context);
+ classReader.preferSource = true;
+
+ // TEMPORARY NOTE: bark==log, but while refactoring, we maintain their
+ // original identities, to remember the original intent.
+ log = Log.instance(context);
+ bark = Bark.instance(context);
+
+ Options options = Options.instance(context);
+ classOutput = options.get("-retrofit") == null;
+ nocompile = options.get("-nocompile") != null;
+ print = options.get("-print") != null;
+ classesAsDecls= options.get("-XclassesAsDecls") != null;
+
+ genSourceFileNames = new java.util.LinkedHashSet<String>();
+ genClassFileNames = new java.util.LinkedHashSet<String>();
+
+ // this forces a copy of the line map to be kept in the tree,
+ // for use by com.sun.mirror.util.SourcePosition.
+ lineDebugInfo = true;
+ }
+
+ /* Switches:
+ */
+
+ /** Emit class files. This switch is always set, except for the first
+ * phase of retrofitting, where signatures are parsed.
+ */
+ public boolean classOutput;
+
+ /** The internal printing annotation processor should be used.
+ */
+ public boolean print;
+
+ /** Compilation should not be done after annotation processing.
+ */
+ public boolean nocompile;
+
+ /** Are class files being treated as declarations
+ */
+ public boolean classesAsDecls;
+
+ /** Try to open input stream with given name.
+ * Report an error if this fails.
+ * @param filename The file name of the input stream to be opened.
+ */
+ // PROVIDED FOR EXTREME BACKWARDS COMPATIBILITY
+ // There are some very obscure errors that can arise while translating
+ // the contents of a file from bytes to characters. In Tiger, these
+ // diagnostics were ignored. This method provides compatibility with
+ // that behavior. It would be better to honor those diagnostics, in which
+ // case, this method can be deleted.
+ @Override
+ public CharSequence readSource(JavaFileObject filename) {
+ try {
+ inputFiles.add(filename);
+ boolean prev = bark.setDiagnosticsIgnored(true);
+ try {
+ return filename.getCharContent(false);
+ }
+ finally {
+ bark.setDiagnosticsIgnored(prev);
+ }
+ } catch (IOException e) {
+ bark.error(Position.NOPOS, "cant.read.file", filename);
+ return null;
+ }
+ }
+
+ /** Parse contents of input stream.
+ * @param filename The name of the file from which input stream comes.
+ * @param input The input stream to be parsed.
+ */
+ // PROVIDED FOR BACKWARDS COMPATIBILITY
+ // In Tiger, diagnostics from the scanner and parser were ignored.
+ // This method provides compatibility with that behavior.
+ // It would be better to honor those diagnostics, in which
+ // case, this method can be deleted.
+ @Override
+ protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) {
+ boolean prev = bark.setDiagnosticsIgnored(true);
+ try {
+ return super.parse(filename, content);
+ }
+ finally {
+ bark.setDiagnosticsIgnored(prev);
+ }
+ }
+
+ @Override
+ protected boolean keepComments() {
+ return true; // make doc comments available to mirror API impl.
+ }
+
+ /** Track when the JavaCompiler has been used to compile something. */
+ private boolean hasBeenUsed = false;
+
+ /** Main method: compile a list of files, return all compiled classes
+ * @param filenames The names of all files to be compiled.
+ */
+ public List<ClassSymbol> compile(List<String> filenames,
+ Map<String, String> origOptions,
+ ClassLoader aptCL,
+ AnnotationProcessorFactory providedFactory,
+ java.util.Set<Class<? extends AnnotationProcessorFactory> > productiveFactories,
+ java.util.Set<java.io.File> aggregateGenFiles)
+ throws Throwable {
+ // as a JavaCompiler can only be used once, throw an exception if
+ // it has been used before.
+ assert !hasBeenUsed : "attempt to reuse JavaCompiler";
+ hasBeenUsed = true;
+
+ this.aggregateGenFiles = aggregateGenFiles;
+
+ long msec = System.currentTimeMillis();
+
+ ListBuffer<ClassSymbol> classes = new ListBuffer<ClassSymbol>();
+ try {
+ JavacFileManager fm = (JavacFileManager)fileManager;
+ //parse all files
+ ListBuffer<JCCompilationUnit> trees = new ListBuffer<JCCompilationUnit>();
+ for (List<String> l = filenames; l.nonEmpty(); l = l.tail) {
+ if (classesAsDecls) {
+ if (! l.head.endsWith(".java") ) { // process as class file
+ ClassSymbol cs = reader.enterClass(names.fromString(l.head));
+ try {
+ cs.complete();
+ } catch(Symbol.CompletionFailure cf) {
+ bark.aptError("CantFindClass", l);
+ continue;
+ }
+
+ classes.append(cs); // add to list of classes
+ continue;
+ }
+ }
+ JavaFileObject fo = fm.getJavaFileObjectsFromStrings(List.of(l.head)).iterator().next();
+ trees.append(parse(fo));
+ }
+
+ //enter symbols for all files
+ List<JCCompilationUnit> roots = trees.toList();
+
+ if (errorCount() == 0) {
+ boolean prev = bark.setDiagnosticsIgnored(true);
+ try {
+ enter.main(roots);
+ }
+ finally {
+ bark.setDiagnosticsIgnored(prev);
+ }
+ }
+
+ if (errorCount() == 0) {
+ apt.main(roots,
+ classes,
+ origOptions, aptCL,
+ providedFactory,
+ productiveFactories);
+ genSourceFileNames.addAll(apt.getSourceFileNames());
+ genClassFileNames.addAll(apt.getClassFileNames());
+ }
+
+ } catch (Abort ex) {
+ }
+
+ if (verbose)
+ printVerbose("total", Long.toString(System.currentTimeMillis() - msec));
+
+ chk.reportDeferredDiagnostics();
+
+ printCount("error", errorCount());
+ printCount("warn", warningCount());
+
+ return classes.toList();
+ }
+}
--- a/langtools/src/share/classes/com/sun/tools/apt/main/JavaCompiler.java Fri Dec 10 07:38:28 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. 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.apt.main;
-
-import java.io.*;
-import java.util.Map;
-
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.jvm.*;
-
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.tree.JCTree.*;
-
-import com.sun.tools.apt.comp.*;
-import com.sun.tools.apt.util.Bark;
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-import com.sun.tools.javac.parser.DocCommentScanner;
-
-/**
- * <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>
- */
-@SuppressWarnings("deprecation")
-public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
- /** The context key for the compiler. */
- protected static final Context.Key<JavaCompiler> compilerKey =
- new Context.Key<JavaCompiler>();
-
- /** Get the JavaCompiler instance for this context. */
- public static JavaCompiler instance(Context context) {
- JavaCompiler instance = context.get(compilerKey);
- if (instance == null)
- instance = new JavaCompiler(context);
- return instance;
- }
-
-
- java.util.Set<String> genSourceFileNames;
- java.util.Set<String> genClassFileNames;
-
- public java.util.Set<String> getSourceFileNames() {
- return genSourceFileNames;
- }
-
- /** List of names of generated class files.
- */
- public java.util.Set<String> getClassFileNames() {
- return genClassFileNames;
- }
-
- java.util.Set<java.io.File> aggregateGenFiles = java.util.Collections.emptySet();
-
- public java.util.Set<java.io.File> getAggregateGenFiles() {
- return aggregateGenFiles;
- }
-
- /** The bark to be used for error reporting.
- */
- Bark bark;
-
- /** The log to be used for error reporting.
- */
- Log log;
-
- /** The annotation framework
- */
- Apt apt;
-
- private static Context preRegister(Context context) {
- Bark.preRegister(context);
-
- if (context.get(JavaFileManager.class) == null)
- JavacFileManager.preRegister(context);
-
- return context;
- }
-
- /** Construct a new compiler from a shared context.
- */
- public JavaCompiler(Context context) {
- super(preRegister(context));
-
- context.put(compilerKey, this);
- apt = Apt.instance(context);
-
- ClassReader classReader = ClassReader.instance(context);
- classReader.preferSource = true;
-
- // TEMPORARY NOTE: bark==log, but while refactoring, we maintain their
- // original identities, to remember the original intent.
- log = Log.instance(context);
- bark = Bark.instance(context);
-
- Options options = Options.instance(context);
- classOutput = options.get("-retrofit") == null;
- nocompile = options.get("-nocompile") != null;
- print = options.get("-print") != null;
- classesAsDecls= options.get("-XclassesAsDecls") != null;
-
- genSourceFileNames = new java.util.LinkedHashSet<String>();
- genClassFileNames = new java.util.LinkedHashSet<String>();
-
- // this forces a copy of the line map to be kept in the tree,
- // for use by com.sun.mirror.util.SourcePosition.
- lineDebugInfo = true;
- }
-
- /* Switches:
- */
-
- /** Emit class files. This switch is always set, except for the first
- * phase of retrofitting, where signatures are parsed.
- */
- public boolean classOutput;
-
- /** The internal printing annotation processor should be used.
- */
- public boolean print;
-
- /** Compilation should not be done after annotation processing.
- */
- public boolean nocompile;
-
- /** Are class files being treated as declarations
- */
- public boolean classesAsDecls;
-
- /** Try to open input stream with given name.
- * Report an error if this fails.
- * @param filename The file name of the input stream to be opened.
- */
- // PROVIDED FOR EXTREME BACKWARDS COMPATIBILITY
- // There are some very obscure errors that can arise while translating
- // the contents of a file from bytes to characters. In Tiger, these
- // diagnostics were ignored. This method provides compatibility with
- // that behavior. It would be better to honor those diagnostics, in which
- // case, this method can be deleted.
- @Override
- public CharSequence readSource(JavaFileObject filename) {
- try {
- inputFiles.add(filename);
- boolean prev = bark.setDiagnosticsIgnored(true);
- try {
- return filename.getCharContent(false);
- }
- finally {
- bark.setDiagnosticsIgnored(prev);
- }
- } catch (IOException e) {
- bark.error(Position.NOPOS, "cant.read.file", filename);
- return null;
- }
- }
-
- /** Parse contents of input stream.
- * @param filename The name of the file from which input stream comes.
- * @param input The input stream to be parsed.
- */
- // PROVIDED FOR BACKWARDS COMPATIBILITY
- // In Tiger, diagnostics from the scanner and parser were ignored.
- // This method provides compatibility with that behavior.
- // It would be better to honor those diagnostics, in which
- // case, this method can be deleted.
- @Override
- protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) {
- boolean prev = bark.setDiagnosticsIgnored(true);
- try {
- return super.parse(filename, content);
- }
- finally {
- bark.setDiagnosticsIgnored(prev);
- }
- }
-
- @Override
- protected boolean keepComments() {
- return true; // make doc comments available to mirror API impl.
- }
-
- /** Track when the JavaCompiler has been used to compile something. */
- private boolean hasBeenUsed = false;
-
- /** Main method: compile a list of files, return all compiled classes
- * @param filenames The names of all files to be compiled.
- */
- public List<ClassSymbol> compile(List<String> filenames,
- Map<String, String> origOptions,
- ClassLoader aptCL,
- AnnotationProcessorFactory providedFactory,
- java.util.Set<Class<? extends AnnotationProcessorFactory> > productiveFactories,
- java.util.Set<java.io.File> aggregateGenFiles)
- throws Throwable {
- // as a JavaCompiler can only be used once, throw an exception if
- // it has been used before.
- assert !hasBeenUsed : "attempt to reuse JavaCompiler";
- hasBeenUsed = true;
-
- this.aggregateGenFiles = aggregateGenFiles;
-
- long msec = System.currentTimeMillis();
-
- ListBuffer<ClassSymbol> classes = new ListBuffer<ClassSymbol>();
- try {
- JavacFileManager fm = (JavacFileManager)fileManager;
- //parse all files
- ListBuffer<JCCompilationUnit> trees = new ListBuffer<JCCompilationUnit>();
- for (List<String> l = filenames; l.nonEmpty(); l = l.tail) {
- if (classesAsDecls) {
- if (! l.head.endsWith(".java") ) { // process as class file
- ClassSymbol cs = reader.enterClass(names.fromString(l.head));
- try {
- cs.complete();
- } catch(Symbol.CompletionFailure cf) {
- bark.aptError("CantFindClass", l);
- continue;
- }
-
- classes.append(cs); // add to list of classes
- continue;
- }
- }
- JavaFileObject fo = fm.getJavaFileObjectsFromStrings(List.of(l.head)).iterator().next();
- trees.append(parse(fo));
- }
-
- //enter symbols for all files
- List<JCCompilationUnit> roots = trees.toList();
-
- if (errorCount() == 0) {
- boolean prev = bark.setDiagnosticsIgnored(true);
- try {
- enter.main(roots);
- }
- finally {
- bark.setDiagnosticsIgnored(prev);
- }
- }
-
- if (errorCount() == 0) {
- apt.main(roots,
- classes,
- origOptions, aptCL,
- providedFactory,
- productiveFactories);
- genSourceFileNames.addAll(apt.getSourceFileNames());
- genClassFileNames.addAll(apt.getClassFileNames());
- }
-
- } catch (Abort ex) {
- }
-
- if (verbose)
- printVerbose("total", Long.toString(System.currentTimeMillis() - msec));
-
- chk.reportDeferredDiagnostics();
-
- printCount("error", errorCount());
- printCount("warn", warningCount());
-
- return classes.toList();
- }
-}
--- a/langtools/src/share/classes/com/sun/tools/apt/main/Main.java Fri Dec 10 07:38:28 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/apt/main/Main.java Sun Dec 12 10:05:40 2010 -0800
@@ -421,7 +421,7 @@
},
new AptOption("-version", "opt.version") {
boolean process(String option) {
- Bark.printLines(out, ownName + " " + JavaCompiler.version());
+ Bark.printLines(out, ownName + " " + AptJavaCompiler.version());
return super.process(option);
}
},
@@ -1111,11 +1111,11 @@
}
int exitCode = EXIT_OK;
- JavaCompiler comp = null;
+ AptJavaCompiler comp = null;
try {
context.put(Bark.outKey, out);
- comp = JavaCompiler.instance(context);
+ comp = AptJavaCompiler.instance(context);
if (comp == null)
return EXIT_SYSERR;
@@ -1184,7 +1184,7 @@
*/
void bugMessage(Throwable ex) {
Bark.printLines(out, getLocalizedString("msg.bug",
- JavaCompiler.version()));
+ AptJavaCompiler.version()));
ex.printStackTrace(out);
}
--- a/langtools/src/share/classes/com/sun/tools/apt/mirror/apt/FilerImpl.java Fri Dec 10 07:38:28 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/apt/FilerImpl.java Sun Dec 12 10:05:40 2010 -0800
@@ -120,7 +120,7 @@
private final Options opts;
private final DeclarationMaker declMaker;
- private final com.sun.tools.apt.main.JavaCompiler comp;
+ private final com.sun.tools.apt.main.AptJavaCompiler comp;
// Platform's default encoding
private final static String DEFAULT_ENCODING =
@@ -177,7 +177,7 @@
opts = Options.instance(context);
declMaker = DeclarationMaker.instance(context);
bark = Bark.instance(context);
- comp = com.sun.tools.apt.main.JavaCompiler.instance(context);
+ comp = com.sun.tools.apt.main.AptJavaCompiler.instance(context);
roundOver = false;
this.filesCreated = comp.getAggregateGenFiles();
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Fri Dec 10 07:38:28 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Sun Dec 12 10:05:40 2010 -0800
@@ -245,7 +245,7 @@
public String argtypes(boolean varargs) {
List<Type> args = getParameterTypes();
if (!varargs) return args.toString();
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
while (args.tail.nonEmpty()) {
buf.append(args.head);
args = args.tail;
@@ -935,7 +935,7 @@
public static class TypeVar extends Type implements TypeVariable {
- /** The bound of this type variable; set from outside.
+ /** The upper bound of this type variable; set from outside.
* Must be nonempty once it is set.
* For a bound, `bound' is the bound type itself.
* Multiple bounds are expressed as a single class type which has the
@@ -946,6 +946,12 @@
* points to the first class or interface bound.
*/
public Type bound = null;
+
+ /** The lower bound of this type variable.
+ * TypeVars don't normally have a lower bound, so it is normally set
+ * to syms.botType.
+ * Subtypes, such as CapturedType, may provide a different value.
+ */
public Type lower;
public TypeVar(Name name, Symbol owner, Type lower) {
@@ -965,10 +971,12 @@
return v.visitTypeVar(this, s);
}
+ @Override
public Type getUpperBound() { return bound; }
int rank_field = -1;
+ @Override
public Type getLowerBound() {
return lower;
}
@@ -992,7 +1000,6 @@
*/
public static class CapturedType extends TypeVar {
- public Type lower;
public WildcardType wildcard;
public CapturedType(Name name,
@@ -1012,10 +1019,6 @@
return v.visitCapturedType(this, s);
}
- public Type getLowerBound() {
- return lower;
- }
-
@Override
public boolean isCaptured() {
return true;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Fri Dec 10 07:38:28 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Sun Dec 12 10:05:40 2010 -0800
@@ -641,7 +641,7 @@
if (!set.remove(new SingletonType(x)))
return false;
}
- return (set.size() == 0);
+ return (set.isEmpty());
}
return t.tsym == s.tsym
&& visit(t.getEnclosingType(), s.getEnclosingType())
@@ -838,26 +838,26 @@
return isSameType(t, s);
}
- void debugContainsType(WildcardType t, Type s) {
- System.err.println();
- System.err.format(" does %s contain %s?%n", t, s);
- System.err.format(" %s U(%s) <: U(%s) %s = %s%n",
- upperBound(s), s, t, U(t),
- t.isSuperBound()
- || isSubtypeNoCapture(upperBound(s), U(t)));
- System.err.format(" %s L(%s) <: L(%s) %s = %s%n",
- L(t), t, s, lowerBound(s),
- t.isExtendsBound()
- || isSubtypeNoCapture(L(t), lowerBound(s)));
- System.err.println();
- }
+// void debugContainsType(WildcardType t, Type s) {
+// System.err.println();
+// System.err.format(" does %s contain %s?%n", t, s);
+// System.err.format(" %s U(%s) <: U(%s) %s = %s%n",
+// upperBound(s), s, t, U(t),
+// t.isSuperBound()
+// || isSubtypeNoCapture(upperBound(s), U(t)));
+// System.err.format(" %s L(%s) <: L(%s) %s = %s%n",
+// L(t), t, s, lowerBound(s),
+// t.isExtendsBound()
+// || isSubtypeNoCapture(L(t), lowerBound(s)));
+// System.err.println();
+// }
@Override
public Boolean visitWildcardType(WildcardType t, Type s) {
if (s.tag >= firstPartialTag)
return containedBy(s, t);
else {
- // debugContainsType(t, s);
+// debugContainsType(t, s);
return isSameWildcard(t, s)
|| isCaptureOf(s, t)
|| ((t.isExtendsBound() || isSubtypeNoCapture(L(t), lowerBound(s))) &&
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Dec 10 07:38:28 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Sun Dec 12 10:05:40 2010 -0800
@@ -197,7 +197,7 @@
}
return (checkInner == false || c.type.getEnclosingType() == Type.noType) ?
isAccessible :
- isAccessible & isAccessible(env, c.type.getEnclosingType(), checkInner);
+ isAccessible && isAccessible(env, c.type.getEnclosingType(), checkInner);
}
//where
/** Is given class a subclass of given base class, or an inner class
@@ -234,7 +234,6 @@
}
public boolean isAccessible(Env<AttrContext> env, Type site, Symbol sym, boolean checkInner) {
if (sym.name == names.init && sym.owner != site.tsym) return false;
- ClassSymbol sub;
switch ((short)(sym.flags() & AccessFlags)) {
case PRIVATE:
return