/*
 * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.siyeh.ipp.concatenation;

import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiUtil;
import com.siyeh.ipp.base.PsiElementPredicate;
import com.siyeh.ipp.psiutils.ConcatenationUtils;
import com.siyeh.ipp.psiutils.ErrorUtil;

class Jdk5StringConcatenationPredicate implements PsiElementPredicate {

    public boolean satisfiedBy(PsiElement element) {
        if (!PsiUtil.isLanguageLevel5OrHigher(element)) {
            return false;
        }
        if(!ConcatenationUtils.isConcatenation(element)) {
            return false;
        }
        return !ErrorUtil.containsError(element);
    }
}

@@ -673,23 +673,166 @@
 .psi.Psi
-Element
+ArrayInitializerMemberValue;%0Aimport com.intellij.psi.PsiBinaryExpression;%0Aimport com.intellij.psi.PsiElement;%0Aimport com.intellij.psi.PsiNameValuePair
 ;%0Aimport
@@ -1232,16 +1232,17 @@
       if
+ 
 (!Concat
@@ -1330,48 +1330,617 @@
     
-return !ErrorUtil.containsError(element)
+if (isInsideAnnotation(element)) %7B%0A            return false;%0A        %7D%0A        return !ErrorUtil.containsError(element);%0A    %7D%0A%0A    private static boolean isInsideAnnotation(PsiElement element) %7B%0A        for (int i = 0; i %3C 20 && element instanceof PsiBinaryExpression; i++) %7B%0A            // optimization: don't check deep string concatenations more than 20 levels up.%0A            element = element.getParent();%0A            if (element instanceof PsiNameValuePair %7C%7C%0A                element instanceof PsiArrayInitializerMemberValue) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false
 ;%0A  

disable "Replace '+' with 'String.format()'" inside annotations