This commit is contained in:
Alejandro Murillo 2016-08-04 17:48:48 +00:00
commit 335b44a953
51 changed files with 881 additions and 358 deletions

View File

@ -117,7 +117,7 @@ define SetupParseProperties
$$(addprefix _SPACE_, $$(PARSEPROPALLDIRS)))) $$(addprefix _SPACE_, $$(PARSEPROPALLDIRS))))
# Now setup the rule for the generation of the resource bundles. # Now setup the rule for the generation of the resource bundles.
$(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $(PARSEPROPSOURCES) $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $$(PARSEPROPSOURCES)
$(MKDIR) -p $$(@D) $$(PARSEPROPDIRS) $(MKDIR) -p $$(@D) $$(PARSEPROPDIRS)
$(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE) $(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE)
$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE) $(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE)

View File

@ -97,7 +97,7 @@ public final class JavacTool implements JavaCompiler {
PrintWriter pw = (charset == null) PrintWriter pw = (charset == null)
? new PrintWriter(System.err, true) ? new PrintWriter(System.err, true)
: new PrintWriter(new OutputStreamWriter(System.err, charset), true); : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
context.put(Log.outKey, pw); context.put(Log.errKey, pw);
CacheFSInfo.preRegister(context); CacheFSInfo.preRegister(context);
return new JavacFileManager(context, true, charset); return new JavacFileManager(context, true, charset);
} }
@ -161,9 +161,9 @@ public final class JavacTool implements JavaCompiler {
context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener)); context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));
if (out == null) if (out == null)
context.put(Log.outKey, new PrintWriter(System.err, true)); context.put(Log.errKey, new PrintWriter(System.err, true));
else else
context.put(Log.outKey, new PrintWriter(out, true)); context.put(Log.errKey, new PrintWriter(out, true));
if (fileManager == null) { if (fileManager == null) {
fileManager = getStandardFileManager(diagnosticListener, null, null); fileManager = getStandardFileManager(diagnosticListener, null, null);

View File

@ -62,9 +62,13 @@ public class Main {
*/ */
String ownName; String ownName;
/** The writer to use for normal output.
*/
PrintWriter stdOut;
/** The writer to use for diagnostic output. /** The writer to use for diagnostic output.
*/ */
PrintWriter out; PrintWriter stdErr;
/** The log to use for diagnostic output. /** The log to use for diagnostic output.
*/ */
@ -102,7 +106,7 @@ public class Main {
* @param name the name of this tool * @param name the name of this tool
*/ */
public Main(String name) { public Main(String name) {
this(name, new PrintWriter(System.err, true)); this.ownName = name;
} }
/** /**
@ -112,7 +116,7 @@ public class Main {
*/ */
public Main(String name, PrintWriter out) { public Main(String name, PrintWriter out) {
this.ownName = name; this.ownName = name;
this.out = out; this.stdOut = this.stdErr = out;
} }
/** Report a usage error. /** Report a usage error.
@ -161,7 +165,14 @@ public class Main {
* @return the result of the compilation * @return the result of the compilation
*/ */
public Result compile(String[] argv, Context context) { public Result compile(String[] argv, Context context) {
context.put(Log.outKey, out); if (stdOut != null) {
context.put(Log.outKey, stdOut);
}
if (stdErr != null) {
context.put(Log.errKey, stdErr);
}
log = Log.instance(context); log = Log.instance(context);
if (argv.length == 0) { if (argv.length == 0) {

View File

@ -96,23 +96,23 @@ public enum Option {
if (this.kind != kind) if (this.kind != kind)
return; return;
log.printRawLines(WriterKind.NOTICE, log.printRawLines(WriterKind.STDOUT,
String.format(HELP_LINE_FORMAT, String.format(HELP_LINE_FORMAT,
log.localize(PrefixKind.JAVAC, "opt.Xlint.subopts"), log.localize(PrefixKind.JAVAC, "opt.Xlint.subopts"),
log.localize(PrefixKind.JAVAC, "opt.Xlint.suboptlist"))); log.localize(PrefixKind.JAVAC, "opt.Xlint.suboptlist")));
log.printRawLines(WriterKind.NOTICE, log.printRawLines(WriterKind.STDOUT,
String.format(LINT_KEY_FORMAT, String.format(LINT_KEY_FORMAT,
"all", "all",
log.localize(PrefixKind.JAVAC, "opt.Xlint.all"))); log.localize(PrefixKind.JAVAC, "opt.Xlint.all")));
for (LintCategory lc : LintCategory.values()) { for (LintCategory lc : LintCategory.values()) {
if (lc.hidden) continue; if (lc.hidden) continue;
log.printRawLines(WriterKind.NOTICE, log.printRawLines(WriterKind.STDOUT,
String.format(LINT_KEY_FORMAT, String.format(LINT_KEY_FORMAT,
lc.option, lc.option,
log.localize(PrefixKind.JAVAC, log.localize(PrefixKind.JAVAC,
"opt.Xlint.desc." + lc.option))); "opt.Xlint.desc." + lc.option)));
} }
log.printRawLines(WriterKind.NOTICE, log.printRawLines(WriterKind.STDOUT,
String.format(LINT_KEY_FORMAT, String.format(LINT_KEY_FORMAT,
"none", "none",
log.localize(PrefixKind.JAVAC, "opt.Xlint.none"))); log.localize(PrefixKind.JAVAC, "opt.Xlint.none")));
@ -307,7 +307,7 @@ public enum Option {
delim = ", "; delim = ", ";
} }
log.printRawLines(WriterKind.NOTICE, log.printRawLines(WriterKind.STDOUT,
String.format(HELP_LINE_FORMAT, String.format(HELP_LINE_FORMAT,
super.helpSynopsis(log), super.helpSynopsis(log),
log.localize(PrefixKind.JAVAC, descrKey, targets.toString()))); log.localize(PrefixKind.JAVAC, descrKey, targets.toString())));
@ -331,7 +331,7 @@ public enum Option {
public boolean process(OptionHelper helper, String option) { public boolean process(OptionHelper helper, String option) {
Log log = helper.getLog(); Log log = helper.getLog();
String ownName = helper.getOwnName(); String ownName = helper.getOwnName();
log.printLines(PrefixKind.JAVAC, "version", ownName, JavaCompiler.version()); log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "version", ownName, JavaCompiler.version());
return super.process(helper, option); return super.process(helper, option);
} }
}, },
@ -341,7 +341,7 @@ public enum Option {
public boolean process(OptionHelper helper, String option) { public boolean process(OptionHelper helper, String option) {
Log log = helper.getLog(); Log log = helper.getLog();
String ownName = helper.getOwnName(); String ownName = helper.getOwnName();
log.printLines(PrefixKind.JAVAC, "fullVersion", ownName, JavaCompiler.fullVersion()); log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "fullVersion", ownName, JavaCompiler.fullVersion());
return super.process(helper, option); return super.process(helper, option);
} }
}, },
@ -351,11 +351,11 @@ public enum Option {
public boolean process(OptionHelper helper, String option) { public boolean process(OptionHelper helper, String option) {
Log log = helper.getLog(); Log log = helper.getLog();
String ownName = helper.getOwnName(); String ownName = helper.getOwnName();
log.printLines(PrefixKind.JAVAC, "msg.usage.header", ownName); log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "msg.usage.header", ownName);
for (Option o: getJavaCompilerOptions()) { for (Option o: getJavaCompilerOptions()) {
o.help(log, OptionKind.STANDARD); o.help(log, OptionKind.STANDARD);
} }
log.printNewline(); log.printNewline(WriterKind.STDOUT);
return super.process(helper, option); return super.process(helper, option);
} }
}, },
@ -396,8 +396,8 @@ public enum Option {
for (Option o: getJavaCompilerOptions()) { for (Option o: getJavaCompilerOptions()) {
o.help(log, OptionKind.EXTENDED); o.help(log, OptionKind.EXTENDED);
} }
log.printNewline(); log.printNewline(WriterKind.STDOUT);
log.printLines(PrefixKind.JAVAC, "msg.usage.nonstandard.footer"); log.printLines(WriterKind.STDOUT, PrefixKind.JAVAC, "msg.usage.nonstandard.footer");
return super.process(helper, option); return super.process(helper, option);
} }
}, },
@ -840,7 +840,7 @@ public enum Option {
if (this.kind != kind) if (this.kind != kind)
return; return;
log.printRawLines(WriterKind.NOTICE, log.printRawLines(WriterKind.STDOUT,
String.format(HELP_LINE_FORMAT, String.format(HELP_LINE_FORMAT,
helpSynopsis(log), helpSynopsis(log),
log.localize(PrefixKind.JAVAC, descrKey))); log.localize(PrefixKind.JAVAC, descrKey)));

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -604,7 +604,7 @@ public class JavacFiler implements Filer, Closeable {
* Debugging function to display internal state. * Debugging function to display internal state.
*/ */
public void displayState() { public void displayState() {
PrintWriter xout = context.get(Log.outKey); PrintWriter xout = context.get(Log.logKey).getWriter(Log.WriterKind.STDERR);
xout.println("File Object History : " + fileObjectHistory); xout.println("File Object History : " + fileObjectHistory);
xout.println("Open Type Names : " + openTypeNames); xout.println("Open Type Names : " + openTypeNames);
xout.println("Gen. Src Names : " + generatedSourceNames); xout.println("Gen. Src Names : " + generatedSourceNames);

View File

@ -26,12 +26,10 @@
package com.sun.tools.javac.processing; package com.sun.tools.javac.processing;
import java.io.Closeable; import java.io.Closeable;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Constructor;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.nio.file.Path; import java.nio.file.Path;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,10 +27,13 @@ package com.sun.tools.javac.util;
import java.io.*; import java.io.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumMap;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Queue; import java.util.Queue;
import java.util.Set; import java.util.Set;
import javax.tools.DiagnosticListener; import javax.tools.DiagnosticListener;
import javax.tools.JavaFileObject; import javax.tools.JavaFileObject;
@ -56,9 +59,12 @@ public class Log extends AbstractLog {
/** The context key for the log. */ /** The context key for the log. */
public static final Context.Key<Log> logKey = new Context.Key<>(); public static final Context.Key<Log> logKey = new Context.Key<>();
/** The context key for the output PrintWriter. */ /** The context key for the standard output PrintWriter. */
public static final Context.Key<PrintWriter> outKey = new Context.Key<>(); public static final Context.Key<PrintWriter> outKey = new Context.Key<>();
/** The context key for the diagnostic PrintWriter. */
public static final Context.Key<PrintWriter> errKey = new Context.Key<>();
/* TODO: Should unify this with prefix handling in JCDiagnostic.Factory. */ /* TODO: Should unify this with prefix handling in JCDiagnostic.Factory. */
public enum PrefixKind { public enum PrefixKind {
JAVAC("javac."), JAVAC("javac."),
@ -111,6 +117,7 @@ public class Log extends AbstractLog {
install(log); install(log);
} }
@Override
public void report(JCDiagnostic diag) { } public void report(JCDiagnostic diag) { }
} }
@ -134,6 +141,7 @@ public class Log extends AbstractLog {
install(log); install(log);
} }
@Override
public void report(JCDiagnostic diag) { public void report(JCDiagnostic diag) {
if (!diag.isFlagSet(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE) && if (!diag.isFlagSet(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE) &&
(filter == null || filter.accepts(diag))) { (filter == null || filter.accepts(diag))) {
@ -163,13 +171,9 @@ public class Log extends AbstractLog {
} }
} }
public enum WriterKind { NOTICE, WARNING, ERROR } public enum WriterKind { NOTICE, WARNING, ERROR, STDOUT, STDERR }
protected PrintWriter errWriter; private final Map<WriterKind, PrintWriter> writers;
protected PrintWriter warnWriter;
protected PrintWriter noticeWriter;
/** The maximum number of errors/warnings that are reported. /** The maximum number of errors/warnings that are reported.
*/ */
@ -223,14 +227,130 @@ public class Log extends AbstractLog {
*/ */
private DiagnosticHandler diagnosticHandler; private DiagnosticHandler diagnosticHandler;
/** Construct a log with given I/O redirections. /** Get the Log instance for this context. */
public static Log instance(Context context) {
Log instance = context.get(logKey);
if (instance == null)
instance = new Log(context);
return instance;
}
/**
* Register a Context.Factory to create a Log.
*/ */
public static void preRegister(Context context, PrintWriter w) {
context.put(Log.class, (Context.Factory<Log>) (c -> new Log(c, w)));
}
/**
* Construct a log with default settings.
* If no streams are set in the context, the log will be initialized to use
* System.out for normal output, and System.err for all diagnostic output.
* If one stream is set in the context, with either Log.outKey or Log.errKey,
* it will be used for all output.
* Otherwise, the log will be initialized to use both streams found in the context.
*/
protected Log(Context context) {
this(context, initWriters(context));
}
/**
* Initialize a map of writers based on values found in the context
* @param context the context in which to find writers to use
* @return a map of writers
*/
private static Map<WriterKind, PrintWriter> initWriters(Context context) {
PrintWriter out = context.get(outKey);
PrintWriter err = context.get(errKey);
if (out == null && err == null) {
out = new PrintWriter(System.out, true);
err = new PrintWriter(System.err, true);
return initWriters(out, err);
} else if (out == null || err == null) {
PrintWriter pw = (out != null) ? out : err;
return initWriters(pw, pw);
} else {
return initWriters(out, err);
}
}
/**
* Construct a log with all output sent to a single output stream.
*/
protected Log(Context context, PrintWriter writer) {
this(context, initWriters(writer, writer));
}
/**
* Construct a log.
* The log will be initialized to use stdOut for normal output, and stdErr
* for all diagnostic output.
*/
protected Log(Context context, PrintWriter out, PrintWriter err) {
this(context, initWriters(out, err));
}
/**
* Initialize a writer map for a stream for normal output, and a stream for diagnostics.
* @param out a stream to be used for normal output
* @param err a stream to be used for diagnostic messages, such as errors, warnings, etc
* @return a map of writers
*/
private static Map<WriterKind, PrintWriter> initWriters(PrintWriter out, PrintWriter err) {
Map<WriterKind, PrintWriter> writers = new EnumMap<>(WriterKind.class);
writers.put(WriterKind.ERROR, err);
writers.put(WriterKind.WARNING, err);
writers.put(WriterKind.NOTICE, err);
writers.put(WriterKind.STDOUT, out);
writers.put(WriterKind.STDERR, err);
return writers;
}
/**
* Construct a log with given I/O redirections.
* @deprecated
* This constructor is provided to support the supported but now-deprecated javadoc entry point
* com.sun.tools.javadoc.Main.execute(String programName,
* PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter,
* String defaultDocletClassName, String... args)
*/
@Deprecated
protected Log(Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) { protected Log(Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
this(context, initWriters(errWriter, warnWriter, noticeWriter));
}
/**
* Initialize a writer map with different streams for different types of diagnostics.
* @param errWriter a stream for writing error messages
* @param warnWriter a stream for writing warning messages
* @param noticeWriter a stream for writing notice messages
* @return a map of writers
* @deprecated This method exists to support a supported but now deprecated javadoc entry point.
*/
@Deprecated
private static Map<WriterKind, PrintWriter> initWriters(PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
Map<WriterKind, PrintWriter> writers = new EnumMap<>(WriterKind.class);
writers.put(WriterKind.ERROR, errWriter);
writers.put(WriterKind.WARNING, warnWriter);
writers.put(WriterKind.NOTICE, noticeWriter);
writers.put(WriterKind.STDOUT, noticeWriter);
writers.put(WriterKind.STDERR, errWriter);
return writers;
}
/**
* Creates a log.
* @param context the context in which the log should be registered
* @param writers a map of writers that can be accessed by the kind of writer required
*/
private Log(Context context, Map<WriterKind, PrintWriter> writers) {
super(JCDiagnostic.Factory.instance(context)); super(JCDiagnostic.Factory.instance(context));
context.put(logKey, this); context.put(logKey, this);
this.errWriter = errWriter; this.writers = writers;
this.warnWriter = warnWriter;
this.noticeWriter = noticeWriter;
@SuppressWarnings("unchecked") // FIXME @SuppressWarnings("unchecked") // FIXME
DiagnosticListener<? super JavaFileObject> dl = DiagnosticListener<? super JavaFileObject> dl =
@ -245,6 +365,7 @@ public class Log extends AbstractLog {
final Options options = Options.instance(context); final Options options = Options.instance(context);
initOptions(options); initOptions(options);
options.addListener(new Runnable() { options.addListener(new Runnable() {
@Override
public void run() { public void run() {
initOptions(options); initOptions(options);
} }
@ -293,42 +414,6 @@ public class Log extends AbstractLog {
return 100; return 100;
} }
/** The default writer for diagnostics
*/
static PrintWriter defaultWriter(Context context) {
PrintWriter result = context.get(outKey);
if (result == null)
context.put(outKey, result = new PrintWriter(System.err));
return result;
}
/** Construct a log with default settings.
*/
protected Log(Context context) {
this(context, defaultWriter(context));
}
/** Construct a log with all output redirected.
*/
protected Log(Context context, PrintWriter defaultWriter) {
this(context, defaultWriter, defaultWriter, defaultWriter);
}
/** Get the Log instance for this context. */
public static Log instance(Context context) {
Log instance = context.get(logKey);
if (instance == null)
instance = new Log(context);
return instance;
}
/**
* Register a Context.Factory to create a Log.
*/
public static void preRegister(Context context, PrintWriter w) {
context.put(Log.class, (Context.Factory<Log>) (c -> new Log(c, w)));
}
/** The number of errors encountered so far. /** The number of errors encountered so far.
*/ */
public int nerrors = 0; public int nerrors = 0;
@ -371,26 +456,18 @@ public class Log extends AbstractLog {
} }
public PrintWriter getWriter(WriterKind kind) { public PrintWriter getWriter(WriterKind kind) {
switch (kind) { return writers.get(kind);
case NOTICE: return noticeWriter;
case WARNING: return warnWriter;
case ERROR: return errWriter;
default: throw new IllegalArgumentException();
}
} }
public void setWriter(WriterKind kind, PrintWriter pw) { public void setWriter(WriterKind kind, PrintWriter pw) {
Assert.checkNonNull(pw); Assert.checkNonNull(pw);
switch (kind) { writers.put(kind, pw);
case NOTICE: noticeWriter = pw; break;
case WARNING: warnWriter = pw; break;
case ERROR: errWriter = pw; break;
default: throw new IllegalArgumentException();
}
} }
public void setWriters(PrintWriter pw) { public void setWriters(PrintWriter pw) {
noticeWriter = warnWriter = errWriter = Assert.checkNonNull(pw); Assert.checkNonNull(pw);
for (WriterKind k: WriterKind.values())
writers.put(k, pw);
} }
/** /**
@ -407,9 +484,9 @@ public class Log extends AbstractLog {
/** Flush the logs /** Flush the logs
*/ */
public void flush() { public void flush() {
errWriter.flush(); for (PrintWriter pw: writers.values()) {
warnWriter.flush(); pw.flush();
noticeWriter.flush(); }
} }
public void flush(WriterKind kind) { public void flush(WriterKind kind) {
@ -470,6 +547,7 @@ public class Log extends AbstractLog {
} }
public void printNewline() { public void printNewline() {
PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
noticeWriter.println(); noticeWriter.println();
} }
@ -478,10 +556,12 @@ public class Log extends AbstractLog {
} }
public void printLines(String key, Object... args) { public void printLines(String key, Object... args) {
PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
printRawLines(noticeWriter, localize(key, args)); printRawLines(noticeWriter, localize(key, args));
} }
public void printLines(PrefixKind pk, String key, Object... args) { public void printLines(PrefixKind pk, String key, Object... args) {
PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
printRawLines(noticeWriter, localize(pk, key, args)); printRawLines(noticeWriter, localize(pk, key, args));
} }
@ -497,6 +577,7 @@ public class Log extends AbstractLog {
* for the platform. * for the platform.
*/ */
public void printRawLines(String msg) { public void printRawLines(String msg) {
PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
printRawLines(noticeWriter, msg); printRawLines(noticeWriter, msg);
} }
@ -524,10 +605,13 @@ public class Log extends AbstractLog {
* noticeWriter stream. * noticeWriter stream.
*/ */
public void printVerbose(String key, Object... args) { public void printVerbose(String key, Object... args) {
PrintWriter noticeWriter = writers.get(WriterKind.NOTICE);
printRawLines(noticeWriter, localize("verbose." + key, args)); printRawLines(noticeWriter, localize("verbose." + key, args));
} }
@Override
protected void directError(String key, Object... args) { protected void directError(String key, Object... args) {
PrintWriter errWriter = writers.get(WriterKind.ERROR);
printRawLines(errWriter, localize(key, args)); printRawLines(errWriter, localize(key, args));
errWriter.flush(); errWriter.flush();
} }
@ -546,6 +630,7 @@ public class Log extends AbstractLog {
* Primary method to report a diagnostic. * Primary method to report a diagnostic.
* @param diagnostic * @param diagnostic
*/ */
@Override
public void report(JCDiagnostic diagnostic) { public void report(JCDiagnostic diagnostic) {
diagnosticHandler.report(diagnostic); diagnosticHandler.report(diagnostic);
} }
@ -556,6 +641,7 @@ public class Log extends AbstractLog {
* reported so far, the diagnostic may be handed off to writeDiagnostic. * reported so far, the diagnostic may be handed off to writeDiagnostic.
*/ */
private class DefaultDiagnosticHandler extends DiagnosticHandler { private class DefaultDiagnosticHandler extends DiagnosticHandler {
@Override
public void report(JCDiagnostic diagnostic) { public void report(JCDiagnostic diagnostic) {
if (expectDiagKeys != null) if (expectDiagKeys != null)
expectDiagKeys.remove(diagnostic.getCode()); expectDiagKeys.remove(diagnostic.getCode());
@ -631,13 +717,13 @@ public class Log extends AbstractLog {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
case NOTE: case NOTE:
return noticeWriter; return writers.get(WriterKind.NOTICE);
case WARNING: case WARNING:
return warnWriter; return writers.get(WriterKind.WARNING);
case ERROR: case ERROR:
return errWriter; return writers.get(WriterKind.ERROR);
default: default:
throw new Error(); throw new Error();
@ -683,26 +769,27 @@ public class Log extends AbstractLog {
/** print an error or warning message: /** print an error or warning message:
*/ */
private void printRawError(int pos, String msg) { private void printRawDiag(PrintWriter pw, String prefix, int pos, String msg) {
if (source == null || pos == Position.NOPOS) { if (source == null || pos == Position.NOPOS) {
printRawLines(errWriter, "error: " + msg); printRawLines(pw, prefix + msg);
} else { } else {
int line = source.getLineNumber(pos); int line = source.getLineNumber(pos);
JavaFileObject file = source.getFile(); JavaFileObject file = source.getFile();
if (file != null) if (file != null)
printRawLines(errWriter, printRawLines(pw,
file.getName() + ":" + file.getName() + ":" +
line + ": " + msg); line + ": " + msg);
printErrLine(pos, errWriter); printErrLine(pos, pw);
} }
errWriter.flush(); pw.flush();
} }
/** report an error: /** report an error:
*/ */
public void rawError(int pos, String msg) { public void rawError(int pos, String msg) {
PrintWriter errWriter = writers.get(WriterKind.ERROR);
if (nerrors < MaxErrors && shouldReport(currentSourceFile(), pos)) { if (nerrors < MaxErrors && shouldReport(currentSourceFile(), pos)) {
printRawError(pos, msg); printRawDiag(errWriter, "error: ", pos, msg);
prompt(); prompt();
nerrors++; nerrors++;
} }
@ -712,12 +799,13 @@ public class Log extends AbstractLog {
/** report a warning: /** report a warning:
*/ */
public void rawWarning(int pos, String msg) { public void rawWarning(int pos, String msg) {
PrintWriter warnWriter = writers.get(WriterKind.ERROR);
if (nwarnings < MaxWarnings && emitWarnings) { if (nwarnings < MaxWarnings && emitWarnings) {
printRawError(pos, "warning: " + msg); printRawDiag(warnWriter, "warning: ", pos, msg);
} }
prompt(); prompt();
nwarnings++; nwarnings++;
errWriter.flush(); warnWriter.flush();
} }
public static String format(String fmt, Object... args) { public static String format(String fmt, Object... args) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ class JavahFileManager extends JavacFileManager {
if (dl != null) if (dl != null)
javac_context.put(DiagnosticListener.class, dl); javac_context.put(DiagnosticListener.class, dl);
javac_context.put(com.sun.tools.javac.util.Log.outKey, log); javac_context.put(com.sun.tools.javac.util.Log.errKey, log);
return new JavahFileManager(javac_context, null); return new JavahFileManager(javac_context, null);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -174,6 +174,7 @@ public class Messager extends Log implements DocErrorReporter {
if (nerrors < MaxErrors) { if (nerrors < MaxErrors) {
String prefix = (pos == null) ? programName : pos.toString(); String prefix = (pos == null) ? programName : pos.toString();
PrintWriter errWriter = getWriter(WriterKind.ERROR);
errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg); errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
errWriter.flush(); errWriter.flush();
prompt(); prompt();
@ -206,6 +207,7 @@ public class Messager extends Log implements DocErrorReporter {
if (nwarnings < MaxWarnings) { if (nwarnings < MaxWarnings) {
String prefix = (pos == null) ? programName : pos.toString(); String prefix = (pos == null) ? programName : pos.toString();
PrintWriter warnWriter = getWriter(WriterKind.WARNING);
warnWriter.println(prefix + ": " + getText("javadoc.warning") +" - " + msg); warnWriter.println(prefix + ": " + getText("javadoc.warning") +" - " + msg);
warnWriter.flush(); warnWriter.flush();
nwarnings++; nwarnings++;
@ -235,6 +237,7 @@ public class Messager extends Log implements DocErrorReporter {
return; return;
} }
PrintWriter noticeWriter = getWriter(WriterKind.NOTICE);
if (pos == null) if (pos == null)
noticeWriter.println(msg); noticeWriter.println(msg);
else else

View File

@ -158,7 +158,7 @@ public class Start extends ToolOption.Helper {
if (log instanceof Messager) if (log instanceof Messager)
messager = (Messager) log; messager = (Messager) log;
else { else {
PrintWriter out = context.get(Log.outKey); PrintWriter out = context.get(Log.errKey);
messager = (out == null) ? new Messager(context, javadocName) messager = (out == null) ? new Messager(context, javadocName)
: new Messager(context, javadocName, out, out, out); : new Messager(context, javadocName, out, out, out);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -107,11 +107,11 @@ public class JavadocTool implements DocumentationTool {
context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener)); context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));
if (out == null) if (out == null)
context.put(Log.outKey, new PrintWriter(System.err, true)); context.put(Log.errKey, new PrintWriter(System.err, true));
else if (out instanceof PrintWriter) else if (out instanceof PrintWriter)
context.put(Log.outKey, ((PrintWriter) out)); context.put(Log.errKey, ((PrintWriter) out));
else else
context.put(Log.outKey, new PrintWriter(out, true)); context.put(Log.errKey, new PrintWriter(out, true));
if (fileManager == null) { if (fileManager == null) {
fileManager = getStandardFileManager(diagnosticListener, null, null); fileManager = getStandardFileManager(diagnosticListener, null, null);
@ -141,7 +141,7 @@ public class JavadocTool implements DocumentationTool {
PrintWriter pw = (charset == null) PrintWriter pw = (charset == null)
? new PrintWriter(System.err, true) ? new PrintWriter(System.err, true)
: new PrintWriter(new OutputStreamWriter(System.err, charset), true); : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
context.put(Log.outKey, pw); context.put(Log.errKey, pw);
return new JavacFileManager(context, true, charset); return new JavacFileManager(context, true, charset);
} }

View File

@ -275,6 +275,7 @@ public class HtmlDoclet extends AbstractDoclet {
int i = 0; int i = 0;
for (ModuleElement mdle : mdles) { for (ModuleElement mdle : mdles) {
ModulePackageIndexFrameWriter.generate(configuration, mdle); ModulePackageIndexFrameWriter.generate(configuration, mdle);
ModuleFrameWriter.generate(configuration, mdle);
nextModule = (i + 1 < mdles.size()) ? mdles.get(i + 1) : null; nextModule = (i + 1 < mdles.size()) ? mdles.get(i + 1) : null;
AbstractBuilder moduleSummaryBuilder = AbstractBuilder moduleSummaryBuilder =
configuration.getBuilderFactory().getModuleSummaryBuilder( configuration.getBuilderFactory().getModuleSummaryBuilder(

View File

@ -0,0 +1,204 @@
/*
* 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.javadoc.internal.doclets.formats.html;
import java.io.*;
import java.util.*;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.ElementFilter;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
/**
* Class to generate file for each module contents in the left-hand bottom
* frame. This will list all the Class Kinds in the module. A click on any
* class-kind will update the right-hand frame with the clicked class-kind page.
*
* <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>
*
* @author Bhavesh Patel
*/
public class ModuleFrameWriter extends HtmlDocletWriter {
/**
* The module being documented.
*/
private ModuleElement mdle;
/**
* The classes to be documented. Use this to filter out classes
* that will not be documented.
*/
private SortedSet<TypeElement> documentedClasses;
/**
* Constructor to construct ModuleFrameWriter object and to generate
* "module_name-type-frame.html" file. For example for module "java.base" this will generate file
* "java.base-type-frame.html" file.
*
* @param configuration the configuration of the doclet.
* @param moduleElement moduleElement under consideration.
*/
public ModuleFrameWriter(ConfigurationImpl configuration, ModuleElement moduleElement)
throws IOException {
super(configuration, DocPaths.moduleTypeFrame(moduleElement));
this.mdle = moduleElement;
if (utils.getSpecifiedPackages().isEmpty()) {
documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
documentedClasses.addAll(configuration.docEnv.getIncludedClasses());
}
}
/**
* Generate a module type summary page for the left-hand bottom frame.
*
* @param configuration the current configuration of the doclet.
* @param moduleElement The package for which "module_name-type-frame.html" is to be generated.
*/
public static void generate(ConfigurationImpl configuration, ModuleElement moduleElement) {
ModuleFrameWriter mdlgen;
try {
mdlgen = new ModuleFrameWriter(configuration, moduleElement);
String mdlName = moduleElement.getQualifiedName().toString();
Content mdlLabel = new StringContent(mdlName);
HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN()
: body;
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
mdlgen.getHyperLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame"));
htmlTree.addContent(heading);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexContainer);
mdlgen.addClassListing(div);
htmlTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
body.addContent(htmlTree);
}
mdlgen.printHtmlDocument(
configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body);
mdlgen.close();
} catch (IOException exc) {
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), DocPaths.moduleTypeFrame(moduleElement).getPath());
throw new DocletAbortException(exc);
}
}
/**
* Add class listing for all the classes in this module. Divide class
* listing as per the class kind and generate separate listing for
* Classes, Interfaces, Exceptions and Errors.
*
* @param contentTree the content tree to which the listing will be added
*/
protected void addClassListing(HtmlTree contentTree) {
List<PackageElement> packagesIn = ElementFilter.packagesIn(mdle.getEnclosedElements());
SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator());
SortedSet<TypeElement> classes = new TreeSet<>(utils.makeGeneralPurposeComparator());
SortedSet<TypeElement> enums = new TreeSet<>(utils.makeGeneralPurposeComparator());
SortedSet<TypeElement> exceptions = new TreeSet<>(utils.makeGeneralPurposeComparator());
SortedSet<TypeElement> errors = new TreeSet<>(utils.makeGeneralPurposeComparator());
SortedSet<TypeElement> annotationTypes = new TreeSet<>(utils.makeGeneralPurposeComparator());
for (PackageElement pkg : packagesIn) {
if (utils.isIncluded(pkg)) {
interfaces.addAll(utils.getInterfaces(pkg));
classes.addAll(utils.getOrdinaryClasses(pkg));
enums.addAll(utils.getEnums(pkg));
exceptions.addAll(utils.getExceptions(pkg));
errors.addAll(utils.getErrors(pkg));
annotationTypes.addAll(utils.getAnnotationTypes(pkg));
}
}
addClassKindListing(interfaces, getResource("doclet.Interfaces"), contentTree);
addClassKindListing(classes, getResource("doclet.Classes"), contentTree);
addClassKindListing(enums, getResource("doclet.Enums"), contentTree);
addClassKindListing(exceptions, getResource("doclet.Exceptions"), contentTree);
addClassKindListing(errors, getResource("doclet.Errors"), contentTree);
addClassKindListing(annotationTypes, getResource("doclet.AnnotationTypes"), contentTree);
}
/**
* Add specific class kind listing. Also add label to the listing.
*
* @param list Iterable list of TypeElements
* @param labelContent content tree of the label to be added
* @param contentTree the content tree to which the class kind listing will be added
*/
protected void addClassKindListing(Iterable<TypeElement> list, Content labelContent,
HtmlTree contentTree) {
SortedSet<TypeElement> tset = utils.filterOutPrivateClasses(list, configuration.javafx);
if (!tset.isEmpty()) {
boolean printedHeader = false;
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION()
: contentTree;
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(labelContent);
for (TypeElement typeElement : tset) {
if (documentedClasses != null && !documentedClasses.contains(typeElement)) {
continue;
}
if (!utils.isCoreClass(typeElement) || !configuration.isGeneratedDoc(typeElement)) {
continue;
}
if (!printedHeader) {
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
true, labelContent);
htmlTree.addContent(heading);
printedHeader = true;
}
Content arr_i_name = new StringContent(utils.getSimpleName(typeElement));
if (utils.isInterface(typeElement)) {
arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
}
Content link = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.ALL_CLASSES_FRAME, typeElement).label(arr_i_name).target("classFrame"));
Content li = HtmlTree.LI(link);
ul.addContent(li);
}
htmlTree.addContent(ul);
if (configuration.allowTag(HtmlTag.SECTION)) {
contentTree.addContent(htmlTree);
}
}
}
}

View File

@ -110,15 +110,13 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
/** /**
* Returns each module name as a separate link. * Returns each module name as a separate link.
* *
* @param moduleName the module being documented * @param mdle the module being documented
* @return content for the module link * @return content for the module link
*/ */
protected Content getModuleLink(ModuleElement mdle) { protected Content getModuleLink(ModuleElement mdle) {
Content moduleLinkContent; Content moduleLinkContent;
Content moduleLabel; Content mdlLabel = new StringContent(mdle.getQualifiedName());
moduleLabel = new StringContent(mdle.getQualifiedName().toString()); moduleLinkContent = getModuleFramesHyperLink(mdle, mdlLabel, "packageListFrame");
moduleLinkContent = getHyperLink(DocPaths.moduleFrame(mdle),
moduleLabel, "", "packageListFrame");
Content li = HtmlTree.LI(moduleLinkContent); Content li = HtmlTree.LI(moduleLinkContent);
return li; return li;
} }

View File

@ -49,6 +49,7 @@ public enum HtmlAttr {
ID, ID,
LANG, LANG,
NAME, NAME,
ONCLICK,
ONLOAD, ONLOAD,
REL, REL,
ROLE, ROLE,

View File

@ -28,6 +28,7 @@ package jdk.javadoc.internal.doclets.formats.html.markup;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement; import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeElement;
@ -282,6 +283,21 @@ public abstract class HtmlDocWriter extends HtmlWriter {
return anchor; return anchor;
} }
public Content getModuleFramesHyperLink(ModuleElement mdle, Content label, String target) {
DocLink mdlLink = new DocLink(DocPaths.moduleFrame(mdle));
DocLink mtFrameLink = new DocLink(DocPaths.moduleTypeFrame(mdle));
DocLink cFrameLink = new DocLink(DocPaths.moduleSummary(mdle));
HtmlTree anchor = HtmlTree.A(mdlLink.toString(), label);
StringBuilder onclickStr = new StringBuilder("updateModuleFrame('")
.append(mtFrameLink.toString())
.append("','")
.append(cFrameLink.toString())
.append("');");
anchor.addAttr(HtmlAttr.TARGET, target);
anchor.addAttr(HtmlAttr.ONCLICK, onclickStr.toString());
return anchor;
}
/** /**
* Get the enclosed name of the package * Get the enclosed name of the package
* *

View File

@ -107,3 +107,9 @@ function updateTabs(type)
} }
} }
} }
function updateModuleFrame(pFrame, cFrame)
{
top.packageFrame.location = pFrame;
top.classFrame.location = cFrame;
}

View File

@ -155,6 +155,11 @@ public class DocPaths {
return DocPath.create(mdle.getQualifiedName() + "-summary.html"); return DocPath.create(mdle.getQualifiedName() + "-summary.html");
} }
/** The name of the file for the module frame. */
public static DocPath moduleTypeFrame(ModuleElement mdle) {
return DocPath.create(mdle.getQualifiedName() + "-type-frame.html");
}
/** The name of the file for the module overview frame. */ /** The name of the file for the module overview frame. */
public static final DocPath MODULE_OVERVIEW_FRAME = DocPath.create("module-overview-frame.html"); public static final DocPath MODULE_OVERVIEW_FRAME = DocPath.create("module-overview-frame.html");

View File

@ -165,8 +165,8 @@ public class Messager extends Log implements Reporter {
/** /**
* Constructor * Constructor
* @param programName Name of the program (for error messages). * @param programName Name of the program (for error messages).
* @param outWriter Stream for notices etc. * @param stdOut Stream for notices etc.
* @param errWriter Stream for errors and warnings * @param stdErr Stream for errors and warnings
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public Messager(Context context, String programName, PrintWriter outWriter, PrintWriter errWriter) { public Messager(Context context, String programName, PrintWriter outWriter, PrintWriter errWriter) {
@ -254,6 +254,7 @@ public class Messager extends Log implements Reporter {
private void incrementErrorCount(String prefix, String msg) { private void incrementErrorCount(String prefix, String msg) {
if (nerrors < MaxErrors) { if (nerrors < MaxErrors) {
PrintWriter errWriter = getWriter(WriterKind.ERROR);
errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg); errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
errWriter.flush(); errWriter.flush();
prompt(); prompt();
@ -291,6 +292,7 @@ public class Messager extends Log implements Reporter {
private void incrementWarningCount(String prefix, String msg) { private void incrementWarningCount(String prefix, String msg) {
if (nwarnings < MaxWarnings) { if (nwarnings < MaxWarnings) {
PrintWriter warnWriter = getWriter(WriterKind.WARNING);
warnWriter.println(prefix + ": " + getText("javadoc.warning") + " - " + msg); warnWriter.println(prefix + ": " + getText("javadoc.warning") + " - " + msg);
warnWriter.flush(); warnWriter.flush();
nwarnings++; nwarnings++;
@ -314,6 +316,7 @@ public class Messager extends Log implements Reporter {
return; return;
} }
PrintWriter noticeWriter = getWriter(WriterKind.NOTICE);
if (path == null) { if (path == null) {
noticeWriter.println(msg); noticeWriter.println(msg);
} else { } else {
@ -329,6 +332,7 @@ public class Messager extends Log implements Reporter {
return; return;
} }
PrintWriter noticeWriter = getWriter(WriterKind.NOTICE);
if (e == null) { if (e == null) {
noticeWriter.println(msg); noticeWriter.println(msg);
} else { } else {

View File

@ -155,7 +155,7 @@ public class Start extends ToolOption.Helper {
if (log instanceof Messager) { if (log instanceof Messager) {
messager = (Messager) log; messager = (Messager) log;
} else { } else {
PrintWriter out = context.get(Log.outKey); PrintWriter out = context.get(Log.errKey);
messager = (out == null) messager = (out == null)
? new Messager(context, ProgramName) ? new Messager(context, ProgramName)
: new Messager(context, ProgramName, out, out); : new Messager(context, ProgramName, out, out);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ public class JavapFileManager extends JavacFileManager {
if (dl != null) if (dl != null)
javac_context.put(DiagnosticListener.class, dl); javac_context.put(DiagnosticListener.class, dl);
javac_context.put(com.sun.tools.javac.util.Log.outKey, log); javac_context.put(com.sun.tools.javac.util.Log.errKey, log);
return new JavapFileManager(javac_context, null); return new JavapFileManager(javac_context, null);
} }

View File

@ -110,14 +110,13 @@ class CompletenessAnalyzer {
private static CaLog createLog(Context context) { private static CaLog createLog(Context context) {
PrintWriter pw = new PrintWriter(new StringWriter()); PrintWriter pw = new PrintWriter(new StringWriter());
CaLog log = new CaLog(context, pw, pw, pw); CaLog log = new CaLog(context, pw);
context.put(outKey, pw);
context.put(logKey, log); context.put(logKey, log);
return log; return log;
} }
private CaLog(Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) { private CaLog(Context context, PrintWriter pw) {
super(context, errWriter, warnWriter, noticeWriter); super(context, pw);
} }
@Override @Override

View File

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8154119 8154262 8156077 8157987 8154261 * @bug 8154119 8154262 8156077 8157987 8154261 8154817
* @summary Test modules support in javadoc. * @summary Test modules support in javadoc.
* @author bpatel * @author bpatel
* @library ../lib * @library ../lib
@ -50,6 +50,8 @@ public class TestModules extends JavadocTester {
testNoDescription(false); testNoDescription(false);
testOverviewSummaryModules(); testOverviewSummaryModules();
testModuleLink(); testModuleLink();
testModuleClickThroughLinks();
testModuleClickThrough(true);
} }
@Test @Test
@ -63,6 +65,8 @@ public class TestModules extends JavadocTester {
testHtml5NoDescription(false); testHtml5NoDescription(false);
testHtml5OverviewSummaryModules(); testHtml5OverviewSummaryModules();
testModuleLink(); testModuleLink();
testModuleClickThroughLinks();
testModuleClickThrough(true);
} }
@Test @Test
@ -96,6 +100,7 @@ public class TestModules extends JavadocTester {
"testpkgnomodule", "testpkgnomodule1"); "testpkgnomodule", "testpkgnomodule1");
checkExit(Exit.OK); checkExit(Exit.OK);
testOverviewSummaryPackages(); testOverviewSummaryPackages();
testModuleClickThrough(false);
} }
@Test @Test
@ -442,4 +447,27 @@ public class TestModules extends JavadocTester {
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>"); + "</a>");
} }
void testModuleClickThroughLinks() {
checkOutput("module-overview-frame.html", true,
"<li><a href=\"module1-frame.html\" target=\"packageListFrame\" "
+ "onclick=\"updateModuleFrame('module1-type-frame.html','module1-summary.html');"
+ "\">module1</a></li>");
checkOutput("module-overview-frame.html", true,
"<li><a href=\"module2-frame.html\" target=\"packageListFrame\" "
+ "onclick=\"updateModuleFrame('module2-type-frame.html','module2-summary.html');"
+ "\">module2</a></li>");
checkOutput("script.js", true,
"function updateModuleFrame(pFrame, cFrame)\n"
+ "{\n"
+ " top.packageFrame.location = pFrame;\n"
+ " top.classFrame.location = cFrame;\n"
+ "}");
}
void testModuleClickThrough(boolean found) {
checkFiles(found,
"module1-type-frame.html",
"module2-type-frame.html");
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/** /**
* @test * @test
* @bug 8001457 8027477 * @bug 8001457 8027477 8163113
* @author sogoel * @author sogoel
* @summary Reflection api tests * @summary Reflection api tests
* @modules jdk.compiler * @modules jdk.compiler
@ -483,17 +483,17 @@ public class ReflectionTest {
BasicContainer_Legacy( BasicContainer_Legacy(
"@ExpectedBase(value = Foo.class, " "@ExpectedBase(value = Foo.class, "
+ "getAnnotationVal = \"NULL\"," + "getAnnotationVal = \"NULL\","
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnoVal = \"NULL\", " + "getAnnosArgs = {}, " + "getDeclAnnoVal = \"NULL\", " + "getAnnosArgs = {}, "
+ "getDeclAnnosArgs = {} )", + "getDeclAnnosArgs = {} )",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"} )") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -583,21 +583,21 @@ public class ReflectionTest {
"@ExpectedBase(value = Foo.class, " "@ExpectedBase(value = Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\"," + "getAnnotationVal = \"@Foo(value=0)\","
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnoVal = \"@Foo(value=0)\", " + "getDeclAnnoVal = \"@Foo(value=0)\", "
+ "getAnnosArgs = {\"@Foo(value=0)\"}, " + "getAnnosArgs = {\"@Foo(value=0)\"}, "
+ "getDeclAnnosArgs = {\"@Foo(value=0)\"} )", + "getDeclAnnosArgs = {\"@Foo(value=0)\"} )",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"} )") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -691,17 +691,17 @@ public class ReflectionTest {
BasicContainer_Inherited_Legacy( BasicContainer_Inherited_Legacy(
"@ExpectedBase(value = Foo.class, " "@ExpectedBase(value = Foo.class, "
+ "getAnnotationVal = \"NULL\"," + "getAnnotationVal = \"NULL\","
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", " + "getDeclAnnoVal = \"NULL\", "
+ "getAnnosArgs = {}, " + "getAnnosArgs = {}, "
+ "getDeclAnnosArgs = {} )", + "getDeclAnnosArgs = {} )",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", " + "getDeclAnnoVal = \"NULL\", "
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosArgs = {} )") { + "getDeclAnnosArgs = {} )") {
@Override @Override
@ -765,18 +765,18 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\", " + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=0)\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"@Foo(value=0)\"," + "getDeclAnnoVal = \"@Foo(value=0)\","
+ "getAnnosArgs = {\"@Foo(value=0)\"}," + "getAnnosArgs = {\"@Foo(value=0)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=0)\"})", + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=0)\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"NULL\"," + "getDeclAnnoVal = \"NULL\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {})") { + "getDeclAnnosArgs = {})") {
@Override @Override
@ -844,18 +844,18 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\", " + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=0)\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"@Foo(value=0)\"," + "getDeclAnnoVal = \"@Foo(value=0)\","
+ "getAnnosArgs = {\"@Foo(value=0)\"}," + "getAnnosArgs = {\"@Foo(value=0)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=0)\"})", + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=0)\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"NULL\"," + "getDeclAnnoVal = \"NULL\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {})") { + "getDeclAnnosArgs = {})") {
@Override @Override
@ -923,19 +923,19 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\", " + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnoVal = \"NULL\"," + "getDeclAnnoVal = \"NULL\","
+ "getAnnosArgs = {\"@Foo(value=0)\"}," + "getAnnosArgs = {\"@Foo(value=0)\"},"
+ "getDeclAnnosArgs = {})", + "getDeclAnnosArgs = {})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -1000,21 +1000,21 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=3)\", " + "getAnnotationVal = \"@Foo(value=3)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"}, "
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"},"
+ "getDeclAnnoVal = \"@Foo(value=3)\"," + "getDeclAnnoVal = \"@Foo(value=3)\","
+ "getAnnosArgs = {\"@Foo(value=3)\"}," + "getAnnosArgs = {\"@Foo(value=3)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=3)\"})", + "getDeclAnnosArgs = {\"@Foo(value=3)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"}, "
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"},"
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -1077,18 +1077,18 @@ public class ReflectionTest {
BasicRepeatable( BasicRepeatable(
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"NULL\", " + "getAnnotationVal = \"NULL\", "
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\" }, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\" }, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnoVal = \"NULL\"," + "getDeclAnnoVal = \"NULL\","
+ "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}," + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})", + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"} )") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -1179,21 +1179,21 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"NULL\", " + "getAnnotationVal = \"NULL\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnoVal = \"NULL\"," + "getDeclAnnoVal = \"NULL\","
+ "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}," + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})", + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"} )") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -1283,17 +1283,17 @@ public class ReflectionTest {
BasicContainerRepeatable_Inherited( BasicContainerRepeatable_Inherited(
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"NULL\", " + "getAnnotationVal = \"NULL\", "
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", " + "getDeclAnnoVal = \"NULL\", "
+ "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, " + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
+ "getDeclAnnosArgs = {})", + "getDeclAnnosArgs = {})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, " + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", " + "getDeclAnnoVal = \"NULL\", "
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosArgs = {})") { + "getDeclAnnosArgs = {})") {
@Override @Override
@ -1356,7 +1356,7 @@ public class ReflectionTest {
RepeatableAnnoInherited( RepeatableAnnoInherited(
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"NULL\", " + "getAnnotationVal = \"NULL\", "
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ // ignores inherited annotations + // ignores inherited annotations
"getDeclAnnoVal = \"NULL\", " "getDeclAnnoVal = \"NULL\", "
@ -1364,13 +1364,13 @@ public class ReflectionTest {
"getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, " "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
+ "getDeclAnnosArgs = {})", // ignores inherited + "getDeclAnnosArgs = {})", // ignores inherited
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, " + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
+ // ignores inherited annotations + // ignores inherited annotations
"getDeclAnnoVal = \"NULL\", " "getDeclAnnoVal = \"NULL\", "
+ // ignores inherited + // ignores inherited
"getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosArgs = {})") { // ignores inherited + "getDeclAnnosArgs = {})") { // ignores inherited
@Override @Override
@ -1436,21 +1436,21 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\", " + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnoVal = \"@Foo(value=0)\"," + "getDeclAnnoVal = \"@Foo(value=0)\","
+ "getAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\", \"@Foo(value=2)\"}," + "getAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\", \"@Foo(value=2)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\",\"@Foo(value=2)\"})", + "getDeclAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\",\"@Foo(value=2)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -1624,7 +1624,7 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=3)\", " + "getAnnotationVal = \"@Foo(value=3)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ //override every annotation on superClass + //override every annotation on superClass
"getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\"}, " "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\"}, "
+ // ignores inherited annotations + // ignores inherited annotations
@ -1632,13 +1632,13 @@ public class ReflectionTest {
+ "getAnnosArgs = {\"@Foo(value=3)\"}, " + "getAnnosArgs = {\"@Foo(value=3)\"}, "
+ "getDeclAnnosArgs = { \"@Foo(value=3)\" })", // ignores inherited + "getDeclAnnosArgs = { \"@Foo(value=3)\" })", // ignores inherited
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=3)\"}, "
+ // ignores inherited annotations + // ignores inherited annotations
"getDeclAnnoVal = \"NULL\", " "getDeclAnnoVal = \"NULL\", "
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosArgs = {}) // ignores inherited ") { + "getDeclAnnosArgs = {}) // ignores inherited ") {
@Override @Override
@ -1704,22 +1704,22 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\", " + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ //override every annotation on superClass + //override every annotation on superClass
"getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ // ignores inherited annotations + // ignores inherited annotations
"getDeclAnnoVal = \"NULL\","// ignores inherited "getDeclAnnoVal = \"NULL\","// ignores inherited
+ "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, " + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
+ "getDeclAnnosArgs = { \"@Foo(value=1)\", \"@Foo(value=2)\"})", + "getDeclAnnosArgs = { \"@Foo(value=1)\", \"@Foo(value=2)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ // ignores inherited annotations + // ignores inherited annotations
"getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "// ignores inherited "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "// ignores inherited
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -1785,18 +1785,18 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\", " + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"@Foo(value=0)\"," + "getDeclAnnoVal = \"@Foo(value=0)\","
+ "getAnnosArgs = {\"@Foo(value=0)\"}," + "getAnnosArgs = {\"@Foo(value=0)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=0)\"})", + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"NULL\"," + "getDeclAnnoVal = \"NULL\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {})") { + "getDeclAnnosArgs = {})") {
@Override @Override
@ -1863,19 +1863,19 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\", " + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnoVal = \"NULL\"," + "getDeclAnnoVal = \"NULL\","
+ "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}," + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})", + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -1941,21 +1941,21 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=3)\", " + "getAnnotationVal = \"@Foo(value=3)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"}, "
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"},"
+ "getDeclAnnoVal = \"@Foo(value=3)\"," + "getDeclAnnoVal = \"@Foo(value=3)\","
+ "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"}," + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"})", + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"}, "
+ "getDeclAnnosVals = {" + "getDeclAnnosVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}," + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", \"@Foo(value=3)\"},"
+ "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," + "getDeclAnnoVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { + "getDeclAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"})") {
@Override @Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@ -2021,18 +2021,18 @@ public class ReflectionTest {
"@ExpectedBase(value=Foo.class, " "@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"@Foo(value=0)\", " + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"@Foo(value=0)\"," + "getDeclAnnoVal = \"@Foo(value=0)\","
+ "getAnnosArgs = {\"@Foo(value=0)\"}," + "getAnnosArgs = {\"@Foo(value=0)\"},"
+ "getDeclAnnosArgs = {\"@Foo(value=0)\"})", + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
"@ExpectedContainer(value=FooContainer.class, " "@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " + "getAnnotationVal = \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\", "
+ "getAnnotationsVals = {" + "getAnnotationsVals = {"
+ "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"NULL\"," + "getDeclAnnoVal = \"NULL\","
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," + "getAnnosArgs = {\"@FooContainer(value={@Foo(value=1), @Foo(value=2)})\"},"
+ "getDeclAnnosArgs = {})") { + "getDeclAnnosArgs = {})") {
@Override @Override

View File

@ -138,7 +138,7 @@ public class DPrinter {
protected DPrinter(Context context) { protected DPrinter(Context context) {
context.put(DPrinter.class, this); context.put(DPrinter.class, this);
out = context.get(Log.outKey); out = context.get(Log.logKey).getWriter(Log.WriterKind.STDERR);
trees = JavacTrees.instance(context); trees = JavacTrees.instance(context);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -83,6 +83,7 @@ class ReusableContext extends Context implements TaskListener {
drop(Arguments.argsKey); drop(Arguments.argsKey);
drop(DiagnosticListener.class); drop(DiagnosticListener.class);
drop(Log.outKey); drop(Log.outKey);
drop(Log.errKey);
drop(JavaFileManager.class); drop(JavaFileManager.class);
drop(JavacTask.class); drop(JavacTask.class);

View File

@ -0,0 +1,155 @@
/*
* 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.
*/
/*
* @test
* @bug 8162359
* @summary extra space in javac -help for -J and @ options
* @modules jdk.compiler
* @library /tools/lib
* @build toolbox.TestRunner toolbox.ToolBox
* @run main StreamsTest
*/
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import static java.util.Arrays.asList;
import toolbox.TestRunner;
import toolbox.ToolBox;
public class StreamsTest extends TestRunner {
public static void main(String... args) throws Exception {
new StreamsTest().runTests(m -> new Object[] { Paths.get(m.getName()) });
}
StreamsTest() {
super(System.err);
}
ToolBox tb = new ToolBox();
static final String LINESEP = System.getProperty("line.separator");
@Test // errors should be written to stderr
public void testError(Path base) throws Exception {
Path src = base.resolve("src");
Path classes = base.resolve("classes");
tb.writeJavaFiles(src,
"import java.util.*; class C { # }");
test(asList("-d", classes.toString(), src.resolve("C.java").toString()),
null, "illegal character: '#'");
}
@Test // warnings should be written to stderr
public void testWarning(Path base) throws Exception {
Path src = base.resolve("src");
Path classes = base.resolve("classes");
tb.writeJavaFiles(src,
"import java.util.*; class C { List list = new ArrayList(); }");
test(asList("-d", classes.toString(), "-Xlint", src.resolve("C.java").toString()),
null, "warning: [rawtypes]");
}
@Test // notes should be written to stderr
public void testNote(Path base) throws Exception {
Path src = base.resolve("src");
Path classes = base.resolve("classes");
tb.writeJavaFiles(src,
"import java.util.*; class C { List<String> list = (List<String>) new ArrayList(); }");
test(asList("-d", classes.toString(), src.resolve("C.java").toString()),
null, "uses unchecked or unsafe operations.");
}
@Test // help output should be written to stdout
public void testHelp(Path base) throws Exception {
test(asList("-help"), "Usage: javac <options> <source files>", null);
}
@Test // version output should be written to stdout
public void testVersion(Path base) throws Exception {
test(asList("-version"), "javac", null);
}
@Test // version output should be written to stdout
public void testFullVersion(Path base) throws Exception {
test(asList("-fullversion"), "javac full version", null);
}
/**
* Run javac as though run from the command line (but avoiding the entry point that
* calls System.exit()), and that that expected output appears on appropriate output streams.
* @param options the command-line options for javac
* @param expectOut a string that should be contained in the output generated on stdout,
* or null, if no output should be generated to stdout
* @param expectErra string that should be contained in the output generated on stderr,
* or null, if no output should be generated to stderr
* @throws IOException if a problem occurs while setting up the streams
*/
void test(List<String> options, String expectOut, String expectErr) throws IOException {
out.println("test " + options);
ByteArrayOutputStream bsOut = new ByteArrayOutputStream();
ByteArrayOutputStream bsErr = new ByteArrayOutputStream();
try (PrintStream psOut = new PrintStream(bsOut); PrintStream psErr = new PrintStream(bsErr)) {
int rc;
PrintStream saveOut = System.out;
PrintStream saveErr = System.err;
try {
System.setOut(psOut);
System.setErr(psErr);
rc = com.sun.tools.javac.Main.compile(options.toArray(new String[0]));
} finally {
System.setErr(saveErr);
System.setOut(saveOut);
}
System.err.println("javac exit code: " + rc);
}
check("stdout", bsOut.toString(), expectOut);
check("stderr", bsErr.toString(), expectErr);
}
/**
* Check that output is as expected.
* @param name the name of the stream on which the output was found
* @param actual the contents written to the stream
* @param expect string that should be contained in the output, or null, if the output should be empty
*/
void check(String name, String actual, String expect) {
out.println("Check " + name);
out.println("Expected: " + (expect == null ? "(nothing)" : expect));
out.println("Actual:");
out.println(actual.replace("\n", LINESEP));
if (expect == null) {
if (!actual.isEmpty()) {
error(name + ": unexpected output");
}
} else if (!actual.contains(expect)) {
error(name + ": expected output not found");
}
}
}

View File

@ -71,10 +71,4 @@ public class ModuleTestBase extends TestRunner {
Path[] findJavaFiles(Path... paths) throws IOException { Path[] findJavaFiles(Path... paths) throws IOException {
return tb.findJavaFiles(paths); return tb.findJavaFiles(paths);
} }
void error(String message) {
out.println("Error: " + message);
errors++;
}
} }

View File

@ -42,17 +42,23 @@ import toolbox.Task;
import toolbox.ToolBox; import toolbox.ToolBox;
//original test: test/tools/javac/newlines/Newlines.sh //original test: test/tools/javac/newlines/Newlines.sh
/*
* Checks that the usage message, contained in the properties in the
* resource file javac.properties, is correctly rendered, including
* embedded newlines in the resource strings. For more context,
* see JDK-4110560.
*/
public class NewLineTest { public class NewLineTest {
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
ToolBox tb = new ToolBox(); ToolBox tb = new ToolBox();
File javacErrOutput = new File("output.txt"); File javacOutput = new File("output.txt");
new JavacTask(tb, Task.Mode.EXEC) new JavacTask(tb, Task.Mode.EXEC)
.redirect(Task.OutputKind.STDERR, javacErrOutput.getPath()) .redirect(Task.OutputKind.STDOUT, javacOutput.getPath())
.options("-J-Dline.separator='@'") .options("-J-Dline.separator='@'")
.run(Task.Expect.FAIL); .run(Task.Expect.FAIL);
List<String> lines = Files.readAllLines(javacErrOutput.toPath(), List<String> lines = Files.readAllLines(javacOutput.toPath(),
Charset.defaultCharset()); Charset.defaultCharset());
if (lines.size() != 1) { if (lines.size() != 1) {
throw new AssertionError("The compiler output should have one line only"); throw new AssertionError("The compiler output should have one line only");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ public class TestMissingElement extends JavacTestingAbstractProcessor {
@Override @Override
public void init(ProcessingEnvironment env) { public void init(ProcessingEnvironment env) {
super.init(env); super.init(env);
out = ((JavacProcessingEnvironment) env).getContext().get(Log.outKey); out = ((JavacProcessingEnvironment) env).getContext().get(Log.logKey).getWriter(Log.WriterKind.STDERR);
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -57,8 +57,8 @@
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@Bar(value = 0) @Bar(value = 0)
@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
class MixRepeatableAndOfficialContainerBasicTest { class MixRepeatableAndOfficialContainerBasicTest {
@ -85,8 +85,8 @@ class MixRepeatableAndOfficialContainerBasicTest {
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@Bar(value = 0) @Bar(value = 0)
@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
int testField = 0; int testField = 0;
@ -113,8 +113,8 @@ class MixRepeatableAndOfficialContainerBasicTest {
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@Bar(value = 0) @Bar(value = 0)
@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
void testMethod() {} void testMethod() {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 8007961 * @bug 8004822 8007961 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -59,8 +59,8 @@ class E {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "@BarInheritedContainer(" getAnnotation = "@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])", + "value={@BarInherited(value=1), @BarInherited(value=2)})",
getAnnotationsByType = {"@BarInheritedContainer(" getAnnotationsByType = {"@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)}) @BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
class MixRepeatableAndOfficialContainerInheritedA1Test extends E {} class MixRepeatableAndOfficialContainerInheritedA1Test extends E {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -61,9 +61,9 @@ class N {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "@BarInheritedContainer(" getAnnotation = "@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])", + "value={@BarInherited(value=1), @BarInherited(value=2)})",
getAnnotationsByType = {"@BarInheritedContainer(" getAnnotationsByType = {"@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)}) @BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
@BarInherited(value = 3) @BarInherited(value = 3)
class MixRepeatableAndOfficialContainerInheritedA2Test extends N {} class MixRepeatableAndOfficialContainerInheritedA2Test extends N {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 8007961 * @bug 8004822 8007961 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -56,8 +56,8 @@ class M {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "@BarInheritedContainer(" getAnnotation = "@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])", + "value={@BarInherited(value=1), @BarInherited(value=2)})",
getAnnotationsByType = {"@BarInheritedContainer(" getAnnotationsByType = {"@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
@BarInherited(value = 0) @BarInherited(value = 0)
class MixRepeatableAndOfficialContainerInheritedB1Test extends M {} class MixRepeatableAndOfficialContainerInheritedB1Test extends M {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 8007961 * @bug 8004822 8007961 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -57,8 +57,8 @@ class H {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "@BarInheritedContainer(" getAnnotation = "@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])", + "value={@BarInherited(value=1), @BarInherited(value=2)})",
getAnnotationsByType = {"@BarInheritedContainer(" getAnnotationsByType = {"@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
@BarInherited(value = 0) @BarInherited(value = 0)
class MixRepeatableAndOfficialContainerInheritedB2Test extends H {} class MixRepeatableAndOfficialContainerInheritedB2Test extends H {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -53,9 +53,9 @@
@ExpectedContainer( @ExpectedContainer(
value = UnofficialContainer.class, value = UnofficialContainer.class,
getAnnotation = "@UnofficialContainer(" getAnnotation = "@UnofficialContainer("
+ "value=[@Foo(value=1), @Foo(value=2)])", + "value={@Foo(value=1), @Foo(value=2)})",
getAnnotationsByType = {"@UnofficialContainer(" getAnnotationsByType = {"@UnofficialContainer("
+ "value=[@Foo(value=1), @Foo(value=2)])"}) + "value={@Foo(value=1), @Foo(value=2)})"})
@Foo(value = 0) @Foo(value = 0)
@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
class MixSingularAndUnofficialContainerBasicTest { class MixSingularAndUnofficialContainerBasicTest {
@ -79,9 +79,9 @@ class MixSingularAndUnofficialContainerBasicTest {
@ExpectedContainer( @ExpectedContainer(
value = UnofficialContainer.class, value = UnofficialContainer.class,
getAnnotation = "@UnofficialContainer(" getAnnotation = "@UnofficialContainer("
+ "value=[@Foo(value=1), @Foo(value=2)])", + "value={@Foo(value=1), @Foo(value=2)})",
getAnnotationsByType = {"@UnofficialContainer(" getAnnotationsByType = {"@UnofficialContainer("
+ "value=[@Foo(value=1), @Foo(value=2)])"}) + "value={@Foo(value=1), @Foo(value=2)})"})
@Foo(value = 0) @Foo(value = 0)
@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
int testField = 0; int testField = 0;
@ -105,9 +105,9 @@ class MixSingularAndUnofficialContainerBasicTest {
@ExpectedContainer( @ExpectedContainer(
value = UnofficialContainer.class, value = UnofficialContainer.class,
getAnnotation = "@UnofficialContainer(" getAnnotation = "@UnofficialContainer("
+ "value=[@Foo(value=1), @Foo(value=2)])", + "value={@Foo(value=1), @Foo(value=2)})",
getAnnotationsByType = {"@UnofficialContainer(" getAnnotationsByType = {"@UnofficialContainer("
+ "value=[@Foo(value=1), @Foo(value=2)])"}) + "value={@Foo(value=1), @Foo(value=2)})"})
@Foo(value = 0) @Foo(value = 0)
@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
void testMethod() {} void testMethod() {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -56,8 +56,8 @@ class L {}
@ExpectedContainer( @ExpectedContainer(
value = UnofficialInheritedContainer.class, value = UnofficialInheritedContainer.class,
getAnnotation = "@UnofficialInheritedContainer(" getAnnotation = "@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])", + "value={@FooInherited(value=1), @FooInherited(value=2)})",
getAnnotationsByType = {"@UnofficialInheritedContainer(" getAnnotationsByType = {"@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)}) @UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
class MixSingularAndUnofficialContainerInheritedA1Test extends L {} class MixSingularAndUnofficialContainerInheritedA1Test extends L {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -57,9 +57,9 @@ class K {}
@ExpectedContainer( @ExpectedContainer(
value = UnofficialInheritedContainer.class, value = UnofficialInheritedContainer.class,
getAnnotation = "@UnofficialInheritedContainer(" getAnnotation = "@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])", + "value={@FooInherited(value=1), @FooInherited(value=2)})",
getAnnotationsByType = {"@UnofficialInheritedContainer(" getAnnotationsByType = {"@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)}) @UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
@FooInherited(value = 3) @FooInherited(value = 3)
class MixSingularAndUnofficialContainerInheritedA2Test extends K {} class MixSingularAndUnofficialContainerInheritedA2Test extends K {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -56,8 +56,8 @@ class J {}
@ExpectedContainer( @ExpectedContainer(
value = UnofficialInheritedContainer.class, value = UnofficialInheritedContainer.class,
getAnnotation = "@UnofficialInheritedContainer(" getAnnotation = "@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])", + "value={@FooInherited(value=1), @FooInherited(value=2)})",
getAnnotationsByType = {"@UnofficialInheritedContainer(" getAnnotationsByType = {"@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
@FooInherited(value = 0) @FooInherited(value = 0)
class MixSingularAndUnofficialContainerInheritedB1Test extends J {} class MixSingularAndUnofficialContainerInheritedB1Test extends J {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -57,8 +57,8 @@ class G {}
@ExpectedContainer( @ExpectedContainer(
value = UnofficialInheritedContainer.class, value = UnofficialInheritedContainer.class,
getAnnotation = "@UnofficialInheritedContainer(" getAnnotation = "@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])", + "value={@FooInherited(value=1), @FooInherited(value=2)})",
getAnnotationsByType = {"@UnofficialInheritedContainer(" getAnnotationsByType = {"@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
@FooInherited(value = 0) @FooInherited(value = 0)
class MixSingularAndUnofficialContainerInheritedB2Test extends G{} class MixSingularAndUnofficialContainerInheritedB2Test extends G{}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -53,8 +53,8 @@
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
class OfficialContainerBasicTest { class OfficialContainerBasicTest {
@ -77,8 +77,8 @@ class OfficialContainerBasicTest {
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
int testField = 0; int testField = 0;
@ -101,8 +101,8 @@ class OfficialContainerBasicTest {
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
void testMethod() {} void testMethod() {}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -56,7 +56,7 @@ class D {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "@BarInheritedContainer(" getAnnotation = "@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])", + "value={@BarInherited(value=1), @BarInherited(value=2)})",
getAnnotationsByType = {"@BarInheritedContainer(" getAnnotationsByType = {"@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
class OfficialContainerInheritedTest extends D {} class OfficialContainerInheritedTest extends D {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -53,8 +53,8 @@
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@Bar(value = 1) @Bar(value = 1)
@Bar(value = 2) @Bar(value = 2)
class RepeatableBasicTest { class RepeatableBasicTest {
@ -78,8 +78,8 @@ class RepeatableBasicTest {
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@Bar(value = 1) @Bar(value = 1)
@Bar(value = 2) @Bar(value = 2)
int testField = 0; int testField = 0;
@ -103,8 +103,8 @@ class RepeatableBasicTest {
}) })
@ExpectedContainer( @ExpectedContainer(
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", getAnnotation = "@BarContainer(value={@Bar(value=1), @Bar(value=2)})",
getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) getAnnotationsByType = {"@BarContainer(value={@Bar(value=1), @Bar(value=2)})"})
@Bar(value = 1) @Bar(value = 1)
@Bar(value = 2) @Bar(value = 2)
void testMethod() {} void testMethod() {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -57,7 +57,7 @@ class I {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "@BarInheritedContainer(" getAnnotation = "@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])", + "value={@BarInherited(value=1), @BarInherited(value=2)})",
getAnnotationsByType = {"@BarInheritedContainer(" getAnnotationsByType = {"@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
class RepeatableInheritedTest extends I {} class RepeatableInheritedTest extends I {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -52,8 +52,8 @@
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "null", getAnnotation = "null",
getAnnotationsByType = { getAnnotationsByType = {
"@BarContainer(value=[@Bar(value=1)])", "@BarContainer(value={@Bar(value=1)})",
"@BarContainer(value=[@Bar(value=2)])"}) "@BarContainer(value={@Bar(value=2)})"})
@BarContainer(value = {@Bar(value = 1)}) @BarContainer(value = {@Bar(value = 1)})
@BarContainer(value = {@Bar(value = 2)}) @BarContainer(value = {@Bar(value = 2)})
class RepeatableOfficialContainerBasicTest { class RepeatableOfficialContainerBasicTest {
@ -76,8 +76,8 @@ class RepeatableOfficialContainerBasicTest {
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "null", getAnnotation = "null",
getAnnotationsByType = { getAnnotationsByType = {
"@BarContainer(value=[@Bar(value=1)])", "@BarContainer(value={@Bar(value=1)})",
"@BarContainer(value=[@Bar(value=2)])"}) "@BarContainer(value={@Bar(value=2)})"})
@BarContainer(value = {@Bar(value = 1)}) @BarContainer(value = {@Bar(value = 1)})
@BarContainer(value = {@Bar(value = 2)}) @BarContainer(value = {@Bar(value = 2)})
int testField = 0; int testField = 0;
@ -100,8 +100,8 @@ class RepeatableOfficialContainerBasicTest {
value = BarContainer.class, value = BarContainer.class,
getAnnotation = "null", getAnnotation = "null",
getAnnotationsByType = { getAnnotationsByType = {
"@BarContainer(value=[@Bar(value=1)])", "@BarContainer(value={@Bar(value=1)})",
"@BarContainer(value=[@Bar(value=2)])"}) "@BarContainer(value={@Bar(value=2)})"})
@BarContainer(value = {@Bar(value = 1)}) @BarContainer(value = {@Bar(value = 1)})
@BarContainer(value = {@Bar(value = 2)}) @BarContainer(value = {@Bar(value = 2)})
void testMethod() {} void testMethod() {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -43,8 +43,8 @@ class O {}
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "null", getAnnotation = "null",
getAnnotationsByType = { getAnnotationsByType = {
"@BarInheritedContainer(value=[@BarInherited(value=1)])", "@BarInheritedContainer(value={@BarInherited(value=1)})",
"@BarInheritedContainer(value=[@BarInherited(value=2)])" "@BarInheritedContainer(value={@BarInherited(value=2)})"
}, },
getAllAnnotationMirrors = { getAllAnnotationMirrors = {
"@BarInheritedContainerContainer(" "@BarInheritedContainerContainer("
@ -60,9 +60,9 @@ class O {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainerContainer.class, value = BarInheritedContainerContainer.class,
getAnnotation = "@BarInheritedContainerContainer(" getAnnotation = "@BarInheritedContainerContainer("
+ "value=[@BarInheritedContainer(value=[@BarInherited(value=1)])," + "value={@BarInheritedContainer(value={@BarInherited(value=1)}),"
+ " @BarInheritedContainer(value=[@BarInherited(value=2)])])", + " @BarInheritedContainer(value={@BarInherited(value=2)})})",
getAnnotationsByType = {"@BarInheritedContainerContainer(" getAnnotationsByType = {"@BarInheritedContainerContainer("
+ "value=[@BarInheritedContainer(value=[@BarInherited(value=1)])," + "value={@BarInheritedContainer(value={@BarInherited(value=1)}),"
+ " @BarInheritedContainer(value=[@BarInherited(value=2)])])"}) + " @BarInheritedContainer(value={@BarInherited(value=2)})})"})
class RepeatableOfficialContainerInheritedTest extends O {} class RepeatableOfficialContainerInheritedTest extends O {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 8007961 * @bug 8004822 8007961 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -56,8 +56,8 @@ class B {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "@BarInheritedContainer(" getAnnotation = "@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])", + "value={@BarInherited(value=1), @BarInherited(value=2)})",
getAnnotationsByType = {"@BarInheritedContainer(" getAnnotationsByType = {"@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
@BarInherited(value = 3) @BarInherited(value = 3)
class RepeatableOverrideATest extends B {} class RepeatableOverrideATest extends B {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 8007961 * @bug 8004822 8007961 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -58,9 +58,9 @@ class C {}
@ExpectedContainer( @ExpectedContainer(
value = BarInheritedContainer.class, value = BarInheritedContainer.class,
getAnnotation = "@BarInheritedContainer(" getAnnotation = "@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])", + "value={@BarInherited(value=1), @BarInherited(value=2)})",
getAnnotationsByType = {"@BarInheritedContainer(" getAnnotationsByType = {"@BarInheritedContainer("
+ "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) + "value={@BarInherited(value=1), @BarInherited(value=2)})"})
@BarInherited(value = 1) @BarInherited(value = 1)
@BarInherited(value = 2) @BarInherited(value = 2)
class RepeatableOverrideBTest extends C {} class RepeatableOverrideBTest extends C {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -50,8 +50,8 @@
}) })
@ExpectedContainer( @ExpectedContainer(
value = UnofficialContainer.class, value = UnofficialContainer.class,
getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])", getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})",
getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"}) getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"})
@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
class UnofficialContainerBasicTest { class UnofficialContainerBasicTest {
@ -71,8 +71,8 @@ class UnofficialContainerBasicTest {
}) })
@ExpectedContainer( @ExpectedContainer(
value = UnofficialContainer.class, value = UnofficialContainer.class,
getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])", getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})",
getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"}) getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"})
@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
int testField = 0; int testField = 0;
@ -92,8 +92,8 @@ class UnofficialContainerBasicTest {
}) })
@ExpectedContainer( @ExpectedContainer(
value = UnofficialContainer.class, value = UnofficialContainer.class,
getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])", getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})",
getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"}) getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"})
@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
void testMethod() {} void testMethod() {}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8004822 * @bug 8004822 8163113
* @author mnunez * @author mnunez
* @summary Language model api test basics for repeating annotations * @summary Language model api test basics for repeating annotations
* @library /tools/javac/lib * @library /tools/javac/lib
@ -54,7 +54,7 @@ class F {}
@ExpectedContainer( @ExpectedContainer(
value = UnofficialInheritedContainer.class, value = UnofficialInheritedContainer.class,
getAnnotation = "@UnofficialInheritedContainer(" getAnnotation = "@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])", + "value={@FooInherited(value=1), @FooInherited(value=2)})",
getAnnotationsByType = {"@UnofficialInheritedContainer(" getAnnotationsByType = {"@UnofficialInheritedContainer("
+ "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) + "value={@FooInherited(value=1), @FooInherited(value=2)})"})
class UnofficialContainerInheritedTest extends F {} class UnofficialContainerInheritedTest extends F {}

View File

@ -116,4 +116,9 @@ public abstract class TestRunner {
throw new Exception(errorCount + " errors found"); throw new Exception(errorCount + " errors found");
} }
} }
public void error(String message) {
out.println("Error: " + message);
errorCount++;
}
} }