aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core/src
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-04-14 00:40:34 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2021-04-14 00:40:34 +0700
commit7ee0f70ce7e50e61daa41b124c7837d45bfd386f (patch)
tree52c45fbc83bac14e611a7f5ce4a414c488935df2 /org.aspectj.ajdt.core/src
parent8d2aa7417fa837e8b3a147b45c1b824797ca0b33 (diff)
downloadaspectj-7ee0f70ce7e50e61daa41b124c7837d45bfd386f.tar.gz
aspectj-7ee0f70ce7e50e61daa41b124c7837d45bfd386f.zip
Remove remaining usage message duplication between ECJ and AJC
The resource key 'misc.usage' is completely gone from .../jdt/internal/compiler/batch/messages_aspectj.properties. Instead, JDT Core was adjusted in such a way as to patch the new resource key 'misc.usage.aspectj' into the upstream 'misc.usage' in the right place. Now finally the properties file is as lean as I envisioned it to be, without any loss of information and without the need of future manual synchronisation of duplicate texts for every release. At the same time, usage text detection in AjdtCommand::inferKind was improved and also adjusted to the new situation. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'org.aspectj.ajdt.core/src')
-rw-r--r--org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java35
-rw-r--r--org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties196
2 files changed, 30 insertions, 201 deletions
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java
index 36168343f..c5f4df474 100644
--- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java
+++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/ajc/AjdtCommand.java
@@ -158,20 +158,35 @@ public class AjdtCommand implements ICommand {
/**
* Heuristically infer the type of output message logged by the AspectJ compiler. This is a simple keyword matcher
* looking for substrings like "[error]", "[warning]", "AspectJ-specific options:", "AspectJ-specific non-standard
- * options:"
+ * options:", "Warning options:".
*
* @param message AspectJ compiler message
* @return inferred message kind, either of ERROR, WARNING, USAGE, INFO
*/
protected static IMessage.Kind inferKind(String message) { // XXX dubious
- if (message.contains("[error]")) {
- return IMessage.ERROR;
- } else if (message.contains("[warning]")) {
- return IMessage.WARNING;
- } else if (message.contains("AspectJ-specific options:") || message.contains("AspectJ-specific non-standard options:")) {
- return IMessage.USAGE;
- } else {
- return IMessage.INFO;
- }
+ if (message.contains("[error]")) {
+ return IMessage.ERROR;
+ }
+ else if (message.contains("[warning]")) {
+ return IMessage.WARNING;
+ }
+ else if (
+ containsAll(message, "Usage: <options>", "AspectJ-specific options:", "Classpath options:") ||
+ containsAll(message, "Warning options:", "-nowarn", "localHiding", "uselessTypeCheck") ||
+ containsAll(message, "AspectJ-specific non-standard options:", "-XnoInline", "-Xjoinpoints:")
+ )
+ {
+ return IMessage.USAGE;
+ }
+ else {
+ return IMessage.INFO;
+ }
}
+
+ private static boolean containsAll(String message, String... searchStrings) {
+ for (String searchString : searchStrings)
+ if (!message.contains(searchString))
+ return false;
+ return true;
+ }
}
diff --git a/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties b/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties
index 8c7c66599..36e9597a5 100644
--- a/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties
+++ b/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties
@@ -10,11 +10,10 @@ misc.version = {0} {1} - {2} {3}
# {1} compiler.name
# {2} compiler.version
# {3} compiler.copyright
-misc.usage = {1} - {2}\n\
-\ \n\
-\ Usage: <options> <source file | @argfile>..\n\
-\ \n\
-\ AspectJ-specific options:\n\
+
+# This property only exists in AspectJ. It is to be patched into the value of 'misc.usage' at the correct position,
+# i.e. right between "Usage" and "Classpath options".
+misc.usage.aspectj = AspectJ-specific options:\n\
\ -inpath <list> use classes in dirs and jars/zips in <list> as source\n\
\ (<list> uses platform-specific path delimiter)\n\
\ -injars <jarList> use classes in <jarList> zip files as source\n\
@@ -41,193 +40,8 @@ misc.usage = {1} - {2}\n\
\ -X print help on non-standard options\n\
\ \n\
\ Standard Eclipse compiler options:\n\
-\ Options enabled by default are prefixed with ''+''\n\
-\ \n\
-\ Classpath options:\n\
-\ -cp -classpath <directories and ZIP archives separated by ;>\n\
-\ specify location for application classes and sources\n\
-\ -bootclasspath <directories and zip/jar files separated by ;>\n\
-\ specify location for system classes\n\
-\ -d <dir> destination directory (if omitted, no directory is created)\n\
-\ -d none generate no .class files\n\
-\ -encoding <enc> specify custom encoding for all sources. Each file/directory can override it\n\
-\ when suffixed with ''[''<enc>'']'' (e.g. X.java[utf8])\n\
-\ \n\
-\ Compliance options:\n\
-\ -1.4 + use 1.4 compliance (-source 1.3 -target 1.2)\n\
-\ -1.5 -5 -5.0 use 1.5 compliance (-source 1.5 -target 1.5)\n\
-\ -1.6 -6 -6.0 use 1.6 compliance (-source 1.6 -target 1.6)\n\
-\ -1.7 -7 -7.0 use 1.7 compliance (-source 1.7 -target 1.7)\n\
-\ -1.8 -8 -8.0 use 1.8 compliance (-source 1.8 -target 1.8)\n\
-\ -1.9 -9 -9.0 use 1.9 compliance (-source 1.9 -target 1.9)\n\
-\ -10 for Java 10 (-source 10 -target 10)\n\
-\ -11 for Java 11 (-source 11 -target 11)\n\
-\ -12 for Java 12 (-source 12 -target 12)\n\
-\ -13 for Java 13 (-source 13 -target 13)\n\
-\ -14 for Java 14 (-source 14 -target 14)\n\
-\ -15 for Java 14 (-source 15 -target 15)\n\
-\ -source <version> set source level: 1.3 to 15 \n\
-\ -target <version> set classfile target: 1.1 to 15\n\
\ \n\
-\ Warning options:\n\
-\ -deprecation + deprecation outside deprecated code (equivalent to\n\
-\ -warn:+deprecation)\n\
-\ -nowarn -warn:none disable all warnings\n\
-\ -warn:<warnings separated by ,> enable exactly the listed warnings\n\
-\ -warn:+<warnings separated by ,> enable additional warnings\n\
-\ -warn:-<warnings separated by ,> disable specific warnings\n\
-\ allDeadCode dead code including trivial if(DEBUG) check\n\
-\ allDeprecation deprecation including inside deprecated code\n\
-\ allJavadoc invalid or missing javadoc\n\
-\ allOver-ann all missing @Override annotations\n\
-\ all-static-method all method can be declared as static warnings\n\
-\ assertIdentifier + ''assert'' used as identifier\n\
-\ boxing autoboxing conversion\n\
-\ charConcat + char[] in String concat\n\
-\ compareIdentical + comparing identical expressions\n\
-\ conditionAssign possible accidental boolean assignment\n\
-\ constructorName + method with constructor name\n\
-\ deadCode + dead code excluding trivial if (DEBUG) check\n\
-\ dep-ann missing @Deprecated annotation\n\
-\ deprecation + deprecation outside deprecated code\n\
-\ discouraged + use of types matching a discouraged access rule\n\
-\ emptyBlock undocumented empty block\n\
-\ enumIdentifier ''enum'' used as identifier\n\
-\ enumSwitch incomplete enum switch\n\
-\ enumSwitchPedantic + report missing enum switch cases even\n\
-\ in the presence of a default case\n\
-\ fallthrough possible fall-through case\n\
-\ fieldHiding field hiding another variable\n\
-\ finalBound type parameter with final bound\n\
-\ finally + finally block not completing normally\n\
-\ forbidden + use of types matching a forbidden access rule\n\
-\ hashCode missing hashCode() method when overriding equals()\n\
-\ hiding macro for fieldHiding, localHiding, typeHiding and\n\
-\ maskedCatchBlock\n\
-\ includeAssertNull raise null warnings for variables\n\
-\ that got tainted in an assert expression\n\
-\ indirectStatic indirect reference to static member\n\
-\ inheritNullAnnot inherit null annotations\n\
-\ intfAnnotation + annotation type used as super interface\n\
-\ intfNonInherited + interface non-inherited method compatibility\n\
-\ intfRedundant find redundant superinterfaces\n\
-\ invalidJavadoc all warnings for malformed javadoc tags\n\
-\ invalidJavadocTag validate javadoc tag arguments\n\
-\ invalidJavadocTagDep validate deprecated references in javadoc tag args\n\
-\ invalidJavadocTagNotVisible validate non-visible references in javadoc\n\
-\ tag args\n\
-\ invalidJavadocVisibility(<visibility>) specify visibility modifier\n\
-\ for malformed javadoc tag warnings\n\
-\ javadoc invalid javadoc\n\
-\ localHiding local variable hiding another variable\n\
-\ maskedCatchBlock + hidden catch block\n\
-\ missingJavadocTags missing Javadoc tags\n\
-\ missingJavadocTagsOverriding missing Javadoc tags in overriding methods\n\
-\ missingJavadocTagsMethod missing Javadoc tags for method type parameter\n\
-\ missingJavadocTagsVisibility(<visibility>) specify visibility modifier\n\
-\ for missing javadoc tags warnings\n\
-\ missingJavadocComments missing Javadoc comments\n\
-\ missingJavadocCommentsOverriding missing Javadoc tags in overriding\n\
-\ methods\n\
-\ missingJavadocCommentsVisibility(<visibility>) specify visibility\n\
-\ modifier for missing javadoc comments warnings\n\
-\ nls string literal lacking non-nls tag //$NON-NLS-<n>$\n\
-\ noEffectAssign + assignment without effect\n\
-\ null potential missing or redundant null check\n\
-\ nullAnnot(<annot. names separated by |>) annotation based null analysis,\n\
-\ nullable|nonnull|nonnullbydefault annotation types\n\
-\ optionally specified using fully qualified names.\n\
-\ Enabling this option enables all null-annotation\n\
-\ related sub-options. These can be individually\n\
-\ controlled using options listed below.\n\
-\ nullAnnotConflict conflict between null annotation specified\n\
-\ and nullness inferred. Is effective only with\n\
-\ nullAnnot option enabled.\n\
-\ nullAnnotRedundant redundant specification of null annotation. Is\n\
-\ effective only with nullAnnot option enabled.\n\
-\ nullDereference + missing null check\n\
-\ nullUncheckedConversion unchecked conversion from non-annotated type\n\
-\ to @NonNull type. Is effective only with\n\
-\ nullAnnot option enabled.\n\
-\ over-ann missing @Override annotation (superclass)\n\
-\ paramAssign assignment to a parameter\n\
-\ pkgDefaultMethod + attempt to override package-default method\n\
-\ raw + usage of raw type\n\
-\ resource + (pot.) unsafe usage of resource of type Closeable\n\
-\ semicolon unnecessary semicolon, empty statement\n\
-\ serial + missing serialVersionUID\n\
-\ specialParamHiding constructor or setter parameter hiding a field\n\
-\ static-method method can be declared as static\n\
-\ static-access macro for indirectStatic and staticReceiver\n\
-\ staticReceiver + non-static reference to static member\n\
-\ super overriding a method without making a super invocation\n\
-\ suppress + enable @SuppressWarnings\n\
-\ When used with -err:, it can also silence optional\n\
-\ errors and warnings\n\
-\ switchDefault switch statement lacking a default case\n\
-\ syncOverride missing synchronized in synchr. method override\n\
-\ syntacticAnalysis perform syntax-based null analysis for fields\n\
-\ syntheticAccess synthetic access for innerclass\n\
-\ tasks(<tags separated by |>) tasks identified by tags inside comments\n\
-\ typeHiding + type parameter hiding another type\n\
-\ unavoidableGenericProblems + ignore unavoidable type safety problems\n\
-\ due to raw APIs\n\
-\ unchecked + unchecked type operation\n\
-\ unlikelyCollectionMethodArgumentType\n\
-\ + unlikely argument type for collection method\n\
-\ declaring an Object parameter\n\
-\ unlikelyEqualsArgumentType unlikely argument type for method equals()\n\
-\ unnecessaryElse unnecessary else clause\n\
-\ unqualifiedField unqualified reference to field\n\
-\ unused macro for unusedAllocation, unusedArgument,\n\
-\ unusedImport, unusedLabel, unusedLocal,\n\
-\ unusedPrivate, unusedThrown, and unusedTypeArgs,\n\
-\ unusedExceptionParam\n\
-\ unusedAllocation allocating an object that is not used\n\
-\ unusedArgument unread method parameter\n\
-\ unusedExceptionParam unread exception parameter\n\
-\ unusedImport + unused import declaration\n\
-\ unusedLabel + unused label\n\
-\ unusedLocal + unread local variable\n\
-\ unusedParam unused parameter\n\
-\ unusedParamOverriding unused parameter for overriding method\n\
-\ unusedParamImplementing unused parameter for implementing method\n\
-\ unusedParamIncludeDoc unused parameter documented in comment tag\n\
-\ unusedPrivate + unused private member declaration\n\
-\ unusedThrown unused declared thrown exception\n\
-\ unusedThrownWhenOverriding unused declared thrown exception in \n\
-\ overriding method\n\
-\ unusedThrownIncludeDocComment unused declared thrown exception,\n\
-\ documented in a comment tag\n\
-\ unusedThrownExemptExceptionThrowable unused declared thrown exception,\n\
-\ exempt Exception and Throwable\n\
-\ unusedTypeArgs + unused type arguments for method and constructor\n\
-\ uselessTypeCheck unnecessary cast/instanceof operation\n\
-\ varargsCast + varargs argument need explicit cast\n\
-\ warningToken + unsupported or unnecessary @SuppressWarnings\n\
-\ \n\
-\ Debug options:\n\
-\ -g[:lines,vars,source] custom debug info\n\
-\ -g:lines,source + both lines table and source debug info\n\
-\ -g all debug info\n\
-\ -g:none no debug info\n\
-\ -preserveAllLocals preserve unused local vars for debug purpose\n\
-\ \n\
-\ Advanced options:\n\
-\ --enable-preview turn on support for any experimental features in that version of Java\n\
-\ -log <file> log to a file\n\
-\ -proceedOnError do not stop at first error, dumping class files with problem methods\n\
-\ -verbose enable verbose output\n\
-\ -referenceInfo compute reference info\n\
-\ -progress show progress (only in -log mode)\n\
-\ -time display speed information \n\
-\ -noExit do not call System.exit(n) at end of compilation (n==0 if no error)\n\
-\ -repeat <n> repeat compilation process <n> times for perf analysis\n\
-\ @<file> read command line arguments from file\n\
-\ \n\
-\ -? -help print this help message\n\
-\ -v -version print compiler version\n\
-\ -showversion print compiler version and continue\n
+
# This property only exists in AspectJ. Options not documented below (see org.aspectj.ajdt.ajc.BuildArgParser):
# -XincrementalFile, -XjavadocsInModel, -Xset:, -Xdev:NoAtAspectJProcessing, -Xdev:Pinpoint