Merge
This commit is contained in:
commit
cd69c60cc0
1
.hgtags
1
.hgtags
@ -23,3 +23,4 @@ caf58ffa084568990cbb3441f9ae188e36b31770 jdk7-b42
|
|||||||
04b2620edc72de93671646e4720c5992c74ac8b5 jdk7-b46
|
04b2620edc72de93671646e4720c5992c74ac8b5 jdk7-b46
|
||||||
0c4657194eec95c08ba478aee9cfc3c295e41657 jdk7-b47
|
0c4657194eec95c08ba478aee9cfc3c295e41657 jdk7-b47
|
||||||
1bf51a4c2627c2f0e0cbcc2cf0421bdb37f1f2b2 jdk7-b48
|
1bf51a4c2627c2f0e0cbcc2cf0421bdb37f1f2b2 jdk7-b48
|
||||||
|
6b84b04a80afe23262377c60913eebfc898f14c4 jdk7-b49
|
||||||
|
@ -23,3 +23,4 @@ a395e3aac4744cc9033fcd819fad1239a45add52 jdk7-b44
|
|||||||
e8a2a4d187773a62f3309b0fa265c13425bc2258 jdk7-b46
|
e8a2a4d187773a62f3309b0fa265c13425bc2258 jdk7-b46
|
||||||
d7744e86dedc21a8ecf6bdb73eb191b8eaf5b0da jdk7-b47
|
d7744e86dedc21a8ecf6bdb73eb191b8eaf5b0da jdk7-b47
|
||||||
4ae9f4bfdb98f65bd957e3fe72471b320150b38e jdk7-b48
|
4ae9f4bfdb98f65bd957e3fe72471b320150b38e jdk7-b48
|
||||||
|
aee93a8992d2389121eb610c00a86196f3e2b9b0 jdk7-b49
|
||||||
|
@ -23,3 +23,4 @@ ccd6a16502e0650d91d85c4b86be05cbcd461a87 jdk7-b42
|
|||||||
1691dbfc08f8ee3f4e23a1ff30cdff920718696c jdk7-b46
|
1691dbfc08f8ee3f4e23a1ff30cdff920718696c jdk7-b46
|
||||||
167ad0164301f318b069a947e1c9c07ed667748a jdk7-b47
|
167ad0164301f318b069a947e1c9c07ed667748a jdk7-b47
|
||||||
0be222241fd405e48915647facfaa176621b39b9 jdk7-b48
|
0be222241fd405e48915647facfaa176621b39b9 jdk7-b48
|
||||||
|
d70978bc64bc7a04be7797ab0dcd9b7b1b3a6bff jdk7-b49
|
||||||
|
@ -23,3 +23,4 @@ fc6a5ae3fef5ebacfa896dbb3ae37715e388e282 jdk7-b43
|
|||||||
16bb38eeda35b46268eefa4c1f829eb086e0ca46 jdk7-b46
|
16bb38eeda35b46268eefa4c1f829eb086e0ca46 jdk7-b46
|
||||||
fcb923bad68e2b10380a030ea83a723f4dc3d4d6 jdk7-b47
|
fcb923bad68e2b10380a030ea83a723f4dc3d4d6 jdk7-b47
|
||||||
bcb33806d186561c781992e5f4d8a90bb033f9f0 jdk7-b48
|
bcb33806d186561c781992e5f4d8a90bb033f9f0 jdk7-b48
|
||||||
|
8b22ccb5aba2c6c11bddf6488a7bb7ef5b4bf2be jdk7-b49
|
||||||
|
@ -23,3 +23,4 @@ b203df0741af3eb08687bc5eb798bac87363758d jdk7-b44
|
|||||||
b2271877894af809b7703767fe8d4e38591a02a2 jdk7-b46
|
b2271877894af809b7703767fe8d4e38591a02a2 jdk7-b46
|
||||||
d711ad1954b294957737ea386cfd4d3c05028a36 jdk7-b47
|
d711ad1954b294957737ea386cfd4d3c05028a36 jdk7-b47
|
||||||
39de90eb4822cafaacc69edd67ab5547e55ae920 jdk7-b48
|
39de90eb4822cafaacc69edd67ab5547e55ae920 jdk7-b48
|
||||||
|
5c1f24531903573c1830775432276da567243f9c jdk7-b49
|
||||||
|
@ -23,3 +23,4 @@ dea7753d713936c5b6fd942a91811b0676537fd0 jdk7-b45
|
|||||||
af4a3eeb7812a5d09a241c50b51b3c648a9d45c1 jdk7-b46
|
af4a3eeb7812a5d09a241c50b51b3c648a9d45c1 jdk7-b46
|
||||||
223011570edbd49bb0fe51cdeb2089f95d305267 jdk7-b47
|
223011570edbd49bb0fe51cdeb2089f95d305267 jdk7-b47
|
||||||
01e5dd31d0c10a2db3d50db346905d2d3db45e88 jdk7-b48
|
01e5dd31d0c10a2db3d50db346905d2d3db45e88 jdk7-b48
|
||||||
|
18ca864890f3d4ed942ecbffb78c936a57759921 jdk7-b49
|
||||||
|
@ -68,37 +68,37 @@ int main(int argc, const char* argv[]) {
|
|||||||
DEFX(ACE_SETACL);
|
DEFX(ACE_SETACL);
|
||||||
|
|
||||||
// ACL mask/flags/types
|
// ACL mask/flags/types
|
||||||
DEFX(ACE_ACCESS_ALLOWED_ACE_TYPE);
|
emitX("ACE_ACCESS_ALLOWED_ACE_TYPE", 0x0000);
|
||||||
DEFX(ACE_ACCESS_DENIED_ACE_TYPE);
|
emitX("ACE_ACCESS_DENIED_ACE_TYPE", 0x0001);
|
||||||
DEFX(ACE_SYSTEM_AUDIT_ACE_TYPE);
|
emitX("ACE_SYSTEM_AUDIT_ACE_TYPE", 0x0002);
|
||||||
DEFX(ACE_SYSTEM_ALARM_ACE_TYPE);
|
emitX("ACE_SYSTEM_ALARM_ACE_TYPE", 0x0003);
|
||||||
DEFX(ACE_READ_DATA);
|
emitX("ACE_READ_DATA", 0x00000001);
|
||||||
DEFX(ACE_LIST_DIRECTORY);
|
emitX("ACE_LIST_DIRECTORY", 0x00000001);
|
||||||
DEFX(ACE_WRITE_DATA);
|
emitX("ACE_WRITE_DATA", 0x00000002);
|
||||||
DEFX(ACE_ADD_FILE);
|
emitX("ACE_ADD_FILE", 0x00000002);
|
||||||
DEFX(ACE_APPEND_DATA);
|
emitX("ACE_APPEND_DATA", 0x00000004);
|
||||||
DEFX(ACE_ADD_SUBDIRECTORY);
|
emitX("ACE_ADD_SUBDIRECTORY", 0x00000004);
|
||||||
DEFX(ACE_READ_NAMED_ATTRS);
|
emitX("ACE_READ_NAMED_ATTRS", 0x00000008);
|
||||||
DEFX(ACE_WRITE_NAMED_ATTRS);
|
emitX("ACE_WRITE_NAMED_ATTRS", 0x00000010);
|
||||||
DEFX(ACE_EXECUTE);
|
emitX("ACE_EXECUTE", 0x00000020);
|
||||||
DEFX(ACE_DELETE_CHILD);
|
emitX("ACE_DELETE_CHILD", 0x00000040);
|
||||||
DEFX(ACE_READ_ATTRIBUTES);
|
emitX("ACE_READ_ATTRIBUTES", 0x00000080);
|
||||||
DEFX(ACE_WRITE_ATTRIBUTES);
|
emitX("ACE_WRITE_ATTRIBUTES", 0x00000100);
|
||||||
DEFX(ACE_DELETE);
|
emitX("ACE_DELETE", 0x00010000);
|
||||||
DEFX(ACE_READ_ACL);
|
emitX("ACE_READ_ACL", 0x00020000);
|
||||||
DEFX(ACE_WRITE_ACL);
|
emitX("ACE_WRITE_ACL", 0x00040000);
|
||||||
DEFX(ACE_WRITE_OWNER);
|
emitX("ACE_WRITE_OWNER", 0x00080000);
|
||||||
DEFX(ACE_SYNCHRONIZE);
|
emitX("ACE_SYNCHRONIZE", 0x00100000);
|
||||||
DEFX(ACE_FILE_INHERIT_ACE);
|
emitX("ACE_FILE_INHERIT_ACE", 0x0001);
|
||||||
DEFX(ACE_DIRECTORY_INHERIT_ACE);
|
emitX("ACE_DIRECTORY_INHERIT_ACE", 0x0002);
|
||||||
DEFX(ACE_NO_PROPAGATE_INHERIT_ACE);
|
emitX("ACE_NO_PROPAGATE_INHERIT_ACE", 0x0004);
|
||||||
DEFX(ACE_INHERIT_ONLY_ACE);
|
emitX("ACE_INHERIT_ONLY_ACE", 0x0008);
|
||||||
DEFX(ACE_SUCCESSFUL_ACCESS_ACE_FLAG);
|
emitX("ACE_SUCCESSFUL_ACCESS_ACE_FLAG", 0x0010);
|
||||||
DEFX(ACE_FAILED_ACCESS_ACE_FLAG);
|
emitX("ACE_FAILED_ACCESS_ACE_FLAG", 0x0020);
|
||||||
DEFX(ACE_IDENTIFIER_GROUP);
|
emitX("ACE_IDENTIFIER_GROUP", 0x0040);
|
||||||
DEFX(ACE_OWNER);
|
emitX("ACE_OWNER", 0x1000);
|
||||||
DEFX(ACE_GROUP);
|
emitX("ACE_GROUP", 0x2000);
|
||||||
DEFX(ACE_EVERYONE);
|
emitX("ACE_EVERYONE", 0x4000);
|
||||||
|
|
||||||
out("} ");
|
out("} ");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -23,3 +23,4 @@ e2f8f6daee9decd5721d598dacf4d0b5915651df jdk7-b43
|
|||||||
be546a6c08e3c31fba2edcae1de43ae3515d2e59 jdk7-b46
|
be546a6c08e3c31fba2edcae1de43ae3515d2e59 jdk7-b46
|
||||||
2b8f6bab23926aa32b9cf7e4c540b9d1ce74b7d5 jdk7-b47
|
2b8f6bab23926aa32b9cf7e4c540b9d1ce74b7d5 jdk7-b47
|
||||||
c53007f34195f69223bdd4125ec6c0740f7d6736 jdk7-b48
|
c53007f34195f69223bdd4125ec6c0740f7d6736 jdk7-b48
|
||||||
|
d17d927ad9bdfafae32451645d182acb7bed7be6 jdk7-b49
|
||||||
|
@ -244,6 +244,29 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether there are any tags to be printed.
|
||||||
|
*
|
||||||
|
* @param doc the Doc object to check for tags.
|
||||||
|
* @return true if there are tags to be printed else return false.
|
||||||
|
*/
|
||||||
|
protected boolean hasTagsToPrint(Doc doc) {
|
||||||
|
if (doc instanceof MethodDoc) {
|
||||||
|
ClassDoc[] intfacs = ((MethodDoc)doc).containingClass().interfaces();
|
||||||
|
MethodDoc overriddenMethod = ((MethodDoc)doc).overriddenMethod();
|
||||||
|
if ((intfacs.length > 0 &&
|
||||||
|
new ImplementedMethods((MethodDoc)doc, this.configuration).build().length > 0) ||
|
||||||
|
overriddenMethod != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TagletOutputImpl output = new TagletOutputImpl("");
|
||||||
|
TagletWriter.genTagOuput(configuration.tagletManager, doc,
|
||||||
|
configuration.tagletManager.getCustomTags(doc),
|
||||||
|
getTagletWriterInstance(false), output);
|
||||||
|
return (output.toString().trim().isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a TagletWriter that knows how to write HTML.
|
* Returns a TagletWriter that knows how to write HTML.
|
||||||
*
|
*
|
||||||
|
@ -164,4 +164,20 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
|||||||
public void writeMemberFooter(FieldDoc member) {
|
public void writeMemberFooter(FieldDoc member) {
|
||||||
writer.dlEnd();
|
writer.dlEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if member details should be printed. If
|
||||||
|
* nocomment option set or if there is no text to be printed
|
||||||
|
* for deprecation info, inline comment, no serial tag or inline tags,
|
||||||
|
* do not print member details.
|
||||||
|
*/
|
||||||
|
public boolean shouldPrintMemberDetails(FieldDoc field) {
|
||||||
|
if (!configuration().nocomment)
|
||||||
|
if((field.inlineTags().length > 0) ||
|
||||||
|
(field.tags("serial").length > 0) || (writer.hasTagsToPrint(field)))
|
||||||
|
return true;
|
||||||
|
if (!Util.isDeprecated(field))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,4 +67,10 @@ public class TagletOutputImpl implements TagletOutput {
|
|||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the taglet output is empty.
|
||||||
|
*/
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return (toString().trim().isEmpty());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,17 @@ public interface SerializedFormWriter {
|
|||||||
* @param member the member to write the header for.
|
* @param member the member to write the header for.
|
||||||
*/
|
*/
|
||||||
public void writeMemberFooter(FieldDoc member);
|
public void writeMemberFooter(FieldDoc member);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if member details should be printed. If
|
||||||
|
* nocomment option set or if there is no text to be printed
|
||||||
|
* for deprecation info, inline comment, no serial tag or inline tags,
|
||||||
|
* do not print member details.
|
||||||
|
*
|
||||||
|
* @param member the member to check details for.
|
||||||
|
* @return true if details need to be printed
|
||||||
|
*/
|
||||||
|
public boolean shouldPrintMemberDetails(FieldDoc member);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -403,16 +403,17 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
|||||||
if (classDoc.definesSerializableFields()) {
|
if (classDoc.definesSerializableFields()) {
|
||||||
FieldDoc serialPersistentField =
|
FieldDoc serialPersistentField =
|
||||||
Util.asList(classDoc.serializableFields()).get(0);
|
Util.asList(classDoc.serializableFields()).get(0);
|
||||||
String comment = serialPersistentField.commentText();
|
// Check to see if there are inline comments, tags or deprecation
|
||||||
if (comment.length() > 0) {
|
// information to be printed.
|
||||||
|
if (fieldWriter.shouldPrintMemberDetails(serialPersistentField)) {
|
||||||
fieldWriter.writeHeader(
|
fieldWriter.writeHeader(
|
||||||
configuration.getText("doclet.Serialized_Form_class"));
|
configuration.getText("doclet.Serialized_Form_class"));
|
||||||
|
fieldWriter.writeMemberDeprecatedInfo(serialPersistentField);
|
||||||
if (!configuration.nocomment) {
|
if (!configuration.nocomment) {
|
||||||
fieldWriter.writeMemberDeprecatedInfo(serialPersistentField);
|
|
||||||
fieldWriter.writeMemberDescription(serialPersistentField);
|
fieldWriter.writeMemberDescription(serialPersistentField);
|
||||||
fieldWriter.writeMemberTags(serialPersistentField);
|
fieldWriter.writeMemberTags(serialPersistentField);
|
||||||
fieldWriter.writeMemberFooter(serialPersistentField);
|
|
||||||
}
|
}
|
||||||
|
fieldWriter.writeMemberFooter(serialPersistentField);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,6 +429,16 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the field deprecation information.
|
||||||
|
*/
|
||||||
|
public void buildFieldDeprecationInfo() {
|
||||||
|
if (!currentClass.definesSerializableFields()) {
|
||||||
|
FieldDoc field = (FieldDoc)currentMember;
|
||||||
|
fieldWriter.writeMemberDeprecatedInfo(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the field information.
|
* Build the field information.
|
||||||
*/
|
*/
|
||||||
@ -459,7 +470,6 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
|||||||
"doclet.MissingSerialTag", cd.qualifiedName(),
|
"doclet.MissingSerialTag", cd.qualifiedName(),
|
||||||
field.name());
|
field.name());
|
||||||
}
|
}
|
||||||
fieldWriter.writeMemberDeprecatedInfo(field);
|
|
||||||
fieldWriter.writeMemberDescription(field);
|
fieldWriter.writeMemberDescription(field);
|
||||||
fieldWriter.writeMemberTags(field);
|
fieldWriter.writeMemberTags(field);
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
|
Copyright 2003 Sun Microsystems, Inc. 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
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
under the terms of the GNU General Public License version 2 only, as
|
||||||
published by the Free Software Foundation. Sun designates this
|
published by the Free Software Foundation. Sun designates this
|
||||||
particular file as subject to the "Classpath" exception as provided
|
particular file as subject to the "Classpath" exception as provided
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
by Sun in the LICENSE file that accompanied this code.
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
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
|
version 2 for more details (a copy is included in the LICENSE file that
|
||||||
accompanied this code).
|
accompanied this code).
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
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,
|
2 along with this work; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
have any questions.
|
have any questions.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
<Doclet>
|
<Doclet>
|
||||||
|
|
||||||
@ -183,8 +183,8 @@
|
|||||||
<MethodHeader/>
|
<MethodHeader/>
|
||||||
<SerializableMethods>
|
<SerializableMethods>
|
||||||
<MethodSubHeader/>
|
<MethodSubHeader/>
|
||||||
|
<DeprecatedMethodInfo/>
|
||||||
<MethodInfo>
|
<MethodInfo>
|
||||||
<DeprecatedMethodInfo/>
|
|
||||||
<MethodDescription/>
|
<MethodDescription/>
|
||||||
<MethodTags/>
|
<MethodTags/>
|
||||||
</MethodInfo>
|
</MethodInfo>
|
||||||
@ -193,6 +193,7 @@
|
|||||||
<FieldHeader/>
|
<FieldHeader/>
|
||||||
<SerializableFields>
|
<SerializableFields>
|
||||||
<FieldSubHeader/>
|
<FieldSubHeader/>
|
||||||
|
<FieldDeprecationInfo/>
|
||||||
<FieldInfo/>
|
<FieldInfo/>
|
||||||
<FieldFooter/>
|
<FieldFooter/>
|
||||||
</SerializableFields>
|
</SerializableFields>
|
||||||
|
@ -25,16 +25,18 @@
|
|||||||
package com.sun.tools.javac.api;
|
package com.sun.tools.javac.api;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
|
import com.sun.tools.javac.api.DiagnosticFormatter.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides simple functionalities for javac diagnostic formatting
|
* Provides simple functionalities for javac diagnostic formatting.
|
||||||
* @param <D> type of diagnostic handled by this formatter
|
* @param <D> type of diagnostic handled by this formatter
|
||||||
*/
|
*/
|
||||||
public interface DiagnosticFormatter<D extends Diagnostic<?>> {
|
public interface DiagnosticFormatter<D extends Diagnostic<?>> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the source code output for this diagnostic is to be displayed
|
* Whether the source code output for this diagnostic is to be displayed.
|
||||||
*
|
*
|
||||||
* @param diag diagnostic to be formatted
|
* @param diag diagnostic to be formatted
|
||||||
* @return true if the source line this diagnostic refers to is to be displayed
|
* @return true if the source line this diagnostic refers to is to be displayed
|
||||||
@ -42,7 +44,7 @@ public interface DiagnosticFormatter<D extends Diagnostic<?>> {
|
|||||||
boolean displaySource(D diag);
|
boolean displaySource(D diag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format the contents of a diagnostics
|
* Format the contents of a diagnostics.
|
||||||
*
|
*
|
||||||
* @param diag the diagnostic to be formatted
|
* @param diag the diagnostic to be formatted
|
||||||
* @param l locale object to be used for i18n
|
* @param l locale object to be used for i18n
|
||||||
@ -115,4 +117,97 @@ public interface DiagnosticFormatter<D extends Diagnostic<?>> {
|
|||||||
*/
|
*/
|
||||||
OFFSET
|
OFFSET
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all the enabled verbosity options.
|
||||||
|
* @return verbosity options
|
||||||
|
*/
|
||||||
|
public Configuration getConfiguration();
|
||||||
|
//where
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface provides functionalities for tuning the output of a
|
||||||
|
* diagnostic formatter in multiple ways.
|
||||||
|
*/
|
||||||
|
interface Configuration {
|
||||||
|
/**
|
||||||
|
* Configure the set of diagnostic parts that should be displayed
|
||||||
|
* by the formatter.
|
||||||
|
* @param options options to set
|
||||||
|
*/
|
||||||
|
public void setVisible(Set<DiagnosticPart> visibleParts);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the set of diagnostic parts that should be displayed
|
||||||
|
* by the formatter.
|
||||||
|
* @return verbosity options
|
||||||
|
*/
|
||||||
|
public Set<DiagnosticPart> getVisible();
|
||||||
|
|
||||||
|
//where
|
||||||
|
/**
|
||||||
|
* A given diagnostic message can be divided into sub-parts each of which
|
||||||
|
* might/might not be displayed by the formatter, according to the
|
||||||
|
* current configuration settings.
|
||||||
|
*/
|
||||||
|
public enum DiagnosticPart {
|
||||||
|
/**
|
||||||
|
* Short description of the diagnostic - usually one line long.
|
||||||
|
*/
|
||||||
|
SUMMARY,
|
||||||
|
/**
|
||||||
|
* Longer description that provides additional details w.r.t. the ones
|
||||||
|
* in the diagnostic's description.
|
||||||
|
*/
|
||||||
|
DETAILS,
|
||||||
|
/**
|
||||||
|
* Source line the diagnostic refers to (if applicable).
|
||||||
|
*/
|
||||||
|
SOURCE,
|
||||||
|
/**
|
||||||
|
* Subdiagnostics attached to a given multiline diagnostic.
|
||||||
|
*/
|
||||||
|
SUBDIAGNOSTICS,
|
||||||
|
/**
|
||||||
|
* JLS paragraph this diagnostic might refer to (if applicable).
|
||||||
|
*/
|
||||||
|
JLS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a limit for multiline diagnostics.
|
||||||
|
* Note: Setting a limit has no effect if multiline diagnostics are either
|
||||||
|
* fully enabled or disabled.
|
||||||
|
*
|
||||||
|
* @param limit the kind of limit to be set
|
||||||
|
* @param value the limit value
|
||||||
|
*/
|
||||||
|
public void setMultilineLimit(MultilineLimit limit, int value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a multiline diagnostic limit.
|
||||||
|
*
|
||||||
|
* @param limit the kind of limit to be retrieved
|
||||||
|
* @return limit value or -1 if no limit is set
|
||||||
|
*/
|
||||||
|
public int getMultilineLimit(MultilineLimit limit);
|
||||||
|
//where
|
||||||
|
/**
|
||||||
|
* A multiline limit control the verbosity of multiline diagnostics
|
||||||
|
* either by setting a maximum depth of nested multidiagnostics,
|
||||||
|
* or by limiting the amount of subdiagnostics attached to a given
|
||||||
|
* diagnostic (or both).
|
||||||
|
*/
|
||||||
|
public enum MultilineLimit {
|
||||||
|
/**
|
||||||
|
* Controls the maximum depth of nested multiline diagnostics.
|
||||||
|
*/
|
||||||
|
DEPTH,
|
||||||
|
/**
|
||||||
|
* Controls the maximum amount of subdiagnostics that are part of a
|
||||||
|
* given multiline diagnostic.
|
||||||
|
*/
|
||||||
|
LENGTH;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public interface Messages {
|
|||||||
void add(String bundleName) throws MissingResourceException;
|
void add(String bundleName) throws MissingResourceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a localized formatted string
|
* Get a localized formatted string.
|
||||||
* @param l locale in which the text is to be localized
|
* @param l locale in which the text is to be localized
|
||||||
* @param key locale-independent message key
|
* @param key locale-independent message key
|
||||||
* @param args misc message arguments
|
* @param args misc message arguments
|
||||||
|
@ -40,6 +40,7 @@ public enum OptionName {
|
|||||||
G_CUSTOM("-g:"),
|
G_CUSTOM("-g:"),
|
||||||
XLINT("-Xlint"),
|
XLINT("-Xlint"),
|
||||||
XLINT_CUSTOM("-Xlint:"),
|
XLINT_CUSTOM("-Xlint:"),
|
||||||
|
DIAGS("-XDdiags="),
|
||||||
NOWARN("-nowarn"),
|
NOWARN("-nowarn"),
|
||||||
VERBOSE("-verbose"),
|
VERBOSE("-verbose"),
|
||||||
DEPRECATION("-deprecation"),
|
DEPRECATION("-deprecation"),
|
||||||
|
@ -145,6 +145,7 @@ public class RecognizedOptions {
|
|||||||
TARGET,
|
TARGET,
|
||||||
VERSION,
|
VERSION,
|
||||||
FULLVERSION,
|
FULLVERSION,
|
||||||
|
DIAGS,
|
||||||
HELP,
|
HELP,
|
||||||
A,
|
A,
|
||||||
X,
|
X,
|
||||||
@ -372,6 +373,21 @@ public class RecognizedOptions {
|
|||||||
return super.process(options, option);
|
return super.process(options, option);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
new HiddenOption(DIAGS) {
|
||||||
|
@Override
|
||||||
|
public boolean process(Options options, String option) {
|
||||||
|
Option xd = getOptions(helper, EnumSet.of(XD))[0];
|
||||||
|
option = option.substring(option.indexOf('=') + 1);
|
||||||
|
String diagsOption = option.contains("%") ?
|
||||||
|
"-XDdiagsFormat=" :
|
||||||
|
"-XDdiags=";
|
||||||
|
diagsOption += option;
|
||||||
|
if (xd.matches(diagsOption))
|
||||||
|
return xd.process(options, diagsOption);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
new Option(HELP, "opt.help") {
|
new Option(HELP, "opt.help") {
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Options options, String option) {
|
public boolean process(Options options, String option) {
|
||||||
|
@ -125,7 +125,7 @@ public class PrintingProcessor extends AbstractProcessor {
|
|||||||
return this;
|
return this;
|
||||||
|
|
||||||
defaultAction(e, true);
|
defaultAction(e, true);
|
||||||
printFormalTypeParameters(e);
|
printFormalTypeParameters(e, true);
|
||||||
|
|
||||||
switch(kind) {
|
switch(kind) {
|
||||||
case CONSTRUCTOR:
|
case CONSTRUCTOR:
|
||||||
@ -207,7 +207,7 @@ public class PrintingProcessor extends AbstractProcessor {
|
|||||||
writer.print(" ");
|
writer.print(" ");
|
||||||
writer.print(e.getSimpleName());
|
writer.print(e.getSimpleName());
|
||||||
|
|
||||||
printFormalTypeParameters(e);
|
printFormalTypeParameters(e, false);
|
||||||
|
|
||||||
// Print superclass information if informative
|
// Print superclass information if informative
|
||||||
if (kind == CLASS) {
|
if (kind == CLASS) {
|
||||||
@ -364,16 +364,9 @@ public class PrintingProcessor extends AbstractProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printFormalTypeParameters(ExecutableElement executable) {
|
private void printFormalTypeParameters(Parameterizable e,
|
||||||
printFormalTypeParameters(executable.getTypeParameters(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printFormalTypeParameters(TypeElement type) {
|
|
||||||
printFormalTypeParameters(type.getTypeParameters(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void printFormalTypeParameters(List<? extends TypeParameterElement> typeParams,
|
|
||||||
boolean pad) {
|
boolean pad) {
|
||||||
|
List<? extends TypeParameterElement> typeParams = e.getTypeParameters();
|
||||||
if (typeParams.size() > 0) {
|
if (typeParams.size() > 0) {
|
||||||
writer.print("<");
|
writer.print("<");
|
||||||
|
|
||||||
|
@ -907,16 +907,16 @@ compiler.err.not.within.bounds.explain=\
|
|||||||
|
|
||||||
compiler.err.prob.found.req=\
|
compiler.err.prob.found.req=\
|
||||||
{0}\n\
|
{0}\n\
|
||||||
found : {1}\n\
|
required: {2}\n\
|
||||||
required: {2}
|
found: {1}
|
||||||
compiler.warn.prob.found.req=\
|
compiler.warn.prob.found.req=\
|
||||||
{0}\n\
|
{0}\n\
|
||||||
found : {1}\n\
|
required: {2}\n\
|
||||||
required: {2}
|
found: {1}
|
||||||
compiler.err.prob.found.req.1=\
|
compiler.err.prob.found.req.1=\
|
||||||
{0} {3}\n\
|
{0} {3}\n\
|
||||||
found : {1}\n\
|
required: {2}\n\
|
||||||
required: {2}
|
found: {1}
|
||||||
|
|
||||||
## The following are all possible strings for the first argument ({0}) of the
|
## The following are all possible strings for the first argument ({0}) of the
|
||||||
## above strings.
|
## above strings.
|
||||||
@ -951,8 +951,8 @@ compiler.misc.assignment.to.extends-bound=\
|
|||||||
|
|
||||||
compiler.err.type.found.req=\
|
compiler.err.type.found.req=\
|
||||||
unexpected type\n\
|
unexpected type\n\
|
||||||
found : {0}\n\
|
required: {1}\n\
|
||||||
required: {1}
|
found: {0}
|
||||||
|
|
||||||
## The following are all possible strings for the first argument ({0}) of the
|
## The following are all possible strings for the first argument ({0}) of the
|
||||||
## above string.
|
## above string.
|
||||||
@ -1003,7 +1003,7 @@ compiler.err.non-static.cant.be.ref=\
|
|||||||
compiler.err.unexpected.type=\
|
compiler.err.unexpected.type=\
|
||||||
unexpected type\n\
|
unexpected type\n\
|
||||||
required: {0}\n\
|
required: {0}\n\
|
||||||
found : {1}
|
found: {1}
|
||||||
|
|
||||||
## The first argument {0} is a "kindname" (e.g. 'constructor', 'field', etc.)
|
## The first argument {0} is a "kindname" (e.g. 'constructor', 'field', etc.)
|
||||||
## The second argument {1} is the non-resolved symbol
|
## The second argument {1} is the non-resolved symbol
|
||||||
@ -1026,17 +1026,17 @@ compiler.err.cant.resolve.args.params=\
|
|||||||
## The sixth argument {5} is the location type
|
## The sixth argument {5} is the location type
|
||||||
compiler.err.cant.resolve.location=\
|
compiler.err.cant.resolve.location=\
|
||||||
cannot find symbol\n\
|
cannot find symbol\n\
|
||||||
symbol : {0} {1}\n\
|
symbol: {0} {1}\n\
|
||||||
location: {4} {5}
|
location: {4} {5}
|
||||||
|
|
||||||
compiler.err.cant.resolve.location.args=\
|
compiler.err.cant.resolve.location.args=\
|
||||||
cannot find symbol\n\
|
cannot find symbol\n\
|
||||||
symbol : {0} {1}({3})\n\
|
symbol: {0} {1}({3})\n\
|
||||||
location: {4} {5}
|
location: {4} {5}
|
||||||
|
|
||||||
compiler.err.cant.resolve.location.args.params=\
|
compiler.err.cant.resolve.location.args.params=\
|
||||||
cannot find symbol\n\
|
cannot find symbol\n\
|
||||||
symbol : {0} <{2}>{1}({3})\n\
|
symbol: {0} <{2}>{1}({3})\n\
|
||||||
location: {4} {5}
|
location: {4} {5}
|
||||||
|
|
||||||
## The following are all possible string for "kindname".
|
## The following are all possible string for "kindname".
|
||||||
|
@ -24,16 +24,23 @@
|
|||||||
*/
|
*/
|
||||||
package com.sun.tools.javac.util;
|
package com.sun.tools.javac.util;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import javax.tools.JavaFileObject;
|
import javax.tools.JavaFileObject;
|
||||||
|
|
||||||
import com.sun.tools.javac.api.DiagnosticFormatter;
|
import com.sun.tools.javac.api.DiagnosticFormatter;
|
||||||
import com.sun.tools.javac.api.Formattable;
|
import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.DiagnosticPart;
|
||||||
|
import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.MultilineLimit;
|
||||||
import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind;
|
import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind;
|
||||||
|
import com.sun.tools.javac.api.Formattable;
|
||||||
import com.sun.tools.javac.file.JavacFileManager;
|
import com.sun.tools.javac.file.JavacFileManager;
|
||||||
|
|
||||||
import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
|
import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
|
||||||
import static com.sun.tools.javac.util.LayoutCharacters.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This abstract class provides a basic implementation of the functionalities that should be provided
|
* This abstract class provides a basic implementation of the functionalities that should be provided
|
||||||
@ -50,35 +57,19 @@ import static com.sun.tools.javac.util.LayoutCharacters.*;
|
|||||||
public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter<JCDiagnostic> {
|
public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter<JCDiagnostic> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JavacMessages object used by this formatter for i18n
|
* JavacMessages object used by this formatter for i18n.
|
||||||
*/
|
*/
|
||||||
protected JavacMessages messages;
|
protected JavacMessages messages;
|
||||||
protected boolean showSource;
|
private SimpleConfiguration config;
|
||||||
|
protected int depth = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object
|
* Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object.
|
||||||
* @param messages
|
* @param messages
|
||||||
*/
|
*/
|
||||||
protected AbstractDiagnosticFormatter(JavacMessages messages, Options options, boolean showSource) {
|
protected AbstractDiagnosticFormatter(JavacMessages messages, SimpleConfiguration config) {
|
||||||
this.messages = messages;
|
this.messages = messages;
|
||||||
this.showSource = options.get("showSource") == null ? showSource :
|
this.config = config;
|
||||||
options.get("showSource").equals("true");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AbstractDiagnosticFormatter(JavacMessages messages, boolean showSource) {
|
|
||||||
this.messages = messages;
|
|
||||||
this.showSource = showSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String formatMessage(JCDiagnostic d, Locale l) {
|
|
||||||
//this code should rely on the locale settings but it's not! See RFE 6443132
|
|
||||||
StringBuilder buf = new StringBuilder();
|
|
||||||
Collection<String> args = formatArguments(d, l);
|
|
||||||
buf.append(localize(l, d.getCode(), args.toArray()));
|
|
||||||
if (d.isMultiline()) {
|
|
||||||
buf.append(formatSubdiagnostics(d, l));
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String formatKind(JCDiagnostic d, Locale l) {
|
public String formatKind(JCDiagnostic d, Locale l) {
|
||||||
@ -96,8 +87,8 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter
|
|||||||
assert (d.getPosition() != Position.NOPOS);
|
assert (d.getPosition() != Position.NOPOS);
|
||||||
return String.valueOf(getPosition(d, pk));
|
return String.valueOf(getPosition(d, pk));
|
||||||
}
|
}
|
||||||
//WHERE
|
//where
|
||||||
public long getPosition(JCDiagnostic d, PositionKind pk) {
|
private long getPosition(JCDiagnostic d, PositionKind pk) {
|
||||||
switch (pk) {
|
switch (pk) {
|
||||||
case START: return d.getIntStartPosition();
|
case START: return d.getIntStartPosition();
|
||||||
case END: return d.getIntEndPosition();
|
case END: return d.getIntEndPosition();
|
||||||
@ -138,8 +129,17 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter
|
|||||||
* @return string representation of the diagnostic argument
|
* @return string representation of the diagnostic argument
|
||||||
*/
|
*/
|
||||||
protected String formatArgument(JCDiagnostic d, Object arg, Locale l) {
|
protected String formatArgument(JCDiagnostic d, Object arg, Locale l) {
|
||||||
if (arg instanceof JCDiagnostic)
|
if (arg instanceof JCDiagnostic) {
|
||||||
return format((JCDiagnostic)arg, l);
|
String s = null;
|
||||||
|
depth++;
|
||||||
|
try {
|
||||||
|
s = formatMessage((JCDiagnostic)arg, l);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
depth--;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
else if (arg instanceof Iterable<?>) {
|
else if (arg instanceof Iterable<?>) {
|
||||||
return formatIterable(d, (Iterable<?>)arg, l);
|
return formatIterable(d, (Iterable<?>)arg, l);
|
||||||
}
|
}
|
||||||
@ -171,45 +171,74 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format all the subdiagnostics attached to a given diagnostic
|
* Format all the subdiagnostics attached to a given diagnostic.
|
||||||
*
|
*
|
||||||
* @param d diagnostic whose subdiagnostics are to be formatted
|
* @param d diagnostic whose subdiagnostics are to be formatted
|
||||||
* @param l locale object to be used for i18n
|
* @param l locale object to be used for i18n
|
||||||
|
* @return list of all string representations of the subdiagnostics
|
||||||
|
*/
|
||||||
|
protected List<String> formatSubdiagnostics(JCDiagnostic d, Locale l) {
|
||||||
|
List<String> subdiagnostics = List.nil();
|
||||||
|
int maxDepth = config.getMultilineLimit(MultilineLimit.DEPTH);
|
||||||
|
if (maxDepth == -1 || depth < maxDepth) {
|
||||||
|
depth++;
|
||||||
|
try {
|
||||||
|
int maxCount = config.getMultilineLimit(MultilineLimit.LENGTH);
|
||||||
|
int count = 0;
|
||||||
|
for (JCDiagnostic d2 : d.getSubdiagnostics()) {
|
||||||
|
if (maxCount == -1 || count < maxCount) {
|
||||||
|
subdiagnostics = subdiagnostics.append(formatSubdiagnostic(d, d2, l));
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
depth--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return subdiagnostics;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a subdiagnostics attached to a given diagnostic.
|
||||||
|
*
|
||||||
|
* @param parent multiline diagnostic whose subdiagnostics is to be formatted
|
||||||
|
* @param sub subdiagnostic to be formatted
|
||||||
|
* @param l locale object to be used for i18n
|
||||||
* @return string representation of the subdiagnostics
|
* @return string representation of the subdiagnostics
|
||||||
*/
|
*/
|
||||||
protected String formatSubdiagnostics(JCDiagnostic d, Locale l) {
|
protected String formatSubdiagnostic(JCDiagnostic parent, JCDiagnostic sub, Locale l) {
|
||||||
StringBuilder buf = new StringBuilder();
|
return formatMessage(sub, l);
|
||||||
for (JCDiagnostic d2 : d.getSubdiagnostics()) {
|
|
||||||
buf.append('\n');
|
|
||||||
String subdiagMsg = format(d2, l);
|
|
||||||
buf.append(indent(subdiagMsg, DiagInc));
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Format the faulty source code line and point to the error.
|
/** Format the faulty source code line and point to the error.
|
||||||
* @param d The diagnostic for which the error line should be printed
|
* @param d The diagnostic for which the error line should be printed
|
||||||
*/
|
*/
|
||||||
protected String formatSourceLine(JCDiagnostic d) {
|
protected String formatSourceLine(JCDiagnostic d, int nSpaces) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
DiagnosticSource source = d.getDiagnosticSource();
|
DiagnosticSource source = d.getDiagnosticSource();
|
||||||
int pos = d.getIntPosition();
|
int pos = d.getIntPosition();
|
||||||
if (d.getIntPosition() != Position.NOPOS) {
|
if (d.getIntPosition() == Position.NOPOS)
|
||||||
String line = (source == null ? null : source.getLine(pos));
|
throw new AssertionError();
|
||||||
if (line == null)
|
String line = (source == null ? null : source.getLine(pos));
|
||||||
return "";
|
if (line == null)
|
||||||
buf.append(line+"\n");
|
return "";
|
||||||
int col = source.getColumnNumber(pos, false);
|
buf.append(indent(line, nSpaces));
|
||||||
|
int col = source.getColumnNumber(pos, false);
|
||||||
|
if (config.isCaretEnabled()) {
|
||||||
|
buf.append("\n");
|
||||||
for (int i = 0; i < col - 1; i++) {
|
for (int i = 0; i < col - 1; i++) {
|
||||||
buf.append((line.charAt(i) == '\t') ? "\t" : " ");
|
buf.append((line.charAt(i) == '\t') ? "\t" : " ");
|
||||||
}
|
}
|
||||||
buf.append("^");
|
buf.append(indent("^", nSpaces));
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a String into a locale-dependent representation accordingly to a given locale
|
* Converts a String into a locale-dependent representation accordingly to a given locale.
|
||||||
*
|
*
|
||||||
* @param l locale object to be used for i18n
|
* @param l locale object to be used for i18n
|
||||||
* @param key locale-independent key used for looking up in a resource file
|
* @param key locale-independent key used for looking up in a resource file
|
||||||
@ -221,7 +250,9 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean displaySource(JCDiagnostic d) {
|
public boolean displaySource(JCDiagnostic d) {
|
||||||
return showSource && d.getType() != FRAGMENT;
|
return config.getVisible().contains(DiagnosticPart.SOURCE) &&
|
||||||
|
d.getType() != FRAGMENT &&
|
||||||
|
d.getIntPosition() != Position.NOPOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -245,7 +276,7 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indent a string by prepending a given amount of empty spaces to each line
|
* Indent a string by prepending a given amount of empty spaces to each line
|
||||||
* of the string
|
* of the string.
|
||||||
*
|
*
|
||||||
* @param s the string to be indented
|
* @param s the string to be indented
|
||||||
* @param nSpaces the amount of spaces that should be prepended to each line
|
* @param nSpaces the amount of spaces that should be prepended to each line
|
||||||
@ -263,4 +294,114 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter
|
|||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SimpleConfiguration getConfiguration() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
static public class SimpleConfiguration implements Configuration {
|
||||||
|
|
||||||
|
protected Map<MultilineLimit, Integer> multilineLimits;
|
||||||
|
protected EnumSet<DiagnosticPart> visibleParts;
|
||||||
|
protected boolean caretEnabled;
|
||||||
|
|
||||||
|
public SimpleConfiguration(Set<DiagnosticPart> parts) {
|
||||||
|
multilineLimits = new HashMap<MultilineLimit, Integer>();
|
||||||
|
setVisible(parts);
|
||||||
|
setMultilineLimit(MultilineLimit.DEPTH, -1);
|
||||||
|
setMultilineLimit(MultilineLimit.LENGTH, -1);
|
||||||
|
setCaretEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("fallthrough")
|
||||||
|
public SimpleConfiguration(Options options, Set<DiagnosticPart> parts) {
|
||||||
|
this(parts);
|
||||||
|
String showSource = null;
|
||||||
|
if ((showSource = options.get("showSource")) != null) {
|
||||||
|
if (showSource.equals("true"))
|
||||||
|
visibleParts.add(DiagnosticPart.SOURCE);
|
||||||
|
else if (showSource.equals("false"))
|
||||||
|
visibleParts.remove(DiagnosticPart.SOURCE);
|
||||||
|
}
|
||||||
|
String diagOpts = options.get("diags");
|
||||||
|
if (diagOpts != null) {//override -XDshowSource
|
||||||
|
Collection<String> args = Arrays.asList(diagOpts.split(","));
|
||||||
|
if (args.contains("short")) {
|
||||||
|
visibleParts.remove(DiagnosticPart.DETAILS);
|
||||||
|
visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS);
|
||||||
|
}
|
||||||
|
if (args.contains("source"))
|
||||||
|
visibleParts.add(DiagnosticPart.SOURCE);
|
||||||
|
if (args.contains("-source"))
|
||||||
|
visibleParts.remove(DiagnosticPart.SOURCE);
|
||||||
|
}
|
||||||
|
String multiPolicy = null;
|
||||||
|
if ((multiPolicy = options.get("multilinePolicy")) != null) {
|
||||||
|
if (multiPolicy.equals("disabled"))
|
||||||
|
visibleParts.remove(DiagnosticPart.SUBDIAGNOSTICS);
|
||||||
|
else if (multiPolicy.startsWith("limit:")) {
|
||||||
|
String limitString = multiPolicy.substring("limit:".length());
|
||||||
|
String[] limits = limitString.split(":");
|
||||||
|
try {
|
||||||
|
switch (limits.length) {
|
||||||
|
case 2: {
|
||||||
|
if (!limits[1].equals("*"))
|
||||||
|
setMultilineLimit(MultilineLimit.DEPTH, Integer.parseInt(limits[1]));
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
if (!limits[0].equals("*"))
|
||||||
|
setMultilineLimit(MultilineLimit.LENGTH, Integer.parseInt(limits[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(NumberFormatException ex) {
|
||||||
|
setMultilineLimit(MultilineLimit.DEPTH, -1);
|
||||||
|
setMultilineLimit(MultilineLimit.LENGTH, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String showCaret = null;
|
||||||
|
if (((showCaret = options.get("showCaret")) != null) &&
|
||||||
|
showCaret.equals("false"))
|
||||||
|
setCaretEnabled(false);
|
||||||
|
else
|
||||||
|
setCaretEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMultilineLimit(MultilineLimit limit) {
|
||||||
|
return multilineLimits.get(limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumSet<DiagnosticPart> getVisible() {
|
||||||
|
return EnumSet.copyOf(visibleParts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultilineLimit(MultilineLimit limit, int value) {
|
||||||
|
multilineLimits.put(limit, value < -1 ? -1 : value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setVisible(Set<DiagnosticPart> diagParts) {
|
||||||
|
visibleParts = EnumSet.copyOf(diagParts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows a '^' sign under the source line displayed by the formatter
|
||||||
|
* (if applicable).
|
||||||
|
*
|
||||||
|
* @param caretEnabled if true enables caret
|
||||||
|
*/
|
||||||
|
public void setCaretEnabled(boolean caretEnabled) {
|
||||||
|
this.caretEnabled = caretEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells whether the caret display is active or not.
|
||||||
|
*
|
||||||
|
* @param caretEnabled if true the caret is enabled
|
||||||
|
*/
|
||||||
|
public boolean isCaretEnabled() {
|
||||||
|
return caretEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,20 @@
|
|||||||
|
|
||||||
package com.sun.tools.javac.util;
|
package com.sun.tools.javac.util;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
import javax.tools.JavaFileObject;
|
import javax.tools.JavaFileObject;
|
||||||
|
|
||||||
import static com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicFormatKind.*;
|
import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration;
|
||||||
|
import com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicConfiguration;
|
||||||
|
|
||||||
import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
|
import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
|
||||||
|
import static com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicConfiguration.*;
|
||||||
|
import static com.sun.tools.javac.util.LayoutCharacters.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic formatter for diagnostic messages.
|
* A basic formatter for diagnostic messages.
|
||||||
@ -53,7 +60,7 @@ import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
|
|||||||
*/
|
*/
|
||||||
public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
||||||
|
|
||||||
protected Map<BasicFormatKind, String> availableFormats;
|
protected int currentIndentation = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a basic formatter based on the supplied options.
|
* Create a basic formatter based on the supplied options.
|
||||||
@ -62,21 +69,8 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
|||||||
* @param msgs JavacMessages object used for i18n
|
* @param msgs JavacMessages object used for i18n
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("fallthrough")
|
@SuppressWarnings("fallthrough")
|
||||||
BasicDiagnosticFormatter(Options opts, JavacMessages msgs) {
|
public BasicDiagnosticFormatter(Options options, JavacMessages msgs) {
|
||||||
super(msgs, opts, true);
|
super(msgs, new BasicConfiguration(options));
|
||||||
initAvailableFormats();
|
|
||||||
String fmt = opts.get("diags");
|
|
||||||
if (fmt != null) {
|
|
||||||
String[] formats = fmt.split("\\|");
|
|
||||||
switch (formats.length) {
|
|
||||||
case 3:
|
|
||||||
availableFormats.put(DEFAULT_CLASS_FORMAT, formats[2]);
|
|
||||||
case 2:
|
|
||||||
availableFormats.put(DEFAULT_NO_POS_FORMAT, formats[1]);
|
|
||||||
default:
|
|
||||||
availableFormats.put(DEFAULT_POS_FORMAT, formats[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,15 +79,7 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
|||||||
* @param msgs JavacMessages object used for i18n
|
* @param msgs JavacMessages object used for i18n
|
||||||
*/
|
*/
|
||||||
public BasicDiagnosticFormatter(JavacMessages msgs) {
|
public BasicDiagnosticFormatter(JavacMessages msgs) {
|
||||||
super(msgs, true);
|
super(msgs, new BasicConfiguration());
|
||||||
initAvailableFormats();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initAvailableFormats() {
|
|
||||||
availableFormats = new HashMap<BasicFormatKind, String>();
|
|
||||||
availableFormats.put(DEFAULT_POS_FORMAT, "%f:%l:%_%t%m");
|
|
||||||
availableFormats.put(DEFAULT_NO_POS_FORMAT, "%p%m");
|
|
||||||
availableFormats.put(DEFAULT_CLASS_FORMAT, "%f:%_%t%m");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String format(JCDiagnostic d, Locale l) {
|
public String format(JCDiagnostic d, Locale l) {
|
||||||
@ -110,10 +96,55 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
|||||||
}
|
}
|
||||||
buf.append(meta ? formatMeta(c, d, l) : String.valueOf(c));
|
buf.append(meta ? formatMeta(c, d, l) : String.valueOf(c));
|
||||||
}
|
}
|
||||||
if (displaySource(d)) {
|
if (depth == 0)
|
||||||
buf.append("\n" + formatSourceLine(d));
|
return addSourceLineIfNeeded(d, buf.toString());
|
||||||
|
else
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String formatMessage(JCDiagnostic d, Locale l) {
|
||||||
|
int prevIndentation = currentIndentation;
|
||||||
|
try {
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
Collection<String> args = formatArguments(d, l);
|
||||||
|
String msg = localize(l, d.getCode(), args.toArray());
|
||||||
|
String[] lines = msg.split("\n");
|
||||||
|
if (getConfiguration().getVisible().contains(DiagnosticPart.SUMMARY)) {
|
||||||
|
currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUMMARY);
|
||||||
|
buf.append(indent(lines[0], currentIndentation)); //summary
|
||||||
|
}
|
||||||
|
if (lines.length > 1 && getConfiguration().getVisible().contains(DiagnosticPart.DETAILS)) {
|
||||||
|
currentIndentation += getConfiguration().getIndentation(DiagnosticPart.DETAILS);
|
||||||
|
for (int i = 1;i < lines.length; i++) {
|
||||||
|
buf.append("\n" + indent(lines[i], currentIndentation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) {
|
||||||
|
currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS);
|
||||||
|
for (String sub : formatSubdiagnostics(d, l)) {
|
||||||
|
buf.append("\n" + sub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
currentIndentation = prevIndentation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
|
||||||
|
if (!displaySource(d))
|
||||||
|
return msg;
|
||||||
|
else {
|
||||||
|
BasicConfiguration conf = getConfiguration();
|
||||||
|
int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
|
||||||
|
String sourceLine = "\n" + formatSourceLine(d, indentSource);
|
||||||
|
boolean singleLine = msg.indexOf("\n") == -1;
|
||||||
|
if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
|
||||||
|
return msg + sourceLine;
|
||||||
|
else
|
||||||
|
return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
|
||||||
}
|
}
|
||||||
return buf.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String formatMeta(char c, JCDiagnostic d, Locale l) {
|
protected String formatMeta(char c, JCDiagnostic d, Locale l) {
|
||||||
@ -164,34 +195,199 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
|||||||
|
|
||||||
private String selectFormat(JCDiagnostic d) {
|
private String selectFormat(JCDiagnostic d) {
|
||||||
DiagnosticSource source = d.getDiagnosticSource();
|
DiagnosticSource source = d.getDiagnosticSource();
|
||||||
String format = availableFormats.get(DEFAULT_NO_POS_FORMAT);
|
String format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT);
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
if (d.getIntPosition() != Position.NOPOS) {
|
if (d.getIntPosition() != Position.NOPOS) {
|
||||||
format = availableFormats.get(DEFAULT_POS_FORMAT);
|
format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_POS_FORMAT);
|
||||||
} else if (source.getFile() != null &&
|
} else if (source.getFile() != null &&
|
||||||
source.getFile().getKind() == JavaFileObject.Kind.CLASS) {
|
source.getFile().getKind() == JavaFileObject.Kind.CLASS) {
|
||||||
format = availableFormats.get(DEFAULT_CLASS_FORMAT);
|
format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* This enum contains all the kinds of formatting patterns supported
|
public BasicConfiguration getConfiguration() {
|
||||||
* by a basic diagnostic formatter.
|
return (BasicConfiguration)super.getConfiguration();
|
||||||
*/
|
}
|
||||||
public enum BasicFormatKind {
|
|
||||||
|
static public class BasicConfiguration extends SimpleConfiguration {
|
||||||
|
|
||||||
|
protected Map<DiagnosticPart, Integer> indentationLevels;
|
||||||
|
protected Map<BasicFormatKind, String> availableFormats;
|
||||||
|
protected SourcePosition sourcePosition;
|
||||||
|
|
||||||
|
@SuppressWarnings("fallthrough")
|
||||||
|
public BasicConfiguration(Options options) {
|
||||||
|
super(options, EnumSet.of(DiagnosticPart.SUMMARY,
|
||||||
|
DiagnosticPart.DETAILS,
|
||||||
|
DiagnosticPart.SUBDIAGNOSTICS,
|
||||||
|
DiagnosticPart.SOURCE));
|
||||||
|
initFormat();
|
||||||
|
initIndentation();
|
||||||
|
String fmt = options.get("diagsFormat");
|
||||||
|
if (fmt != null) {
|
||||||
|
String[] formats = fmt.split("\\|");
|
||||||
|
switch (formats.length) {
|
||||||
|
case 3:
|
||||||
|
setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, formats[2]);
|
||||||
|
case 2:
|
||||||
|
setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, formats[1]);
|
||||||
|
default:
|
||||||
|
setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, formats[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String sourcePosition = null;
|
||||||
|
if ((((sourcePosition = options.get("sourcePosition")) != null)) &&
|
||||||
|
sourcePosition.equals("bottom"))
|
||||||
|
setSourcePosition(SourcePosition.BOTTOM);
|
||||||
|
else
|
||||||
|
setSourcePosition(SourcePosition.AFTER_SUMMARY);
|
||||||
|
String indent = options.get("diagsIndentation");
|
||||||
|
if (indent != null) {
|
||||||
|
String[] levels = indent.split("\\|");
|
||||||
|
try {
|
||||||
|
switch (levels.length) {
|
||||||
|
case 5:
|
||||||
|
setIndentation(DiagnosticPart.JLS,
|
||||||
|
Integer.parseInt(levels[4]));
|
||||||
|
case 4:
|
||||||
|
setIndentation(DiagnosticPart.SUBDIAGNOSTICS,
|
||||||
|
Integer.parseInt(levels[3]));
|
||||||
|
case 3:
|
||||||
|
setIndentation(DiagnosticPart.SOURCE,
|
||||||
|
Integer.parseInt(levels[2]));
|
||||||
|
case 2:
|
||||||
|
setIndentation(DiagnosticPart.DETAILS,
|
||||||
|
Integer.parseInt(levels[1]));
|
||||||
|
default:
|
||||||
|
setIndentation(DiagnosticPart.SUMMARY,
|
||||||
|
Integer.parseInt(levels[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex) {
|
||||||
|
initIndentation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BasicConfiguration() {
|
||||||
|
super(EnumSet.of(DiagnosticPart.SUMMARY,
|
||||||
|
DiagnosticPart.DETAILS,
|
||||||
|
DiagnosticPart.SUBDIAGNOSTICS,
|
||||||
|
DiagnosticPart.SOURCE));
|
||||||
|
initFormat();
|
||||||
|
initIndentation();
|
||||||
|
}
|
||||||
|
//where
|
||||||
|
private void initFormat() {
|
||||||
|
availableFormats = new HashMap<BasicFormatKind, String>();
|
||||||
|
setFormat(BasicFormatKind.DEFAULT_POS_FORMAT, "%f:%l:%_%t%m");
|
||||||
|
setFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT, "%p%m");
|
||||||
|
setFormat(BasicFormatKind.DEFAULT_CLASS_FORMAT, "%f:%_%t%m");
|
||||||
|
}
|
||||||
|
//where
|
||||||
|
private void initIndentation() {
|
||||||
|
indentationLevels = new HashMap<DiagnosticPart, Integer>();
|
||||||
|
setIndentation(DiagnosticPart.SUMMARY, 0);
|
||||||
|
setIndentation(DiagnosticPart.DETAILS, DetailsInc);
|
||||||
|
setIndentation(DiagnosticPart.SUBDIAGNOSTICS, DiagInc);
|
||||||
|
setIndentation(DiagnosticPart.SOURCE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A format string to be used for diagnostics with a given position.
|
* Get the amount of spaces for a given indentation kind
|
||||||
*/
|
* @param diagPart the diagnostic part for which the indentation is
|
||||||
DEFAULT_POS_FORMAT,
|
* to be retrieved
|
||||||
|
* @return the amount of spaces used for the specified indentation kind
|
||||||
|
*/
|
||||||
|
public int getIndentation(DiagnosticPart diagPart) {
|
||||||
|
return indentationLevels.get(diagPart);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A format string to be used for diagnostics without a given position.
|
* Set the indentation level for various element of a given diagnostic -
|
||||||
*/
|
* this might lead to more readable diagnostics
|
||||||
DEFAULT_NO_POS_FORMAT,
|
*
|
||||||
|
* @param indentationKind kind of indentation to be set
|
||||||
|
* @param nSpaces amount of spaces for the specified diagnostic part
|
||||||
|
*/
|
||||||
|
public void setIndentation(DiagnosticPart diagPart, int nSpaces) {
|
||||||
|
indentationLevels.put(diagPart, nSpaces);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A format string to be used for diagnostics regarding classfiles
|
* Set the source line positioning used by this formatter
|
||||||
*/
|
*
|
||||||
DEFAULT_CLASS_FORMAT;
|
* @param sourcePos a positioning value for source line
|
||||||
|
*/
|
||||||
|
public void setSourcePosition(SourcePosition sourcePos) {
|
||||||
|
sourcePosition = sourcePos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the source line positioning used by this formatter
|
||||||
|
*
|
||||||
|
* @return the positioning value used by this formatter
|
||||||
|
*/
|
||||||
|
public SourcePosition getSourcePosition() {
|
||||||
|
return sourcePosition;
|
||||||
|
}
|
||||||
|
//where
|
||||||
|
/**
|
||||||
|
* A source positioning value controls the position (within a given
|
||||||
|
* diagnostic message) in which the source line the diagnostic refers to
|
||||||
|
* should be displayed (if applicable)
|
||||||
|
*/
|
||||||
|
public enum SourcePosition {
|
||||||
|
/**
|
||||||
|
* Source line is displayed after the diagnostic message
|
||||||
|
*/
|
||||||
|
BOTTOM,
|
||||||
|
/**
|
||||||
|
* Source line is displayed after the first line of the diagnostic
|
||||||
|
* message
|
||||||
|
*/
|
||||||
|
AFTER_SUMMARY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a metachar string for a specific format
|
||||||
|
*
|
||||||
|
* @param kind the format kind to be set
|
||||||
|
* @param s the metachar string specifying the format
|
||||||
|
*/
|
||||||
|
public void setFormat(BasicFormatKind kind, String s) {
|
||||||
|
availableFormats.put(kind, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a metachar string for a specific format
|
||||||
|
*
|
||||||
|
* @param sourcePos a positioning value for source line
|
||||||
|
*/
|
||||||
|
public String getFormat(BasicFormatKind kind) {
|
||||||
|
return availableFormats.get(kind);
|
||||||
|
}
|
||||||
|
//where
|
||||||
|
/**
|
||||||
|
* This enum contains all the kinds of formatting patterns supported
|
||||||
|
* by a basic diagnostic formatter.
|
||||||
|
*/
|
||||||
|
public enum BasicFormatKind {
|
||||||
|
/**
|
||||||
|
* A format string to be used for diagnostics with a given position.
|
||||||
|
*/
|
||||||
|
DEFAULT_POS_FORMAT,
|
||||||
|
/**
|
||||||
|
* A format string to be used for diagnostics without a given position.
|
||||||
|
*/
|
||||||
|
DEFAULT_NO_POS_FORMAT,
|
||||||
|
/**
|
||||||
|
* A format string to be used for diagnostics regarding classfiles
|
||||||
|
*/
|
||||||
|
DEFAULT_CLASS_FORMAT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,13 @@ public interface LayoutCharacters {
|
|||||||
*/
|
*/
|
||||||
final static int TabInc = 8;
|
final static int TabInc = 8;
|
||||||
|
|
||||||
/** Diagnostic standard indentation
|
/** Standard indentation for subdiagnostics
|
||||||
*/
|
*/
|
||||||
final static int DiagInc = 2;
|
final static int DiagInc = 4;
|
||||||
|
|
||||||
|
/** Standard indentation for additional diagnostic lines
|
||||||
|
*/
|
||||||
|
final static int DetailsInc = 2;
|
||||||
|
|
||||||
/** Tabulator character.
|
/** Tabulator character.
|
||||||
*/
|
*/
|
||||||
|
@ -93,17 +93,17 @@ public class Log extends AbstractLog {
|
|||||||
protected DiagnosticListener<? super JavaFileObject> diagListener;
|
protected DiagnosticListener<? super JavaFileObject> diagListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formatter for diagnostics
|
* Formatter for diagnostics.
|
||||||
*/
|
*/
|
||||||
private DiagnosticFormatter<JCDiagnostic> diagFormatter;
|
private DiagnosticFormatter<JCDiagnostic> diagFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keys for expected diagnostics
|
* Keys for expected diagnostics.
|
||||||
*/
|
*/
|
||||||
public Set<String> expectDiagKeys;
|
public Set<String> expectDiagKeys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JavacMessages object used for localization
|
* JavacMessages object used for localization.
|
||||||
*/
|
*/
|
||||||
private JavacMessages messages;
|
private JavacMessages messages;
|
||||||
|
|
||||||
@ -206,6 +206,18 @@ public class Log extends AbstractLog {
|
|||||||
return source == null ? null : source.getFile();
|
return source == null ? null : source.getFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the current diagnostic formatter.
|
||||||
|
*/
|
||||||
|
public DiagnosticFormatter<JCDiagnostic> getDiagnosticFormatter() {
|
||||||
|
return diagFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set the current diagnostic formatter.
|
||||||
|
*/
|
||||||
|
public void setDiagnosticFormatter(DiagnosticFormatter<JCDiagnostic> diagFormatter) {
|
||||||
|
this.diagFormatter = diagFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
/** Flush the logs
|
/** Flush the logs
|
||||||
*/
|
*/
|
||||||
public void flush() {
|
public void flush() {
|
||||||
|
@ -24,9 +24,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.sun.tools.javac.util;
|
package com.sun.tools.javac.util;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.*;
|
||||||
import com.sun.tools.javac.api.Formattable;
|
import com.sun.tools.javac.api.Formattable;
|
||||||
|
import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration;
|
||||||
|
|
||||||
import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
|
import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,14 +40,17 @@ import static com.sun.tools.javac.api.DiagnosticFormatter.PositionKind.*;
|
|||||||
* or not the source name and position are set. This formatter provides a standardized, localize-independent
|
* or not the source name and position are set. This formatter provides a standardized, localize-independent
|
||||||
* implementation of a diagnostic formatter; as such, this formatter is best suited for testing purposes.
|
* implementation of a diagnostic formatter; as such, this formatter is best suited for testing purposes.
|
||||||
*/
|
*/
|
||||||
public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
public final class RawDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a formatter based on the supplied options.
|
* Create a formatter based on the supplied options.
|
||||||
* @param msgs
|
* @param msgs
|
||||||
*/
|
*/
|
||||||
public RawDiagnosticFormatter(Options opts) {
|
public RawDiagnosticFormatter(Options options) {
|
||||||
super(null, opts, false);
|
super(null, new SimpleConfiguration(options,
|
||||||
|
EnumSet.of(DiagnosticPart.SUMMARY,
|
||||||
|
DiagnosticPart.DETAILS,
|
||||||
|
DiagnosticPart.SUBDIAGNOSTICS)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//provide common default formats
|
//provide common default formats
|
||||||
@ -62,7 +70,7 @@ public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
|||||||
buf.append(' ');
|
buf.append(' ');
|
||||||
buf.append(formatMessage(d, null));
|
buf.append(formatMessage(d, null));
|
||||||
if (displaySource(d))
|
if (displaySource(d))
|
||||||
buf.append("\n" + formatSourceLine(d));
|
buf.append("\n" + formatSourceLine(d, 0));
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
@ -71,6 +79,32 @@ public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String formatMessage(JCDiagnostic d, Locale l) {
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
Collection<String> args = formatArguments(d, l);
|
||||||
|
buf.append(d.getCode());
|
||||||
|
String sep = ": ";
|
||||||
|
for (Object o : args) {
|
||||||
|
buf.append(sep);
|
||||||
|
buf.append(o);
|
||||||
|
sep = ", ";
|
||||||
|
}
|
||||||
|
if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) {
|
||||||
|
List<String> subDiags = formatSubdiagnostics(d, null);
|
||||||
|
if (subDiags.nonEmpty()) {
|
||||||
|
sep = "";
|
||||||
|
buf.append(",{");
|
||||||
|
for (String sub : formatSubdiagnostics(d, null)) {
|
||||||
|
buf.append(sep);
|
||||||
|
buf.append("(" + sub + ")");
|
||||||
|
sep = ",";
|
||||||
|
}
|
||||||
|
buf.append('}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
|
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
|
||||||
String s;
|
String s;
|
||||||
@ -83,31 +117,4 @@ public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
|||||||
else
|
else
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String formatSubdiagnostics(JCDiagnostic d, Locale l) {
|
|
||||||
StringBuilder buf = new StringBuilder();
|
|
||||||
String sep = "";
|
|
||||||
buf.append(",{");
|
|
||||||
for (JCDiagnostic d2 : d.getSubdiagnostics()) {
|
|
||||||
buf.append(sep);
|
|
||||||
buf.append("(" + format(d2, l) + ")");
|
|
||||||
sep = ",";
|
|
||||||
}
|
|
||||||
buf.append('}');
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String localize(Locale l, String s, Object... args) {
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
buf.append(s);
|
|
||||||
String sep = ": ";
|
|
||||||
for (Object o : args) {
|
|
||||||
buf.append(sep);
|
|
||||||
buf.append(o);
|
|
||||||
sep = ", ";
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2005-2009 Sun Microsystems, Inc. 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
|
||||||
@ -40,7 +40,7 @@ import javax.lang.model.type.*;
|
|||||||
* @see ExecutableType
|
* @see ExecutableType
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public interface ExecutableElement extends Element {
|
public interface ExecutableElement extends Element, Parameterizable {
|
||||||
/**
|
/**
|
||||||
* Returns the formal type parameters of this executable
|
* Returns the formal type parameters of this executable
|
||||||
* in declaration order.
|
* in declaration order.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2005-2009 Sun Microsystems, Inc. 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
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
package javax.lang.model.element;
|
package javax.lang.model.element;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a package program element. Provides access to information
|
* Represents a package program element. Provides access to information
|
||||||
* about the package and its members.
|
* about the package and its members.
|
||||||
@ -36,8 +35,7 @@ package javax.lang.model.element;
|
|||||||
* @see javax.lang.model.util.Elements#getPackageOf
|
* @see javax.lang.model.util.Elements#getPackageOf
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
|
public interface PackageElement extends Element, QualifiedNameable {
|
||||||
public interface PackageElement extends Element {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the fully qualified name of this package.
|
* Returns the fully qualified name of this package.
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package javax.lang.model.element;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mixin interface for an element that has type parameters.
|
||||||
|
*
|
||||||
|
* @author Joseph D. Darcy
|
||||||
|
* @since 1.7
|
||||||
|
*/
|
||||||
|
public interface Parameterizable extends Element {
|
||||||
|
/**
|
||||||
|
* Returns the formal type parameters of the type element in
|
||||||
|
* declaration order.
|
||||||
|
*
|
||||||
|
* @return the formal type parameters, or an empty list
|
||||||
|
* if there are none
|
||||||
|
*/
|
||||||
|
List<? extends TypeParameterElement> getTypeParameters();
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package javax.lang.model.element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mixin interface for an element that has a qualified name.
|
||||||
|
*
|
||||||
|
* @author Joseph D. Darcy
|
||||||
|
* @since 1.7
|
||||||
|
*/
|
||||||
|
public interface QualifiedNameable extends Element {
|
||||||
|
/**
|
||||||
|
* Returns the fully qualified name of an element.
|
||||||
|
*
|
||||||
|
* @return the fully qualified name of an element
|
||||||
|
*/
|
||||||
|
Name getQualifiedName();
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
|
* Copyright 2005-2009 Sun Microsystems, Inc. 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
|
||||||
@ -59,7 +59,7 @@ import javax.lang.model.util.*;
|
|||||||
* @see DeclaredType
|
* @see DeclaredType
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public interface TypeElement extends Element {
|
public interface TypeElement extends Element, Parameterizable, QualifiedNameable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <i>nesting kind</i> of this type element.
|
* Returns the <i>nesting kind</i> of this type element.
|
||||||
|
@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6802694
|
||||||
|
* @summary This test verifies deprecation info in serialized-form.html.
|
||||||
|
* @author Bhavesh Patel
|
||||||
|
* @library ../lib/
|
||||||
|
* @build JavadocTester
|
||||||
|
* @build TestSerializedFormDeprecationInfo
|
||||||
|
* @run main TestSerializedFormDeprecationInfo
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TestSerializedFormDeprecationInfo extends JavadocTester {
|
||||||
|
|
||||||
|
private static final String BUG_ID = "6802694";
|
||||||
|
|
||||||
|
// Test for normal run of javadoc. The serialized-form.html should
|
||||||
|
// display the inline comments, tags and deprecation information if any.
|
||||||
|
private static final String[][] TEST_CMNT_DEPR = {
|
||||||
|
{BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL + NL +
|
||||||
|
"<DT><STRONG>Throws:</STRONG>" + NL + "<DD><CODE>" +
|
||||||
|
"java.io.IOException</CODE><DT><STRONG>See Also:</STRONG>" +
|
||||||
|
"<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||||
|
"<CODE>C1.setUndecorated(boolean)</CODE></A></DD>" + NL +
|
||||||
|
"</DL>" + NL + "</DL>"},
|
||||||
|
{BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
|
||||||
|
"<DD><STRONG>Deprecated.</STRONG> <I>As of JDK version" +
|
||||||
|
" 1.5, replaced by" + NL +
|
||||||
|
" <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||||
|
"<CODE>setUndecorated(boolean)</CODE></A>.</I>" +
|
||||||
|
"<DD>This field indicates whether the C1 is undecorated." + NL +
|
||||||
|
"<P>" + NL + "<DT><DD> <DL>" + NL +
|
||||||
|
"<DT><STRONG>Since:</STRONG></DT>" + NL +
|
||||||
|
" <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
|
||||||
|
"<DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||||
|
"<CODE>C1.setUndecorated(boolean)</CODE></A></DL>" + NL +
|
||||||
|
"</DL>"},
|
||||||
|
{BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
|
||||||
|
"<DD><STRONG>Deprecated.</STRONG> <I>As of JDK version" +
|
||||||
|
" 1.5, replaced by" + NL +
|
||||||
|
" <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||||
|
"<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
|
||||||
|
"<DD>Reads the object stream." + NL + "<P>" + NL +
|
||||||
|
"<DD><DL>" + NL + NL + "<DT><STRONG>Throws:" +
|
||||||
|
"</STRONG>" + NL + "<DD><CODE><code>" +
|
||||||
|
"IOException</code></CODE>" + NL +
|
||||||
|
"<DD><CODE>java.io.IOException</CODE></DD>" + NL +
|
||||||
|
"</DL>" + NL + "</DL>"},
|
||||||
|
{BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
|
||||||
|
"<DD><STRONG>Deprecated.</STRONG> <DD>" +
|
||||||
|
"The name for this class." + NL + "<P>" + NL +
|
||||||
|
"<DT><DD> <DL>" + NL + "</DL>" + NL + "</DL>"}};
|
||||||
|
|
||||||
|
// Test with -nocomment option. The serialized-form.html should
|
||||||
|
// not display the inline comments and tags but should display deprecation
|
||||||
|
// information if any.
|
||||||
|
private static final String[][] TEST_NOCMNT = {
|
||||||
|
{BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "boolean <STRONG>" +
|
||||||
|
"undecorated</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
|
||||||
|
"Deprecated.</STRONG> <I>As of JDK version 1.5, replaced by" + NL +
|
||||||
|
" <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\"><CODE>" +
|
||||||
|
"setUndecorated(boolean)</CODE></A>.</I></DL>"},
|
||||||
|
{BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" +
|
||||||
|
"Deprecated.</STRONG> <I>As of JDK version" +
|
||||||
|
" 1.5, replaced by" + NL +
|
||||||
|
" <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
|
||||||
|
"<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
|
||||||
|
"</DL>"},
|
||||||
|
{BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
|
||||||
|
"publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
|
||||||
|
"Deprecated.</STRONG> </DL>"}};
|
||||||
|
|
||||||
|
// Test with -nodeprecated option. The serialized-form.html should
|
||||||
|
// ignore the -nodeprecated tag and display the deprecation info. This
|
||||||
|
// test is similar to the normal run of javadoc in which inline comment, tags
|
||||||
|
// and deprecation information will be displayed.
|
||||||
|
private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
|
||||||
|
|
||||||
|
// Test with -nodeprecated and -nocomment options. The serialized-form.html should
|
||||||
|
// ignore the -nodeprecated tag and display the deprecation info but should not
|
||||||
|
// display the inline comments and tags. This test is similar to the test with
|
||||||
|
// -nocomment option.
|
||||||
|
private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
|
||||||
|
|
||||||
|
private static final String[] ARGS1 =
|
||||||
|
new String[] {
|
||||||
|
"-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
|
||||||
|
|
||||||
|
private static final String[] ARGS2 =
|
||||||
|
new String[] {
|
||||||
|
"-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
|
||||||
|
|
||||||
|
private static final String[] ARGS3 =
|
||||||
|
new String[] {
|
||||||
|
"-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
|
||||||
|
|
||||||
|
private static final String[] ARGS4 =
|
||||||
|
new String[] {
|
||||||
|
"-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry point of the test.
|
||||||
|
* @param args the array of command line arguments.
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
|
||||||
|
run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
|
||||||
|
run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
|
||||||
|
run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
|
||||||
|
run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
|
||||||
|
tester.printSummary();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public String getBugId() {
|
||||||
|
return BUG_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public String getBugName() {
|
||||||
|
return getClass().getName();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pkg1;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class comment for testing.
|
||||||
|
*
|
||||||
|
* @author Bhavesh Patel
|
||||||
|
* @see C2
|
||||||
|
* @since JDK1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class C1 implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This field indicates whether the C1 is undecorated.
|
||||||
|
*
|
||||||
|
* @see #setUndecorated(boolean)
|
||||||
|
* @since 1.4
|
||||||
|
* @serial
|
||||||
|
* @deprecated As of JDK version 1.5, replaced by
|
||||||
|
* {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public boolean undecorated = false;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This enum specifies the possible modal exclusion types.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public static enum ModalExclusionType {
|
||||||
|
/**
|
||||||
|
* No modal exclusion.
|
||||||
|
*/
|
||||||
|
NO_EXCLUDE,
|
||||||
|
/**
|
||||||
|
* <code>APPLICATION_EXCLUDE</code> indicates that a top-level window
|
||||||
|
* won't be blocked by any application-modal dialogs. Also, it isn't
|
||||||
|
* blocked by document-modal dialogs from outside of its child hierarchy.
|
||||||
|
*/
|
||||||
|
APPLICATION_EXCLUDE
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param title the title
|
||||||
|
* @param test boolean value
|
||||||
|
* @exception IllegalArgumentException if the <code>owner</code>'s
|
||||||
|
* <code>GraphicsConfiguration</code> is not from a screen device
|
||||||
|
* @exception HeadlessException
|
||||||
|
*/
|
||||||
|
public C1(String title, boolean test) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public C1(String title) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method comments.
|
||||||
|
* @param undecorated <code>true</code> if no decorations are
|
||||||
|
* to be enabled;
|
||||||
|
* <code>false</code> if decorations are to be enabled.
|
||||||
|
* @see #readObject()
|
||||||
|
* @since 1.4
|
||||||
|
*/
|
||||||
|
public void setUndecorated(boolean undecorated) {
|
||||||
|
/* Make sure we don't run in the middle of peer creation.*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see #setUndecorated(boolean)
|
||||||
|
*/
|
||||||
|
public void readObject() throws IOException {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pkg1;
|
||||||
|
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class comment for testing.
|
||||||
|
*
|
||||||
|
* @author Bhavesh Patel
|
||||||
|
* @see C1
|
||||||
|
* @since JDK1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class C2 implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This field indicates title.
|
||||||
|
*/
|
||||||
|
String title;
|
||||||
|
|
||||||
|
public static enum ModalType {
|
||||||
|
NO_EXCLUDE
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public C2() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public C2(String title) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set visible.
|
||||||
|
*
|
||||||
|
* @param set boolean
|
||||||
|
* @since 1.4
|
||||||
|
* @deprecated As of JDK version 1.5, replaced by
|
||||||
|
* {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setVisible(boolean set) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the object stream.
|
||||||
|
*
|
||||||
|
* @param s ObjectInputStream
|
||||||
|
* @throws <code>IOException</code>
|
||||||
|
* @deprecated As of JDK version 1.5, replaced by
|
||||||
|
* {@link C1#setUndecorated(boolean) setUndecorated(boolean)}.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void readObject(ObjectInputStream s) throws IOException {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package pkg1;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for Serializable
|
||||||
|
*
|
||||||
|
* @author Bhavesh Patel
|
||||||
|
* @deprecated This class is no longer used.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public abstract class C3 implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name for this class.
|
||||||
|
*
|
||||||
|
* @serial
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @serial
|
||||||
|
*/
|
||||||
|
private int publicKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for serialization only.
|
||||||
|
*/
|
||||||
|
protected C3() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints general information.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void printInfo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,18 @@
|
|||||||
T6304921.java:671/671/680: warning: [rawtypes] found raw type: java.util.ArrayList
|
T6304921.java:671/671/680: warning: [rawtypes] found raw type: java.util.ArrayList
|
||||||
missing type parameters for generic class java.util.ArrayList<E>
|
|
||||||
List<Integer> list = new ArrayList();
|
List<Integer> list = new ArrayList();
|
||||||
^
|
^
|
||||||
|
missing type parameters for generic class java.util.ArrayList<E>
|
||||||
T6304921.java:667/667/682: warning: [unchecked] unchecked conversion
|
T6304921.java:667/667/682: warning: [unchecked] unchecked conversion
|
||||||
found : java.util.ArrayList
|
|
||||||
required: java.util.List<java.lang.Integer>
|
|
||||||
List<Integer> list = new ArrayList();
|
List<Integer> list = new ArrayList();
|
||||||
^
|
^
|
||||||
|
required: java.util.List<java.lang.Integer>
|
||||||
|
found: java.util.ArrayList
|
||||||
error: warnings found and -Werror specified
|
error: warnings found and -Werror specified
|
||||||
T6304921.java:727/733/737: cannot find symbol
|
T6304921.java:727/733/737: cannot find symbol
|
||||||
symbol : variable orr
|
|
||||||
location: class java.lang.System
|
|
||||||
System.orr.println("abc"); // name not found
|
System.orr.println("abc"); // name not found
|
||||||
^
|
^
|
||||||
|
symbol: variable orr
|
||||||
|
location: class java.lang.System
|
||||||
T6304921.java:812/816/822: operator + cannot be applied to int,boolean
|
T6304921.java:812/816/822: operator + cannot be applied to int,boolean
|
||||||
return 123 + true; // bad binary expression
|
return 123 + true; // bad binary expression
|
||||||
^
|
^
|
||||||
|
@ -54,8 +54,8 @@ public class Test {
|
|||||||
throw new Error("no diagnostics generated");
|
throw new Error("no diagnostics generated");
|
||||||
|
|
||||||
String expected = "B.java:6:6: compiler.err.cant.access: p.A, " +
|
String expected = "B.java:6:6: compiler.err.cant.access: p.A, " +
|
||||||
"(- compiler.misc.bad.class.file.header: A.class, " +
|
"(compiler.misc.bad.class.file.header: A.class, " +
|
||||||
"(- compiler.misc.class.file.wrong.class: q.A))";
|
"(compiler.misc.class.file.wrong.class: q.A))";
|
||||||
|
|
||||||
if (!out[0].equals(expected)) {
|
if (!out[0].equals(expected)) {
|
||||||
System.err.println("expected: " + expected);
|
System.err.println("expected: " + expected);
|
||||||
|
@ -1 +1 @@
|
|||||||
Test.java:10:6: compiler.err.cant.access: p.A, (- compiler.misc.bad.source.file.header: A.java, (- compiler.misc.file.doesnt.contain.class: p.A))
|
Test.java:10:6: compiler.err.cant.access: p.A, (compiler.misc.bad.source.file.header: A.java, (compiler.misc.file.doesnt.contain.class: p.A))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
T6758789b.java:39:11: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
|
T6758789b.java:39:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
|
||||||
T6758789b.java:39:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
|
T6758789b.java:39:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
|
||||||
- compiler.err.warnings.and.werror
|
- compiler.err.warnings.and.werror
|
||||||
1 error
|
1 error
|
||||||
|
499
langtools/test/tools/javac/Diagnostics/6769027/T6769027.java
Normal file
499
langtools/test/tools/javac/Diagnostics/6769027/T6769027.java
Normal file
@ -0,0 +1,499 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 6769027
|
||||||
|
* @summary Source line should be displayed immediately after the first diagnostic line
|
||||||
|
* @author Maurizio Cimadamore
|
||||||
|
* @run main/othervm T6769027
|
||||||
|
*/
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import javax.tools.*;
|
||||||
|
import com.sun.tools.javac.util.*;
|
||||||
|
|
||||||
|
public class T6769027 {
|
||||||
|
|
||||||
|
enum OutputKind {
|
||||||
|
RAW("rawDiagnostics","rawDiagnostics"),
|
||||||
|
BASIC("","");
|
||||||
|
|
||||||
|
String key;
|
||||||
|
String value;
|
||||||
|
|
||||||
|
void init(Options opts) {
|
||||||
|
opts.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputKind(String key, String value) {
|
||||||
|
this.key = key;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum CaretKind {
|
||||||
|
DEFAULT("", ""),
|
||||||
|
SHOW("showCaret","true"),
|
||||||
|
HIDE("showCaret","false");
|
||||||
|
|
||||||
|
String key;
|
||||||
|
String value;
|
||||||
|
|
||||||
|
void init(Options opts) {
|
||||||
|
opts.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
CaretKind(String key, String value) {
|
||||||
|
this.key = key;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isEnabled() {
|
||||||
|
return this == DEFAULT || this == SHOW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SourceLineKind {
|
||||||
|
DEFAULT("", ""),
|
||||||
|
AFTER_SUMMARY("sourcePosition", "top"),
|
||||||
|
BOTTOM("sourcePosition", "bottom");
|
||||||
|
|
||||||
|
String key;
|
||||||
|
String value;
|
||||||
|
|
||||||
|
void init(Options opts) {
|
||||||
|
opts.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLineKind(String key, String value) {
|
||||||
|
this.key = key;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isAfterSummary() {
|
||||||
|
return this == DEFAULT || this == AFTER_SUMMARY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum XDiagsSource {
|
||||||
|
DEFAULT(""),
|
||||||
|
SOURCE("source"),
|
||||||
|
NO_SOURCE("-source");
|
||||||
|
|
||||||
|
String flag;
|
||||||
|
|
||||||
|
void init(Options opts) {
|
||||||
|
if (this != DEFAULT) {
|
||||||
|
String flags = opts.get("diags");
|
||||||
|
flags = flags == null ? flag : flags + "," + flag;
|
||||||
|
opts.put("diags", flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XDiagsSource(String flag) {
|
||||||
|
this.flag = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getOutput(CaretKind caretKind, IndentKind indent, OutputKind outKind) {
|
||||||
|
String spaces = (outKind == OutputKind.BASIC) ? indent.string : "";
|
||||||
|
return "\n" + spaces + "This is a source line" +
|
||||||
|
(caretKind.isEnabled() ? "\n" + spaces + " ^" : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum XDiagsCompact {
|
||||||
|
DEFAULT(""),
|
||||||
|
COMPACT("short"),
|
||||||
|
NO_COMPACT("-short");
|
||||||
|
|
||||||
|
String flag;
|
||||||
|
|
||||||
|
void init(Options opts) {
|
||||||
|
if (this != DEFAULT) {
|
||||||
|
String flags = opts.get("diags");
|
||||||
|
flags = flags == null ? flag : flags + "," + flag;
|
||||||
|
opts.put("diags", flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XDiagsCompact(String flag) {
|
||||||
|
this.flag = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ErrorKind {
|
||||||
|
SINGLE("single",
|
||||||
|
"compiler.err.single: Hello!",
|
||||||
|
"KXThis is a test error message Hello!"),
|
||||||
|
DOUBLE("double",
|
||||||
|
"compiler.err.double: Hello!",
|
||||||
|
"KXThis is a test error message.\n" +
|
||||||
|
"KXYThis is another line of the above error message Hello!");
|
||||||
|
|
||||||
|
String key;
|
||||||
|
String rawOutput;
|
||||||
|
String nonRawOutput;
|
||||||
|
|
||||||
|
String key() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorKind(String key, String rawOutput, String nonRawOutput) {
|
||||||
|
this.key = key;
|
||||||
|
this.rawOutput = rawOutput;
|
||||||
|
this.nonRawOutput = nonRawOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getOutput(OutputKind outKind, IndentKind summaryIndent, IndentKind detailsIndent) {
|
||||||
|
return outKind == OutputKind.RAW ?
|
||||||
|
rawOutput :
|
||||||
|
nonRawOutput.replace("X", summaryIndent.string).replace("Y", detailsIndent.string).replace("K", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
String getOutput(OutputKind outKind, IndentKind summaryIndent, IndentKind detailsIndent, String indent) {
|
||||||
|
return outKind == OutputKind.RAW ?
|
||||||
|
rawOutput :
|
||||||
|
nonRawOutput.replace("X", summaryIndent.string).replace("Y", detailsIndent.string).replace("K", indent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum MultilineKind {
|
||||||
|
NONE(0),
|
||||||
|
DOUBLE(1),
|
||||||
|
NESTED(2),
|
||||||
|
DOUBLE_NESTED(3);
|
||||||
|
|
||||||
|
static String[][] rawTemplates = {
|
||||||
|
{"", ",{(E),(E)}", ",{(E,{(E)})}", ",{(E,{(E)}),(E,{(E)})}"}, //ENABLED
|
||||||
|
{"", "", "", "",""}, //DISABLED
|
||||||
|
{"", ",{(E)}", ",{(E,{(E)})}", ",{(E,{(E)})}"}, //LIMIT_LENGTH
|
||||||
|
{"", ",{(E),(E)}", ",{(E)}", ",{(E),(E)}"}, //LIMIT_DEPTH
|
||||||
|
{"", ",{(E)}", ",{(E)}", ",{(E)}"}}; //LIMIT_BOTH
|
||||||
|
|
||||||
|
static String[][] basicTemplates = {
|
||||||
|
{"", "\nE\nE", "\nE\nQ", "\nE\nQ\nE\nQ"}, //ENABLED
|
||||||
|
{"", "", "", "",""}, //DISABLED
|
||||||
|
{"", "\nE", "\nE\nQ", "\nE\nQ"}, //LIMIT_LENGTH
|
||||||
|
{"", "\nE\nE", "\nE", "\nE\nE"}, //LIMIT_DEPTH
|
||||||
|
{"", "\nE", "\nE", "\nE"}}; //LIMIT_BOTH
|
||||||
|
|
||||||
|
|
||||||
|
int index;
|
||||||
|
|
||||||
|
MultilineKind (int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isDouble() {
|
||||||
|
return this == DOUBLE || this == DOUBLE_NESTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isNested() {
|
||||||
|
return this == NESTED || this == DOUBLE_NESTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getOutput(OutputKind outKind, ErrorKind errKind, MultilinePolicy policy,
|
||||||
|
IndentKind summaryIndent, IndentKind detailsIndent, IndentKind multiIndent) {
|
||||||
|
String constIndent = (errKind == ErrorKind.DOUBLE) ?
|
||||||
|
summaryIndent.string + detailsIndent.string :
|
||||||
|
summaryIndent.string;
|
||||||
|
constIndent += multiIndent.string;
|
||||||
|
|
||||||
|
String errMsg1 = errKind.getOutput(outKind, summaryIndent, detailsIndent, constIndent);
|
||||||
|
String errMsg2 = errKind.getOutput(outKind, summaryIndent, detailsIndent, constIndent + constIndent);
|
||||||
|
|
||||||
|
errMsg1 = errMsg1.replaceAll("compiler.err", "compiler.misc");
|
||||||
|
errMsg1 = errMsg1.replaceAll("error message", "subdiagnostic");
|
||||||
|
errMsg2 = errMsg2.replaceAll("compiler.err", "compiler.misc");
|
||||||
|
errMsg2 = errMsg2.replaceAll("error message", "subdiagnostic");
|
||||||
|
|
||||||
|
String template = outKind == OutputKind.RAW ?
|
||||||
|
rawTemplates[policy.index][index] :
|
||||||
|
basicTemplates[policy.index][index];
|
||||||
|
|
||||||
|
template = template.replaceAll("E", errMsg1);
|
||||||
|
return template.replaceAll("Q", errMsg2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum MultilinePolicy {
|
||||||
|
ENABLED(0, "multilinePolicy", "enabled"),
|
||||||
|
DISABLED(1, "multilinePolicy", "disabled"),
|
||||||
|
LIMIT_LENGTH(2, "multilinePolicy", "limit:1:*"),
|
||||||
|
LIMIT_DEPTH(3, "multilinePolicy", "limit:*:1"),
|
||||||
|
LIMIT_BOTH(4, "multilinePolicy", "limit:1:1");
|
||||||
|
|
||||||
|
String name;
|
||||||
|
String value;
|
||||||
|
int index;
|
||||||
|
|
||||||
|
MultilinePolicy(int index, String name, String value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
void init(Options options) {
|
||||||
|
options.put(name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum PositionKind {
|
||||||
|
NOPOS(Position.NOPOS, "- ", "error: "),
|
||||||
|
POS(5, "/Test.java:1:6: ", "myfo:/Test.java:1: ");
|
||||||
|
|
||||||
|
int pos;
|
||||||
|
String rawOutput;
|
||||||
|
String nonRawOutput;
|
||||||
|
|
||||||
|
PositionKind(int pos, String rawOutput, String nonRawOutput) {
|
||||||
|
this.pos = pos;
|
||||||
|
this.rawOutput = rawOutput;
|
||||||
|
this.nonRawOutput = nonRawOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
JCDiagnostic.DiagnosticPosition pos() {
|
||||||
|
return new JCDiagnostic.SimpleDiagnosticPosition(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getOutput(OutputKind outputKind) {
|
||||||
|
return outputKind == OutputKind.RAW ?
|
||||||
|
rawOutput :
|
||||||
|
nonRawOutput;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MyFileObject extends SimpleJavaFileObject {
|
||||||
|
private String text;
|
||||||
|
public MyFileObject(String text) {
|
||||||
|
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum IndentKind {
|
||||||
|
NONE(""),
|
||||||
|
CUSTOM(" ");
|
||||||
|
|
||||||
|
String string;
|
||||||
|
|
||||||
|
IndentKind(String indent) {
|
||||||
|
string = indent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyLog extends Log {
|
||||||
|
MyLog(Context ctx) {
|
||||||
|
super(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.io.PrintWriter getWriterForDiagnosticType(JCDiagnostic.DiagnosticType dt) {
|
||||||
|
return new java.io.PrintWriter(System.out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldReport(JavaFileObject jfo, int pos) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int nerrors = 0;
|
||||||
|
|
||||||
|
void exec(OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
|
||||||
|
MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
|
||||||
|
XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
|
||||||
|
IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
|
||||||
|
IndentKind subdiagsIndent) {
|
||||||
|
Context ctx = new Context();
|
||||||
|
Options options = Options.instance(ctx);
|
||||||
|
outputKind.init(options);
|
||||||
|
multiPolicy.init(options);
|
||||||
|
xdiagsSource.init(options);
|
||||||
|
xdiagsCompact.init(options);
|
||||||
|
caretKind.init(options);
|
||||||
|
sourceLineKind.init(options);
|
||||||
|
String indentString = "";
|
||||||
|
indentString = (summaryIndent == IndentKind.CUSTOM) ? "3" : "0";
|
||||||
|
indentString += (detailsIndent == IndentKind.CUSTOM) ? "|3" : "|0";
|
||||||
|
indentString += (sourceIndent == IndentKind.CUSTOM) ? "|3" : "|0";
|
||||||
|
indentString += (subdiagsIndent == IndentKind.CUSTOM) ? "|3" : "|0";
|
||||||
|
options.put("diagsIndentation", indentString);
|
||||||
|
MyLog log = new MyLog(ctx);
|
||||||
|
JavacMessages messages = JavacMessages.instance(ctx);
|
||||||
|
messages.add("tester");
|
||||||
|
JCDiagnostic.Factory diags = JCDiagnostic.Factory.instance(ctx);
|
||||||
|
log.useSource(new MyFileObject("This is a source line"));
|
||||||
|
JCDiagnostic d = diags.error(log.currentSource(),
|
||||||
|
posKind.pos(),
|
||||||
|
errorKind.key(), "Hello!");
|
||||||
|
if (multiKind != MultilineKind.NONE) {
|
||||||
|
JCDiagnostic sub = diags.fragment(errorKind.key(), "Hello!");
|
||||||
|
if (multiKind.isNested())
|
||||||
|
sub = new JCDiagnostic.MultilineDiagnostic(sub, List.of(sub));
|
||||||
|
List<JCDiagnostic> subdiags = multiKind.isDouble() ?
|
||||||
|
List.of(sub, sub) :
|
||||||
|
List.of(sub);
|
||||||
|
d = new JCDiagnostic.MultilineDiagnostic(d, subdiags);
|
||||||
|
}
|
||||||
|
String diag = log.getDiagnosticFormatter().format(d, messages.getCurrentLocale());
|
||||||
|
checkOutput(diag,
|
||||||
|
outputKind,
|
||||||
|
errorKind,
|
||||||
|
multiKind,
|
||||||
|
multiPolicy,
|
||||||
|
posKind,
|
||||||
|
xdiagsSource,
|
||||||
|
xdiagsCompact,
|
||||||
|
caretKind,
|
||||||
|
sourceLineKind,
|
||||||
|
summaryIndent,
|
||||||
|
detailsIndent,
|
||||||
|
sourceIndent,
|
||||||
|
subdiagsIndent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
for (OutputKind outputKind : OutputKind.values()) {
|
||||||
|
for (ErrorKind errKind : ErrorKind.values()) {
|
||||||
|
for (MultilineKind multiKind : MultilineKind.values()) {
|
||||||
|
for (MultilinePolicy multiPolicy : MultilinePolicy.values()) {
|
||||||
|
for (PositionKind posKind : PositionKind.values()) {
|
||||||
|
for (XDiagsSource xdiagsSource : XDiagsSource.values()) {
|
||||||
|
for (XDiagsCompact xdiagsCompact : XDiagsCompact.values()) {
|
||||||
|
for (CaretKind caretKind : CaretKind.values()) {
|
||||||
|
for (SourceLineKind sourceLineKind : SourceLineKind.values()) {
|
||||||
|
for (IndentKind summaryIndent : IndentKind.values()) {
|
||||||
|
for (IndentKind detailsIndent : IndentKind.values()) {
|
||||||
|
for (IndentKind sourceIndent : IndentKind.values()) {
|
||||||
|
for (IndentKind subdiagsIndent : IndentKind.values()) {
|
||||||
|
exec(outputKind,
|
||||||
|
errKind,
|
||||||
|
multiKind,
|
||||||
|
multiPolicy,
|
||||||
|
posKind,
|
||||||
|
xdiagsSource,
|
||||||
|
xdiagsCompact,
|
||||||
|
caretKind,
|
||||||
|
sourceLineKind,
|
||||||
|
summaryIndent,
|
||||||
|
detailsIndent,
|
||||||
|
sourceIndent,
|
||||||
|
subdiagsIndent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nerrors != 0)
|
||||||
|
throw new AssertionError(nerrors + " errors found");
|
||||||
|
}
|
||||||
|
|
||||||
|
void printInfo(String msg, OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
|
||||||
|
MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
|
||||||
|
XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
|
||||||
|
IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
|
||||||
|
IndentKind subdiagsIndent, String errorLine) {
|
||||||
|
String sep = "*********************************************************";
|
||||||
|
String desc = "raw=" + outputKind + " pos=" + posKind + " key=" + errorKind.key() +
|
||||||
|
" multiline=" + multiKind +" multiPolicy=" + multiPolicy.value +
|
||||||
|
" diags= " + java.util.Arrays.asList(xdiagsSource.flag, xdiagsCompact.flag) +
|
||||||
|
" caret=" + caretKind + " sourcePosition=" + sourceLineKind +
|
||||||
|
" summaryIndent=" + summaryIndent + " detailsIndent=" + detailsIndent +
|
||||||
|
" sourceIndent=" + sourceIndent + " subdiagsIndent=" + subdiagsIndent;
|
||||||
|
System.out.println(sep);
|
||||||
|
System.out.println(desc);
|
||||||
|
System.out.println(sep);
|
||||||
|
System.out.println(msg);
|
||||||
|
System.out.println("Diagnostic formatting problem - expected diagnostic...\n" + errorLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkOutput(String msg, OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
|
||||||
|
MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
|
||||||
|
XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
|
||||||
|
IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
|
||||||
|
IndentKind subdiagsIndent) {
|
||||||
|
boolean shouldPrintSource = posKind == PositionKind.POS &&
|
||||||
|
xdiagsSource != XDiagsSource.NO_SOURCE &&
|
||||||
|
(xdiagsSource == XDiagsSource.SOURCE ||
|
||||||
|
outputKind == OutputKind.BASIC);
|
||||||
|
String errorLine = posKind.getOutput(outputKind) +
|
||||||
|
errorKind.getOutput(outputKind, summaryIndent, detailsIndent);
|
||||||
|
if (xdiagsCompact != XDiagsCompact.COMPACT)
|
||||||
|
errorLine += multiKind.getOutput(outputKind, errorKind, multiPolicy, summaryIndent, detailsIndent, subdiagsIndent);
|
||||||
|
String[] lines = errorLine.split("\n");
|
||||||
|
if (xdiagsCompact == XDiagsCompact.COMPACT) {
|
||||||
|
errorLine = lines[0];
|
||||||
|
lines = new String[] {errorLine};
|
||||||
|
}
|
||||||
|
if (shouldPrintSource) {
|
||||||
|
if (sourceLineKind.isAfterSummary()) {
|
||||||
|
String sep = "\n";
|
||||||
|
if (lines.length == 1) {
|
||||||
|
errorLine += "\n";
|
||||||
|
sep = "";
|
||||||
|
}
|
||||||
|
errorLine = errorLine.replaceFirst("\n",
|
||||||
|
Matcher.quoteReplacement(xdiagsSource.getOutput(caretKind, sourceIndent, outputKind) + sep));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
errorLine += xdiagsSource.getOutput(caretKind, sourceIndent, outputKind);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!msg.equals(errorLine)) {
|
||||||
|
printInfo(msg,
|
||||||
|
outputKind,
|
||||||
|
errorKind,
|
||||||
|
multiKind,
|
||||||
|
multiPolicy,
|
||||||
|
posKind,
|
||||||
|
xdiagsSource,
|
||||||
|
xdiagsCompact,
|
||||||
|
caretKind,
|
||||||
|
sourceLineKind,
|
||||||
|
summaryIndent,
|
||||||
|
detailsIndent,
|
||||||
|
sourceIndent,
|
||||||
|
subdiagsIndent,
|
||||||
|
errorLine);
|
||||||
|
nerrors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String... args) throws Exception {
|
||||||
|
new T6769027().test();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
compiler.err.single=\
|
||||||
|
This is a test error message {0}
|
||||||
|
|
||||||
|
compiler.err.double=\
|
||||||
|
This is a test error message.\n\
|
||||||
|
This is another line of the above error message {0}
|
||||||
|
|
||||||
|
compiler.misc.single=\
|
||||||
|
This is a test subdiagnostic {0}
|
||||||
|
|
||||||
|
compiler.misc.double=\
|
||||||
|
This is a test subdiagnostic.\n\
|
||||||
|
This is another line of the above subdiagnostic {0}
|
@ -1,6 +1,6 @@
|
|||||||
ExtendArray.java:11: unexpected type
|
ExtendArray.java:11: unexpected type
|
||||||
found : java.lang.Object[]
|
|
||||||
required: class
|
|
||||||
public class ExtendArray extends Object[] {}
|
public class ExtendArray extends Object[] {}
|
||||||
^
|
^
|
||||||
|
required: class
|
||||||
|
found: java.lang.Object[]
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
T5048776.java:12:10: compiler.warn.override.varargs.missing: (- compiler.misc.varargs.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1)
|
T5048776.java:12:10: compiler.warn.override.varargs.missing: (compiler.misc.varargs.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1)
|
||||||
T5048776.java:20:10: compiler.warn.override.varargs.extra: (- compiler.misc.varargs.override: foo(java.lang.Object[]), A2a, foo(java.lang.Object...), A2)
|
T5048776.java:20:10: compiler.warn.override.varargs.extra: (compiler.misc.varargs.override: foo(java.lang.Object[]), A2a, foo(java.lang.Object...), A2)
|
||||||
2 warnings
|
2 warnings
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
T6214885.java:11 cannot find symbol
|
T6214885.java:11 cannot find symbol
|
||||||
symbol : variable x
|
|
||||||
location: class T6214885
|
|
||||||
x = 1;
|
x = 1;
|
||||||
^
|
^
|
||||||
|
symbol: variable x
|
||||||
|
location: class T6214885
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
T6214885.java:11:9 cannot find symbol
|
T6214885.java:11:9 cannot find symbol
|
||||||
symbol : variable x
|
|
||||||
location: class T6214885
|
|
||||||
x = 1;
|
x = 1;
|
||||||
^
|
^
|
||||||
|
symbol: variable x
|
||||||
|
location: class T6214885
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
T6230128.java:11:10: compiler.err.override.weaker.access: (- compiler.misc.cant.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1), public
|
T6230128.java:11:10: compiler.err.override.weaker.access: (compiler.misc.cant.override: foo(java.lang.Object...), A1a, foo(java.lang.Object[]), A1), public
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
- compiler.warn.annotation.method.not.found.reason: test.annotation.TestAnnotation, test, (- compiler.misc.class.file.not.found: test.annotation.TestAnnotation)
|
- compiler.warn.annotation.method.not.found.reason: test.annotation.TestAnnotation, test, (compiler.misc.class.file.not.found: test.annotation.TestAnnotation)
|
||||||
1 warning
|
1 warning
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
T6557182.java:35:56: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T, java.lang.Comparable<java.lang.Integer>
|
T6557182.java:35:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T, java.lang.Comparable<java.lang.Integer>
|
||||||
T6557182.java:39:56: compiler.warn.prob.found.req: (- compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable<java.lang.Integer>
|
T6557182.java:39:56: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T, java.lang.Comparable<java.lang.Integer>
|
||||||
1 error
|
1 error
|
||||||
1 warning
|
1 warning
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
T6665356.java:54:55: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long>
|
T6665356.java:54:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long>
|
||||||
T6665356.java:58:58: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number>
|
T6665356.java:58:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number>
|
||||||
T6665356.java:62:65: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>
|
T6665356.java:62:65: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>
|
||||||
T6665356.java:66:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long>
|
T6665356.java:66:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long>
|
||||||
T6665356.java:70:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String>
|
T6665356.java:70:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String>
|
||||||
T6665356.java:74:55: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long>
|
T6665356.java:74:55: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long>
|
||||||
T6665356.java:78:58: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String>
|
T6665356.java:78:58: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String>
|
||||||
7 errors
|
7 errors
|
@ -1,8 +1,8 @@
|
|||||||
T6795580.java:54:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[]
|
T6795580.java:54:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<java.lang.Long>[]
|
||||||
T6795580.java:58:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[]
|
T6795580.java:58:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.Number>[]
|
||||||
T6795580.java:62:67: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[]
|
T6795580.java:62:67: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.Number>.Inner<? super java.lang.Number>[]
|
||||||
T6795580.java:66:59: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[]
|
T6795580.java:66:59: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? extends java.lang.String>.Inner<java.lang.Long>[]
|
||||||
T6795580.java:70:62: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[]
|
T6795580.java:70:62: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? extends java.lang.String>[]
|
||||||
T6795580.java:74:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[]
|
T6795580.java:74:57: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<? super java.lang.String>.Inner<java.lang.Long>[]
|
||||||
T6795580.java:78:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[]
|
T6795580.java:78:60: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6795580.Outer<java.lang.Integer>.Inner<java.lang.Long>[], T6795580.Outer<java.lang.Integer>.Inner<? super java.lang.String>[]
|
||||||
7 errors
|
7 errors
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
T6207386.java:13:30: compiler.err.prob.found.req: (- compiler.misc.incompatible.types), X, T6207386.F<? super X>
|
T6207386.java:13:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), X, T6207386.F<? super X>
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
T6315770.java:39:42: compiler.err.undetermined.type.1: <T>T6315770<T>, (- compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable)
|
T6315770.java:39:42: compiler.err.undetermined.type.1: <T>T6315770<T>, (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable)
|
||||||
T6315770.java:40:40: compiler.err.prob.found.req: (- compiler.misc.incompatible.types.1: (- compiler.misc.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)), <T>T6315770<T>, T6315770<? super java.lang.String>
|
T6315770.java:40:40: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)), <T>T6315770<T>, T6315770<? super java.lang.String>
|
||||||
2 errors
|
2 errors
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
T6718364.java:36:32: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
|
T6718364.java:36:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
|
||||||
T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6718364.X<T>,T, T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X, kindname.class, T6718364
|
T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6718364.X<T>,T, T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X, kindname.class, T6718364
|
||||||
2 warnings
|
2 warnings
|
@ -1,13 +1,13 @@
|
|||||||
T6680106.java:34:25: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
|
T6680106.java:34:25: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:35:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
|
T6680106.java:35:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:35:40: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
|
T6680106.java:35:40: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:36:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
|
T6680106.java:36:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:36:40: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class)
|
T6680106.java:36:40: compiler.err.type.found.req: U[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:36:55: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
|
T6680106.java:36:55: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:37:30: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
|
T6680106.java:37:30: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:38:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
|
T6680106.java:38:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:38:50: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
|
T6680106.java:38:50: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:39:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
|
T6680106.java:39:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:39:50: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class)
|
T6680106.java:39:50: compiler.err.type.found.req: U[], (compiler.misc.type.req.class)
|
||||||
T6680106.java:39:70: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
|
T6680106.java:39:70: compiler.err.type.found.req: T[], (compiler.misc.type.req.class)
|
||||||
12 errors
|
12 errors
|
@ -1,5 +1,5 @@
|
|||||||
MissingSuperRecovery.java:15: cannot access base
|
MissingSuperRecovery.java:15: cannot access base
|
||||||
class file for base not found
|
|
||||||
public class MissingSuperRecovery extends impl {
|
public class MissingSuperRecovery extends impl {
|
||||||
^
|
^
|
||||||
|
class file for base not found
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
UnicodeNewline.java:11: cannot find symbol
|
UnicodeNewline.java:11: cannot find symbol
|
||||||
symbol : class xyzzy
|
|
||||||
location: class UnicodeNewline
|
|
||||||
xyzzy plugh; // error should be HERE
|
xyzzy plugh; // error should be HERE
|
||||||
^
|
^
|
||||||
|
symbol: class xyzzy
|
||||||
|
location: class UnicodeNewline
|
||||||
1 error
|
1 error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user