Test & fix for bug 384870 - [compiler] @Deprecated annotation not
detected if preceded by other annotation
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java
index f503888..20b8825 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java
@@ -7,7 +7,9 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
- *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for Bug 354536 - compiling package-info.java still depends on the order of compilation units
+ *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
+ *								bug 354536 - compiling package-info.java still depends on the order of compilation units
+ *								bug 384870 - [compiler] @Deprecated annotation not detected if preceded by other annotation
  *******************************************************************************/
 package org.eclipse.jdt.core.tests.compiler.regression;
 
@@ -266,6 +268,36 @@
 		"----------\n",
 		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
 }
+// https://bugs.eclipse.org/384870 - [compiler] @Deprecated annotation not detected if preceded by other annotation
+public void test006() {
+	Map customOptions = new HashMap();
+	customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
+	this.runNegativeTest(
+		true,
+		new String[] {
+			"test1/E02.java",
+			"package test1;\n" +
+			"public class E02 {\n" +
+			"	public void foo(E01 arg) {\n" +
+			"		// nop\n" +
+			"	}\n" +
+			"}",
+			"test1/E01.java",
+			"package test1;\n" +
+			"@SuppressWarnings(\"all\") @Deprecated\n" +
+			"public class E01 {\n" +
+			"	public static int x = 5;\n" +
+			"}"
+		},
+		null, customOptions,
+		"----------\n" + 
+		"1. ERROR in test1\\E02.java (at line 3)\n" + 
+		"	public void foo(E01 arg) {\n" + 
+		"	                ^^^\n" + 
+		"The type E01 is deprecated\n" + 
+		"----------\n",
+		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
 public static Class testClass() {
 	return Deprecated15Test.class;
 }
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
index bd74fc7..89b6aba 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
@@ -14,6 +14,7 @@
  *     							bug 186342 - [compiler][null] Using annotations for null checking
  *								bug 365519 - editorial cleanup after bug 186342 and bug 365387
  *								bug 374605 - Unreasonable warning for enum-based switch statements
+ *								bug 384870 - [compiler] @Deprecated annotation not detected if preceded by other annotation
  *******************************************************************************/
 package org.eclipse.jdt.internal.compiler.ast;
 
@@ -745,7 +746,7 @@
 				for (int i = 0; i < length; i++) {
 					TypeReference annotationTypeRef = annotations[i].type;
 					// only resolve type name if 'Deprecated' last token
-					if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return;
+					if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) continue;
 					TypeBinding annotationType = annotations[i].type.resolveType(scope);
 					if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) {
 						switch (kind) {