You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/07/31 04:59:43 UTC
[63/81] [abbrv] zest-java git commit: Tightening everything up after
massive namespace change. Removal of practically all "Qi4j" names and
references.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java
new file mode 100644
index 0000000..6f4c5e3
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java
@@ -0,0 +1,122 @@
+/* Copyright 2008 Edward Yakop.
+*
+* 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 org.apache.zest.ide.plugin.idea.injections.structure.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static com.intellij.psi.PsiModifier.STATIC;
+import static org.apache.zest.ide.plugin.idea.injections.structure.common.ZestStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
+import static org.apache.zest.ide.plugin.idea.injections.structure.common.ZestStructureAnnotationConstants.VALID_STRUCTURE_INJECTION_TYPE;
+import static org.apache.zest.ide.plugin.idea.injections.structure.common.ZestStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class ZestStructureAnnotationUtil
+{
+ /**
+ * Returns {@code Structure} annotation if exists.
+ *
+ * @param modifierListOwner Modifier list owner.
+ * @return @Structure annotation if exists, {@code null} otherwise.
+ * @since 0.1
+ */
+ @Nullable
+ public static PsiAnnotation getStructureAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
+ {
+ return findAnnotation( modifierListOwner, QUALIFIED_NAME_STRUCTURE_ANNOTATION );
+ }
+
+ /**
+ * Create structure annotation.
+ *
+ * @param project project to create structure annotation.
+ * @param context the context to create structure annotation.
+ * @return @Structure annotation.
+ */
+ @NotNull
+ public static PsiAnnotation createStructureAnnotation( @NotNull Project project,
+ @NotNull PsiElement context )
+ {
+ JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+ PsiElementFactory factory = psiFacade.getElementFactory();
+ return factory.createAnnotationFromText( "@" + QUALIFIED_NAME_STRUCTURE_ANNOTATION, context );
+ }
+
+ /**
+ * @param variable variable to check.
+ * @return Look at {@link StructureAnnotationDeclarationValidationResult}.
+ * @since 0.1
+ */
+ @NotNull
+ public static StructureAnnotationDeclarationValidationResult validateStructureAnnotationDeclaration(
+ @NotNull PsiVariable variable )
+ {
+ PsiAnnotation structureAnnotation = getStructureAnnotation( variable );
+ if( structureAnnotation == null )
+ {
+ return invalidStructureAnnotationNotDeclared;
+ }
+
+ PsiModifierList modifierList = variable.getModifierList();
+ if( modifierList != null )
+ {
+ if( modifierList.hasModifierProperty( STATIC ) )
+ {
+ return invalidDeclaredOnStaticVariable;
+ }
+ }
+
+ if( !isInjecteableByStructureAnnotation( variable ) )
+ {
+ return invalidInjectionType;
+ }
+
+ return valid;
+ }
+
+ /**
+ * Returns a {@code boolean} indicator whether variable type is injectable by @Structure annotation.
+ *
+ * @param variable variable to check.
+ * @return {@code true} if variable type is injecteable by @Structure annotation.
+ * @since 0.1
+ */
+ public static boolean isInjecteableByStructureAnnotation( @NotNull PsiVariable variable )
+ {
+ PsiType type = variable.getType();
+ String fieldClassQualifiedName = type.getCanonicalText();
+ return binarySearch( VALID_STRUCTURE_INJECTION_TYPE, fieldClassQualifiedName ) > -1;
+ }
+
+ private ZestStructureAnnotationUtil()
+ {
+ }
+
+ public enum StructureAnnotationDeclarationValidationResult
+ {
+ invalidStructureAnnotationNotDeclared,
+ invalidDeclaredOnStaticVariable,
+ invalidInjectionType,
+ valid,
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
index 7baea38..bef64d5 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
@@ -26,10 +26,10 @@ import org.apache.zest.ide.plugin.idea.common.inspections.AbstractFix;
import org.apache.zest.ide.plugin.idea.injections.common.inspections.AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection;
import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.zest.ide.plugin.idea.common.resource.Qi4jResourceBundle.message;
-import static org.apache.zest.ide.plugin.idea.injections.structure.common.Qi4jStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
-import static org.apache.zest.ide.plugin.idea.injections.structure.common.Qi4jStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult;
-import static org.apache.zest.ide.plugin.idea.injections.structure.common.Qi4jStructureAnnotationUtil.validateStructureAnnotationDeclaration;
+import static org.apache.zest.ide.plugin.idea.common.resource.ZestResourceBundle.message;
+import static org.apache.zest.ide.plugin.idea.injections.structure.common.ZestStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
+import static org.apache.zest.ide.plugin.idea.injections.structure.common.ZestStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult;
+import static org.apache.zest.ide.plugin.idea.injections.structure.common.ZestStructureAnnotationUtil.validateStructureAnnotationDeclaration;
/**
* {@code StructureAnnotationUsedCorrectly} validates {@code @Structure} injection annotation declaration.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/Qi4jMixinConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/Qi4jMixinConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/Qi4jMixinConstants.java
deleted file mode 100644
index e2f02df..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/Qi4jMixinConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2008 Edward Yakop.
-*
-* 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 org.apache.zest.ide.plugin.idea.mixins.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class Qi4jMixinConstants
-{
- public static final String QUALIFIED_NAME_MIXINS = "org.qi4j.api.mixin.Mixins";
-
- private Qi4jMixinConstants()
- {
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/Qi4jMixinUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/Qi4jMixinUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/Qi4jMixinUtil.java
deleted file mode 100644
index e8100bd..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/Qi4jMixinUtil.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Copyright 2008 Edward Yakop.
-*
-* 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 org.apache.zest.ide.plugin.idea.mixins.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-import java.util.Set;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.emptySet;
-import static org.apache.zest.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.zest.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.zest.ide.plugin.idea.common.psi.PsiClassUtil.getExtendsDeep;
-import static org.apache.zest.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.zest.ide.plugin.idea.concerns.common.Qi4jConcernUtil.isAConcern;
-import static org.apache.zest.ide.plugin.idea.mixins.common.Qi4jMixinConstants.QUALIFIED_NAME_MIXINS;
-import static org.apache.zest.ide.plugin.idea.sideEffects.common.Qi4jSideEffectUtil.isASideEffect;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class Qi4jMixinUtil
-{
- /**
- * Get all valid mixin types of given the {@code psiClass} argument.
- *
- * @param psiClass The psi class to check.
- * @return all vlaid mixin types of the given {@code psiClass} argument.
- * @since 0.1
- */
- @NotNull
- public static Set<PsiClass> getAllValidMixinTypes( @NotNull PsiClass psiClass )
- {
- PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
- if( mixinsAnnotation == null )
- {
- return emptySet();
- }
-
- Set<PsiClass> validMixinsType = getExtendsDeep( psiClass );
- validMixinsType.add( psiClass );
- return validMixinsType;
- }
-
- @NotNull
- public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @NotNull PsiClass psiClass )
- {
- return getMixinsAnnotationValue( getMixinsAnnotation( psiClass ) );
- }
-
- @NotNull
- public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @Nullable PsiAnnotation mixinsAnnotation )
- {
- if( mixinsAnnotation == null )
- {
- return emptyList();
- }
-
- String mixinsQualifiedName = mixinsAnnotation.getQualifiedName();
- if( !QUALIFIED_NAME_MIXINS.equals( mixinsQualifiedName ) )
- {
- return emptyList();
- }
-
- return getAnnotationDefaultParameterValue( mixinsAnnotation );
- }
-
- @Nullable
- public static PsiAnnotation getMixinsAnnotation( PsiElement element )
- {
- PsiClass psiClass = getPSIClass( element );
- if( psiClass == null )
- {
- return null;
- }
-
- return findAnnotation( psiClass, QUALIFIED_NAME_MIXINS );
- }
-
- @NotNull
- public static PsiAnnotation addOrReplaceMixinAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
- @NotNull PsiClass mixinClassToAdd )
- {
- Project project = modifierListOwner.getProject();
- JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
- PsiElementFactory factory = psiFacade.getElementFactory();
- PsiAnnotation existingMixinsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_MIXINS );
-
- boolean isReplace = false;
- PsiAnnotation newMixinsAnnotation;
- if( existingMixinsAnnotation != null )
- {
- // Check duplicate
- List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( existingMixinsAnnotation );
- for( PsiAnnotationMemberValue mixinValue : mixinsValues )
- {
- PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinValue );
- if( mixinClassReference == null )
- {
- continue;
- }
-
- PsiElement mixinClass = mixinClassReference.resolve();
- if( mixinClassToAdd.equals( mixinClass ) )
- {
- return existingMixinsAnnotation;
- }
- }
-
- isReplace = true;
- }
-
- String mixinsAnnotationText = createMixinsAnnotationText( existingMixinsAnnotation, mixinClassToAdd );
- newMixinsAnnotation = factory.createAnnotationFromText( mixinsAnnotationText, modifierListOwner );
-
- if( isReplace )
- {
- // Replace @Mixins instead
- existingMixinsAnnotation.replace( newMixinsAnnotation );
- }
- else
- {
- // @Mixins doesn't exists, add it as first child
- PsiModifierList modifierList = modifierListOwner.getModifierList();
- modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() );
- }
-
- // Shorten all class references if possible
- JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
- codeStyleManager.shortenClassReferences( newMixinsAnnotation );
-
- return newMixinsAnnotation;
- }
-
- @NotNull
- private static String createMixinsAnnotationText( @Nullable PsiAnnotation mixinsAnnotationBase,
- @NotNull PsiClass mixinClassToAdd )
- {
- StringBuilder annotationTextBuilder = new StringBuilder();
- annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_MIXINS ).append( "( {" );
- List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( mixinsAnnotationBase );
- for( PsiAnnotationMemberValue mixinValue : mixinsValues )
- {
- annotationTextBuilder.append( mixinValue.getText() ).append( ", " );
- }
- annotationTextBuilder.append( mixinClassToAdd.getQualifiedName() ).append( ".class" );
- annotationTextBuilder.append( "} )" );
-
- return annotationTextBuilder.toString();
- }
-
-
- @Nullable
- public static PsiJavaCodeReferenceElement getMixinClassReference( @NotNull PsiAnnotationMemberValue value )
- {
- return getClassReference( value );
- }
-
- /**
- * Validate whether psiClass is a mixin.
- *
- * @param psiClass psi class to check.
- * @return {@code true} if psiClass is a mixin, {@code false} otherwise.
- */
- public static boolean isAMixin( @NotNull PsiClass psiClass )
- {
- return !( psiClass.isInterface() || isAConcern( psiClass ) || isASideEffect( psiClass ) );
- }
-
- private Qi4jMixinUtil()
- {
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java
new file mode 100644
index 0000000..12e6d87
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java
@@ -0,0 +1,30 @@
+/* Copyright 2008 Edward Yakop.
+*
+* 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 org.apache.zest.ide.plugin.idea.mixins.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class ZestMixinConstants
+{
+ public static final String QUALIFIED_NAME_MIXINS = "org.apache.zest.api.mixin.Mixins";
+
+ private ZestMixinConstants()
+ {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java
new file mode 100644
index 0000000..4d8a544
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java
@@ -0,0 +1,194 @@
+/* Copyright 2008 Edward Yakop.
+*
+* 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 org.apache.zest.ide.plugin.idea.mixins.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.Set;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptySet;
+import static org.apache.zest.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.zest.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.zest.ide.plugin.idea.common.psi.PsiClassUtil.getExtendsDeep;
+import static org.apache.zest.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.zest.ide.plugin.idea.concerns.common.ZestConcernUtil.isAConcern;
+import static org.apache.zest.ide.plugin.idea.mixins.common.ZestMixinConstants.QUALIFIED_NAME_MIXINS;
+import static org.apache.zest.ide.plugin.idea.sideEffects.common.ZestSideEffectUtil.isASideEffect;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class ZestMixinUtil
+{
+ /**
+ * Get all valid mixin types of given the {@code psiClass} argument.
+ *
+ * @param psiClass The psi class to check.
+ * @return all vlaid mixin types of the given {@code psiClass} argument.
+ * @since 0.1
+ */
+ @NotNull
+ public static Set<PsiClass> getAllValidMixinTypes( @NotNull PsiClass psiClass )
+ {
+ PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
+ if( mixinsAnnotation == null )
+ {
+ return emptySet();
+ }
+
+ Set<PsiClass> validMixinsType = getExtendsDeep( psiClass );
+ validMixinsType.add( psiClass );
+ return validMixinsType;
+ }
+
+ @NotNull
+ public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @NotNull PsiClass psiClass )
+ {
+ return getMixinsAnnotationValue( getMixinsAnnotation( psiClass ) );
+ }
+
+ @NotNull
+ public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @Nullable PsiAnnotation mixinsAnnotation )
+ {
+ if( mixinsAnnotation == null )
+ {
+ return emptyList();
+ }
+
+ String mixinsQualifiedName = mixinsAnnotation.getQualifiedName();
+ if( !QUALIFIED_NAME_MIXINS.equals( mixinsQualifiedName ) )
+ {
+ return emptyList();
+ }
+
+ return getAnnotationDefaultParameterValue( mixinsAnnotation );
+ }
+
+ @Nullable
+ public static PsiAnnotation getMixinsAnnotation( PsiElement element )
+ {
+ PsiClass psiClass = getPSIClass( element );
+ if( psiClass == null )
+ {
+ return null;
+ }
+
+ return findAnnotation( psiClass, QUALIFIED_NAME_MIXINS );
+ }
+
+ @NotNull
+ public static PsiAnnotation addOrReplaceMixinAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
+ @NotNull PsiClass mixinClassToAdd )
+ {
+ Project project = modifierListOwner.getProject();
+ JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+ PsiElementFactory factory = psiFacade.getElementFactory();
+ PsiAnnotation existingMixinsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_MIXINS );
+
+ boolean isReplace = false;
+ PsiAnnotation newMixinsAnnotation;
+ if( existingMixinsAnnotation != null )
+ {
+ // Check duplicate
+ List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( existingMixinsAnnotation );
+ for( PsiAnnotationMemberValue mixinValue : mixinsValues )
+ {
+ PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinValue );
+ if( mixinClassReference == null )
+ {
+ continue;
+ }
+
+ PsiElement mixinClass = mixinClassReference.resolve();
+ if( mixinClassToAdd.equals( mixinClass ) )
+ {
+ return existingMixinsAnnotation;
+ }
+ }
+
+ isReplace = true;
+ }
+
+ String mixinsAnnotationText = createMixinsAnnotationText( existingMixinsAnnotation, mixinClassToAdd );
+ newMixinsAnnotation = factory.createAnnotationFromText( mixinsAnnotationText, modifierListOwner );
+
+ if( isReplace )
+ {
+ // Replace @Mixins instead
+ existingMixinsAnnotation.replace( newMixinsAnnotation );
+ }
+ else
+ {
+ // @Mixins doesn't exists, add it as first child
+ PsiModifierList modifierList = modifierListOwner.getModifierList();
+ modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() );
+ }
+
+ // Shorten all class references if possible
+ JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
+ codeStyleManager.shortenClassReferences( newMixinsAnnotation );
+
+ return newMixinsAnnotation;
+ }
+
+ @NotNull
+ private static String createMixinsAnnotationText( @Nullable PsiAnnotation mixinsAnnotationBase,
+ @NotNull PsiClass mixinClassToAdd )
+ {
+ StringBuilder annotationTextBuilder = new StringBuilder();
+ annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_MIXINS ).append( "( {" );
+ List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( mixinsAnnotationBase );
+ for( PsiAnnotationMemberValue mixinValue : mixinsValues )
+ {
+ annotationTextBuilder.append( mixinValue.getText() ).append( ", " );
+ }
+ annotationTextBuilder.append( mixinClassToAdd.getQualifiedName() ).append( ".class" );
+ annotationTextBuilder.append( "} )" );
+
+ return annotationTextBuilder.toString();
+ }
+
+
+ @Nullable
+ public static PsiJavaCodeReferenceElement getMixinClassReference( @NotNull PsiAnnotationMemberValue value )
+ {
+ return getClassReference( value );
+ }
+
+ /**
+ * Validate whether psiClass is a mixin.
+ *
+ * @param psiClass psi class to check.
+ * @return {@code true} if psiClass is a mixin, {@code false} otherwise.
+ */
+ public static boolean isAMixin( @NotNull PsiClass psiClass )
+ {
+ return !( psiClass.isInterface() || isAConcern( psiClass ) || isASideEffect( psiClass ) );
+ }
+
+ private ZestMixinUtil()
+ {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
index f03722f..12d6a1c 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
@@ -31,10 +31,10 @@ import java.util.List;
import java.util.Set;
import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.zest.ide.plugin.idea.common.resource.Qi4jResourceBundle.message;
-import static org.apache.zest.ide.plugin.idea.concerns.common.Qi4jConcernUtil.isAConcern;
-import static org.apache.zest.ide.plugin.idea.mixins.common.Qi4jMixinUtil.*;
-import static org.apache.zest.ide.plugin.idea.sideEffects.common.Qi4jSideEffectUtil.isASideEffect;
+import static org.apache.zest.ide.plugin.idea.common.resource.ZestResourceBundle.message;
+import static org.apache.zest.ide.plugin.idea.concerns.common.ZestConcernUtil.isAConcern;
+import static org.apache.zest.ide.plugin.idea.mixins.common.ZestMixinUtil.*;
+import static org.apache.zest.ide.plugin.idea.sideEffects.common.ZestSideEffectUtil.isASideEffect;
/**
* @author edward.yakop@gmail.com
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
index c4ebfde..375b76d 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
@@ -27,8 +27,8 @@ import org.apache.zest.ide.plugin.idea.common.inspections.AbstractFix;
import org.apache.zest.ide.plugin.idea.common.inspections.AbstractInspection;
import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.zest.ide.plugin.idea.common.resource.Qi4jResourceBundle.message;
-import static org.apache.zest.ide.plugin.idea.mixins.common.Qi4jMixinUtil.getMixinsAnnotation;
+import static org.apache.zest.ide.plugin.idea.common.resource.ZestResourceBundle.message;
+import static org.apache.zest.ide.plugin.idea.mixins.common.ZestMixinUtil.getMixinsAnnotation;
/**
* @author edward.yakop@gmail.com
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/Qi4jSideEffectConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/Qi4jSideEffectConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/Qi4jSideEffectConstants.java
deleted file mode 100644
index d417575..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/Qi4jSideEffectConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2008 Edward Yakop.
-*
-* 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 org.apache.zest.ide.plugin.idea.sideEffects.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class Qi4jSideEffectConstants
-{
- public static final String QUALIFIED_NAME_SIDE_EFFECTS = "org.qi4j.api.sideeffect.SideEffects";
-
- public static final String QUALIFIED_NAME_SIDE_EFFECT_OF = "org.qi4j.api.sideeffect.SideEffectOf";
- public static final String QUALIFIED_NAME_GENERIC_SIDE_EFFECT = "org.qi4j.api.sideeffect.GenericSideEffect";
-
- private Qi4jSideEffectConstants()
- {
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/Qi4jSideEffectUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/Qi4jSideEffectUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/Qi4jSideEffectUtil.java
deleted file mode 100644
index 1cd030b..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/Qi4jSideEffectUtil.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Copyright 2008 Edward Yakop.
-*
-* 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 org.apache.zest.ide.plugin.idea.sideEffects.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collections;
-import java.util.List;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static org.apache.zest.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.zest.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.zest.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.zest.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.zest.ide.plugin.idea.sideEffects.common.Qi4jSideEffectConstants.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class Qi4jSideEffectUtil
-{
- /**
- * @param searchContext Search context.
- * @return {@code GenericSideEffect} class given the search context. {@code null} if not found.
- * @since 0.1
- */
- @Nullable
- public static PsiClass getGenericSideEffectClass( @NotNull PsiElement searchContext )
- {
- Project project = searchContext.getProject();
- GlobalSearchScope searchScope = determineSearchScope( searchContext );
- return getGenericSideEffectClass( project, searchScope );
- }
-
- /**
- * @param project project.
- * @param scope search scope.
- * @return {@code GenericSideEffect} class given {@code project} and {@code scope} parameters.
- * Returns {@code null} if not found.
- * @since 0.1
- */
- @Nullable
- public static PsiClass getGenericSideEffectClass( @NotNull Project project,
- @Nullable GlobalSearchScope scope )
- {
- JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
- return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_GENERIC_SIDE_EFFECT, scope );
- }
-
- /**
- * @param searchContext Search context.
- * @return {@code SideEffectOf} class given the search context. {@code null} if not found.
- * @since 0.1
- */
- @Nullable
- public static PsiClass getSideEffectOfClass( @NotNull PsiElement searchContext )
- {
- Project project = searchContext.getProject();
- GlobalSearchScope searchScope = determineSearchScope( searchContext );
- return getSideEffectOfClass( project, searchScope );
- }
-
-
- /**
- * @param project project.
- * @param scope search scope.
- * @return {@code SideEffectOf} class given {@code project} and {@code scope} parameters.
- * Returns {@code null} if not found.
- * @since 0.1
- */
- @Nullable
- public static PsiClass getSideEffectOfClass( @NotNull Project project,
- @Nullable GlobalSearchScope scope )
- {
- JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
- return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_SIDE_EFFECT_OF, scope );
- }
-
- /**
- * @param elementWithinJavaClass element within java class.
- * @return {@code @SideEffects} annotation declaration of the class that contains the element.
- * Returns {@code null} if not found, or {@code element} is an invalid context.
- * @since 0.1
- */
- @Nullable
- public static PsiAnnotation getSideEffectsAnnotation( @NotNull PsiElement elementWithinJavaClass )
- {
- PsiClass psiClass = getPSIClass( elementWithinJavaClass );
- return findAnnotation( psiClass, QUALIFIED_NAME_SIDE_EFFECTS );
- }
-
- /**
- * @param annotation annotation to process.
- * @return {@code @SideEffects} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
- * {@code null} or annotation is not a {@code @SideEffects} annotation.
- * @since 0.1
- */
- @NotNull
- public static List<PsiAnnotationMemberValue> getSideEffectsAnnotationValue( @Nullable PsiAnnotation annotation )
- {
- if( annotation == null )
- {
- return emptyList();
- }
-
- String concernsQualifiedName = annotation.getQualifiedName();
- if( !QUALIFIED_NAME_SIDE_EFFECTS.equals( concernsQualifiedName ) )
- {
- return emptyList();
- }
-
- return getAnnotationDefaultParameterValue( annotation );
- }
-
- /**
- * @param value annotation member value.
- * @return Side effect class reference given the {@code value} parameter. Returns {@code null} if it's not a
- * class reference.
- * @since 0.1
- */
- @Nullable
- public static PsiJavaCodeReferenceElement getSideEffectClassReference( @NotNull PsiAnnotationMemberValue value )
- {
- return getClassReference( value );
- }
-
- /**
- * Returns a {@code boolean} indicator whether the specified {@code psiClass} is a side effect.
- *
- * @param psiClass class to check.
- * @return {@code true} if {@code psiClass} is a side effect, {@code false} otherwise.
- * @since 0.1
- */
- public static boolean isASideEffect( @NotNull PsiClass psiClass )
- {
- if( psiClass.isInterface() )
- {
- return false;
- }
-
- PsiClass sideEffectOfClass = getSideEffectOfClass( psiClass );
- return sideEffectOfClass != null && psiClass.isInheritor( sideEffectOfClass, true );
- }
-
- /**
- * @param psiClass psi class to check.
- * @return {@code true} if {@code psiClass} inherits {@code GenericSideEffect} class, {@code false} if
- * {@code psiClass} does
- * not inherit {@code GenericSideEffect} or {@code GenericSideEffect} is not found.
- * @since 0.1
- */
- public static boolean isAGenericSideEffect( @NotNull PsiClass psiClass )
- {
- if( psiClass.isInterface() )
- {
- return false;
- }
-
- PsiClass genericSideEffect = getGenericSideEffectClass( psiClass );
- return genericSideEffect != null && psiClass.isInheritor( genericSideEffect, true );
- }
-
- private Qi4jSideEffectUtil()
- {
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java
new file mode 100644
index 0000000..39c3fac
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java
@@ -0,0 +1,33 @@
+/* Copyright 2008 Edward Yakop.
+*
+* 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 org.apache.zest.ide.plugin.idea.sideEffects.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class ZestSideEffectConstants
+{
+ public static final String QUALIFIED_NAME_SIDE_EFFECTS = "org.apache.zest.api.sideeffect.SideEffects";
+
+ public static final String QUALIFIED_NAME_SIDE_EFFECT_OF = "org.apache.zest.api.sideeffect.SideEffectOf";
+ public static final String QUALIFIED_NAME_GENERIC_SIDE_EFFECT = "org.apache.zest.api.sideeffect.GenericSideEffect";
+
+ private ZestSideEffectConstants()
+ {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java
new file mode 100644
index 0000000..5bc4806
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java
@@ -0,0 +1,186 @@
+/* Copyright 2008 Edward Yakop.
+*
+* 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 org.apache.zest.ide.plugin.idea.sideEffects.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static org.apache.zest.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.zest.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.zest.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.zest.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.zest.ide.plugin.idea.sideEffects.common.ZestSideEffectConstants.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class ZestSideEffectUtil
+{
+ /**
+ * @param searchContext Search context.
+ * @return {@code GenericSideEffect} class given the search context. {@code null} if not found.
+ * @since 0.1
+ */
+ @Nullable
+ public static PsiClass getGenericSideEffectClass( @NotNull PsiElement searchContext )
+ {
+ Project project = searchContext.getProject();
+ GlobalSearchScope searchScope = determineSearchScope( searchContext );
+ return getGenericSideEffectClass( project, searchScope );
+ }
+
+ /**
+ * @param project project.
+ * @param scope search scope.
+ * @return {@code GenericSideEffect} class given {@code project} and {@code scope} parameters.
+ * Returns {@code null} if not found.
+ * @since 0.1
+ */
+ @Nullable
+ public static PsiClass getGenericSideEffectClass( @NotNull Project project,
+ @Nullable GlobalSearchScope scope )
+ {
+ JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+ return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_GENERIC_SIDE_EFFECT, scope );
+ }
+
+ /**
+ * @param searchContext Search context.
+ * @return {@code SideEffectOf} class given the search context. {@code null} if not found.
+ * @since 0.1
+ */
+ @Nullable
+ public static PsiClass getSideEffectOfClass( @NotNull PsiElement searchContext )
+ {
+ Project project = searchContext.getProject();
+ GlobalSearchScope searchScope = determineSearchScope( searchContext );
+ return getSideEffectOfClass( project, searchScope );
+ }
+
+
+ /**
+ * @param project project.
+ * @param scope search scope.
+ * @return {@code SideEffectOf} class given {@code project} and {@code scope} parameters.
+ * Returns {@code null} if not found.
+ * @since 0.1
+ */
+ @Nullable
+ public static PsiClass getSideEffectOfClass( @NotNull Project project,
+ @Nullable GlobalSearchScope scope )
+ {
+ JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+ return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_SIDE_EFFECT_OF, scope );
+ }
+
+ /**
+ * @param elementWithinJavaClass element within java class.
+ * @return {@code @SideEffects} annotation declaration of the class that contains the element.
+ * Returns {@code null} if not found, or {@code element} is an invalid context.
+ * @since 0.1
+ */
+ @Nullable
+ public static PsiAnnotation getSideEffectsAnnotation( @NotNull PsiElement elementWithinJavaClass )
+ {
+ PsiClass psiClass = getPSIClass( elementWithinJavaClass );
+ return findAnnotation( psiClass, QUALIFIED_NAME_SIDE_EFFECTS );
+ }
+
+ /**
+ * @param annotation annotation to process.
+ * @return {@code @SideEffects} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
+ * {@code null} or annotation is not a {@code @SideEffects} annotation.
+ * @since 0.1
+ */
+ @NotNull
+ public static List<PsiAnnotationMemberValue> getSideEffectsAnnotationValue( @Nullable PsiAnnotation annotation )
+ {
+ if( annotation == null )
+ {
+ return emptyList();
+ }
+
+ String concernsQualifiedName = annotation.getQualifiedName();
+ if( !QUALIFIED_NAME_SIDE_EFFECTS.equals( concernsQualifiedName ) )
+ {
+ return emptyList();
+ }
+
+ return getAnnotationDefaultParameterValue( annotation );
+ }
+
+ /**
+ * @param value annotation member value.
+ * @return Side effect class reference given the {@code value} parameter. Returns {@code null} if it's not a
+ * class reference.
+ * @since 0.1
+ */
+ @Nullable
+ public static PsiJavaCodeReferenceElement getSideEffectClassReference( @NotNull PsiAnnotationMemberValue value )
+ {
+ return getClassReference( value );
+ }
+
+ /**
+ * Returns a {@code boolean} indicator whether the specified {@code psiClass} is a side effect.
+ *
+ * @param psiClass class to check.
+ * @return {@code true} if {@code psiClass} is a side effect, {@code false} otherwise.
+ * @since 0.1
+ */
+ public static boolean isASideEffect( @NotNull PsiClass psiClass )
+ {
+ if( psiClass.isInterface() )
+ {
+ return false;
+ }
+
+ PsiClass sideEffectOfClass = getSideEffectOfClass( psiClass );
+ return sideEffectOfClass != null && psiClass.isInheritor( sideEffectOfClass, true );
+ }
+
+ /**
+ * @param psiClass psi class to check.
+ * @return {@code true} if {@code psiClass} inherits {@code GenericSideEffect} class, {@code false} if
+ * {@code psiClass} does
+ * not inherit {@code GenericSideEffect} or {@code GenericSideEffect} is not found.
+ * @since 0.1
+ */
+ public static boolean isAGenericSideEffect( @NotNull PsiClass psiClass )
+ {
+ if( psiClass.isInterface() )
+ {
+ return false;
+ }
+
+ PsiClass genericSideEffect = getGenericSideEffectClass( psiClass );
+ return genericSideEffect != null && psiClass.isInheritor( genericSideEffect, true );
+ }
+
+ private ZestSideEffectUtil()
+ {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
index 3bb6a19..86a21d0 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
@@ -27,16 +27,16 @@ import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
import org.apache.zest.ide.plugin.idea.common.inspections.AbstractFix;
import org.apache.zest.ide.plugin.idea.common.inspections.AbstractInspection;
-import org.apache.zest.ide.plugin.idea.common.resource.Qi4jResourceBundle;
-import org.apache.zest.ide.plugin.idea.sideEffects.common.Qi4jSideEffectUtil;
+import org.apache.zest.ide.plugin.idea.common.resource.ZestResourceBundle;
+import org.apache.zest.ide.plugin.idea.sideEffects.common.ZestSideEffectUtil;
import java.util.LinkedList;
import java.util.List;
import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
import static org.apache.zest.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.zest.ide.plugin.idea.common.resource.Qi4jResourceBundle.message;
-import static org.apache.zest.ide.plugin.idea.sideEffects.common.Qi4jSideEffectUtil.*;
+import static org.apache.zest.ide.plugin.idea.common.resource.ZestResourceBundle.message;
+import static org.apache.zest.ide.plugin.idea.sideEffects.common.ZestSideEffectUtil.*;
/**
* @author edward.yakop@gmail.com
@@ -89,7 +89,7 @@ public final class SideEffectsAnnotationDeclaredCorrectlyInspection extends Abst
// If SideEffectOf is not resolved, ignore
Project project = psiClass.getProject();
GlobalSearchScope searchScope = determineSearchScope( psiClass );
- PsiClass sideEffectOfClass = Qi4jSideEffectUtil.getGenericSideEffectClass( project, searchScope );
+ PsiClass sideEffectOfClass = ZestSideEffectUtil.getGenericSideEffectClass( project, searchScope );
if( sideEffectOfClass == null )
{
return null;
@@ -117,7 +117,7 @@ public final class SideEffectsAnnotationDeclaredCorrectlyInspection extends Abst
// If side effect class does not inherit SideEffectOf class, suggest remove that reference.
if( !sideEffectClass.isInheritor( sideEffectOfClass, true ) )
{
- String message = Qi4jResourceBundle.message(
+ String message = ZestResourceBundle.message(
"side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of",
sideEffectClass.getQualifiedName()
);
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/resources/META-INF/plugin.xml
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/META-INF/plugin.xml b/tools/qidea/src/main/resources/META-INF/plugin.xml
index e85fd5d..c41eb5e 100644
--- a/tools/qidea/src/main/resources/META-INF/plugin.xml
+++ b/tools/qidea/src/main/resources/META-INF/plugin.xml
@@ -16,7 +16,7 @@
limitations under the License.
-->
<idea-plugin>
- <id>org.qi4j</id>
+ <id>org.apache.zest</id>
<name>qidea</name>
<description>Apache Zest™ idea plugin</description>
<version>0.1</version>
@@ -27,7 +27,7 @@
<application-components>
<component>
- <implementation-class>org.apache.zest.ide.plugin.idea.Qi4jApplicationComponent</implementation-class>
+ <implementation-class>org.apache.zest.ide.plugin.idea.ZestApplicationComponent</implementation-class>
</component>
</application-components>
@@ -38,7 +38,7 @@
<add-to-group group-id="CodeMenu" anchor="last"/>
</action>
- <group id="Zest" class="org.apache.zest.ide.plugin.idea.common.actions.Qi4jCreateActionGroup" text="Zest™">
+ <group id="Zest" class="org.apache.zest.ide.plugin.idea.common.actions.ZestCreateActionGroup" text="Zest™">
<action id="Zest.NewConcernOf"
class="org.apache.zest.ide.plugin.idea.concerns.actions.create.inPackage.CreateConcernOfInPackageAction"
text="New Concern" description="Create new Zest concern">
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/resources/fileTemplates/j2ee/GenericConcernOf.java.html
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/fileTemplates/j2ee/GenericConcernOf.java.html b/tools/qidea/src/main/resources/fileTemplates/j2ee/GenericConcernOf.java.html
index 10ea9e8..0eac5f0 100644
--- a/tools/qidea/src/main/resources/fileTemplates/j2ee/GenericConcernOf.java.html
+++ b/tools/qidea/src/main/resources/fileTemplates/j2ee/GenericConcernOf.java.html
@@ -22,7 +22,7 @@
<tr>
<td colspan="3">
<font face="verdana" size="-1">
- This is a template used by <b>IDEA</b> each time you create Qi4j generic concern of.
+ This is a template used by <b>IDEA</b> each time you create Zest generic concern of.
</font>
</td>
</tr>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html b/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html
index 5d85e6a..530d892 100644
--- a/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html
+++ b/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html
@@ -17,7 +17,7 @@
-->
<body>
<font face="verdana" size="-1">This inspection reports any @Concerns declarations value that does not implement
- [org.qi4j.composite.ConcernOf] class.
+ [org.apache.zest.composite.ConcernOf] class.
</font>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/Qi4jResourceBundle.properties
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/Qi4jResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/Qi4jResourceBundle.properties
deleted file mode 100644
index cd8c07c..0000000
--- a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/Qi4jResourceBundle.properties
+++ /dev/null
@@ -1,159 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-
-# *****************************************************************************
-# Common
-# *****************************************************************************
-qi4j.quick.fixes.family.name=Qi4j
-qi4j.action.group.title=Qi4j
-qi4j.action.group.description=Qi4j
-qi4j.inspections.name=Qi4j issues
-qi4j.file.template.group.title=Qi4j
-
-# *****************************************************************************
-# Concern
-# *****************************************************************************
-
-# =========
-# Intention
-# =========
-add.concern.family.name=Add Qi4j Concern
-add.concern.name=Add Qi4j Concern
-
-# ==========
-# Inspection
-# ==========
-concerns.annotation.declared.correctly.name.display=Concern class extends ConcernOf abstract class
-concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf=Concern class ''{0}'' does not inherit ''org.qi4j.composite.ConcernOf'' class.
-concerns.annotation.declared.correctly.fix.remove.concern.class.reference=Remove ''{0}'' concern class reference.
-concerns.annotation.declared.correctly.error.annotation.declared.in.class=@Concerns annotation can only be declared at interface
-concerns.annotation.declared.correctly.fix.remove.annotation=Remove @Concerns annotation
-
-# =======
-# Actions
-# =======
-
-# -------------------------
-# Create concern in package
-# -------------------------
-createConcernOfInPackage.menu.action.text=Qi4j Concern Of
-createConcernOfInPackage.menu.action.description=Creates new Qi4j ConcernOf
-createConcernOfInPackage.dlg.title=New Qi4j ConcernOf
-createConcernOfInPackage.dlg.prompt=Enter name for new ConcernOf
-createConcernOfInPackage.command.name=Create ConcernOf
-createConcernOfInPackage.progress.text=Creating ConcernOf ''{0}'' class
-createConcernOfInPackage.error.title=Create concern fail
-
-# *****************************************************************************
-# Mixin
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-
-# ----------------------------
-# Mixins implements mixin type
-# ----------------------------
-mixin.implements.mixin.type.name.display=Mixin class implements Mixin type class
-mixin.implements.mixin.type.fix.remove.class.reference=Remove ''{0}'' mixin class reference.
-mixin.implements.mixin.type.error.does.not.implement.any.mixin.type=Mixin class ''{0}'' does not inherit any mixin type of ''{1}''
-mixin.implements.mixin.type.error.mixin.is.an.interface=Mixin class ''{0}'' is an interface
-mixin.implements.mixin.type.error.mixin.is.a.concern=''{0}'' class is a concern
-mixin.implements.mixin.type.error.mixin.is.a.side.effect=''{0}'' class is a side effect
-
-# ------------------------------------------
-# Mixins declared on mixin type or composite
-# ------------------------------------------
-mixins.annotation.declared.on.mixin.type.name.display=@Mixins must be declared on interface
-mixins.annotation.declared.on.mixin.type.error.declared.on.class=@Mixins can only be declared on interface
-mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation=Remove @Mixins annotation
-
-# *****************************************************************************
-# Side Effect
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-side.effects.annotation.declared.correctly.name.display=@SideEffects annotation declared correctly
-side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of=Side Effect class ''{0}'' does not inherit ''org.qi4j.composite.SideEffectOf'' class.
-side.effects.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
-side.effects.annotation.declared.correctly.error.annotation.declared.in.class=@SideEffects annotation can only be declared at interface
-side.effects.annotation.declared.correctly.fix.remove.annotation=Remove @SideEffects annotation
-
-# *****************************************************************************
-# Injections
-# *****************************************************************************
-
-# -----------------
-# Common Inspection
-# -----------------
-abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly=''{0}'' can only be declared in constructor parameters or non static class field.
-
-# -------------------
-# @Structure injection
-# -------------------
-
-# ==========
-# Inspection
-# ==========
-injections.structure.annotation.declared.correctly.name.display=@Structure Injection
-injections.structure.annotation.declared.correctly.error.invalid.injection.type=@Structure does not inject ''{0}'' type.
-injections.structure.annotation.declared.correctly.fix.remove.annotation=Remove @Structure annotation
-
-# -----------------
-# @Service injection
-# -----------------
-
-# ==========
-# Inspection
-# ==========
-injections.service.annotation.declared.correctly.name.display=@Service Injection
-injections.service.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
-injections.service.annotation.declared.correctly.fix.remove.annotation=Remove @Service annotation
-injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Service with @Structure annotation
-
-# -----------------
-# @Invocation injection
-# -----------------
-
-# ==========
-# Inspection
-# ==========
-injections.invocation.annotation.declared.correctly.name.display=@Invocation Injection
-injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
-injections.invocation.annotation.declared.correctly.error.type.is.not.injectable=''{0}'' type is not injectable by @Invocation
-injections.invocation.annotation.declared.correctly.fix.remove.annotation=Remove @Invocation annotation
-injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Invocation with @Structure annotation
-
-# *****************************************************************************
-# Applies To
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class=@AppliesTo must be declared on class
-applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin=''{0}'' is neither an interface or implements ''AppliesToFilter''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern=''{0}'' requires ''{1}'' to extends GenericConcern
-applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect=''{0}'' requires ''{1}'' to extends GenericSideEffect
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler=''{0}'' requires ''{1}'' to implements InvocationHandler
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericConcern''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericSideEffect''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler=''{0}'' requires ''{1}'' to implement ''{0}'' or ''InvocationHandler'' interface
-applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin=''{0}'' is not an annotation or ''AppliesToFilter'' or an interface
-applies.to.annotation.declared.correctly.fix.remove.annotation=Remove ''@AppliesTo'' annotation
-applies.to.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
new file mode 100644
index 0000000..d9d20b1
--- /dev/null
+++ b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
@@ -0,0 +1,159 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+# *****************************************************************************
+# Common
+# *****************************************************************************
+zest.quick.fixes.family.name=Zest
+zest.action.group.title=Zest
+zest.action.group.description=Zest
+zest.inspections.name=Zest issues
+zest.file.template.group.title=Zest
+
+# *****************************************************************************
+# Concern
+# *****************************************************************************
+
+# =========
+# Intention
+# =========
+add.concern.family.name=Add Zest Concern
+add.concern.name=Add Zest Concern
+
+# ==========
+# Inspection
+# ==========
+concerns.annotation.declared.correctly.name.display=Concern class extends ConcernOf abstract class
+concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf=Concern class ''{0}'' does not inherit ''org.apache.zest.composite.ConcernOf'' class.
+concerns.annotation.declared.correctly.fix.remove.concern.class.reference=Remove ''{0}'' concern class reference.
+concerns.annotation.declared.correctly.error.annotation.declared.in.class=@Concerns annotation can only be declared at interface
+concerns.annotation.declared.correctly.fix.remove.annotation=Remove @Concerns annotation
+
+# =======
+# Actions
+# =======
+
+# -------------------------
+# Create concern in package
+# -------------------------
+createConcernOfInPackage.menu.action.text=Zest Concern Of
+createConcernOfInPackage.menu.action.description=Creates new Zest ConcernOf
+createConcernOfInPackage.dlg.title=New Zest ConcernOf
+createConcernOfInPackage.dlg.prompt=Enter name for new ConcernOf
+createConcernOfInPackage.command.name=Create ConcernOf
+createConcernOfInPackage.progress.text=Creating ConcernOf ''{0}'' class
+createConcernOfInPackage.error.title=Create concern fail
+
+# *****************************************************************************
+# Mixin
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+
+# ----------------------------
+# Mixins implements mixin type
+# ----------------------------
+mixin.implements.mixin.type.name.display=Mixin class implements Mixin type class
+mixin.implements.mixin.type.fix.remove.class.reference=Remove ''{0}'' mixin class reference.
+mixin.implements.mixin.type.error.does.not.implement.any.mixin.type=Mixin class ''{0}'' does not inherit any mixin type of ''{1}''
+mixin.implements.mixin.type.error.mixin.is.an.interface=Mixin class ''{0}'' is an interface
+mixin.implements.mixin.type.error.mixin.is.a.concern=''{0}'' class is a concern
+mixin.implements.mixin.type.error.mixin.is.a.side.effect=''{0}'' class is a side effect
+
+# ------------------------------------------
+# Mixins declared on mixin type or composite
+# ------------------------------------------
+mixins.annotation.declared.on.mixin.type.name.display=@Mixins must be declared on interface
+mixins.annotation.declared.on.mixin.type.error.declared.on.class=@Mixins can only be declared on interface
+mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation=Remove @Mixins annotation
+
+# *****************************************************************************
+# Side Effect
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+side.effects.annotation.declared.correctly.name.display=@SideEffects annotation declared correctly
+side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of=Side Effect class ''{0}'' does not inherit ''org.apache.zest.composite.SideEffectOf'' class.
+side.effects.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
+side.effects.annotation.declared.correctly.error.annotation.declared.in.class=@SideEffects annotation can only be declared at interface
+side.effects.annotation.declared.correctly.fix.remove.annotation=Remove @SideEffects annotation
+
+# *****************************************************************************
+# Injections
+# *****************************************************************************
+
+# -----------------
+# Common Inspection
+# -----------------
+abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly=''{0}'' can only be declared in constructor parameters or non static class field.
+
+# -------------------
+# @Structure injection
+# -------------------
+
+# ==========
+# Inspection
+# ==========
+injections.structure.annotation.declared.correctly.name.display=@Structure Injection
+injections.structure.annotation.declared.correctly.error.invalid.injection.type=@Structure does not inject ''{0}'' type.
+injections.structure.annotation.declared.correctly.fix.remove.annotation=Remove @Structure annotation
+
+# -----------------
+# @Service injection
+# -----------------
+
+# ==========
+# Inspection
+# ==========
+injections.service.annotation.declared.correctly.name.display=@Service Injection
+injections.service.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
+injections.service.annotation.declared.correctly.fix.remove.annotation=Remove @Service annotation
+injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Service with @Structure annotation
+
+# -----------------
+# @Invocation injection
+# -----------------
+
+# ==========
+# Inspection
+# ==========
+injections.invocation.annotation.declared.correctly.name.display=@Invocation Injection
+injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
+injections.invocation.annotation.declared.correctly.error.type.is.not.injectable=''{0}'' type is not injectable by @Invocation
+injections.invocation.annotation.declared.correctly.fix.remove.annotation=Remove @Invocation annotation
+injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Invocation with @Structure annotation
+
+# *****************************************************************************
+# Applies To
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class=@AppliesTo must be declared on class
+applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin=''{0}'' is neither an interface or implements ''AppliesToFilter''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern=''{0}'' requires ''{1}'' to extends GenericConcern
+applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect=''{0}'' requires ''{1}'' to extends GenericSideEffect
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler=''{0}'' requires ''{1}'' to implements InvocationHandler
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericConcern''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericSideEffect''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler=''{0}'' requires ''{1}'' to implement ''{0}'' or ''InvocationHandler'' interface
+applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin=''{0}'' is not an annotation or ''AppliesToFilter'' or an interface
+applies.to.annotation.declared.correctly.fix.remove.annotation=Remove ''@AppliesTo'' annotation
+applies.to.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/shell/build.gradle
----------------------------------------------------------------------
diff --git a/tools/shell/build.gradle b/tools/shell/build.gradle
index 19d1ed7..16c19de 100644
--- a/tools/shell/build.gradle
+++ b/tools/shell/build.gradle
@@ -20,12 +20,12 @@
apply plugin: 'application'
description = "Command line tools for building Apache Zest™ applications."
-mainClassName = "org.qi4j.tools.shell.Main"
+mainClassName = "org.apache.zest.tools.shell.Main"
jar { manifest { name = "Apache Zest™ Command Line" } }
dependencies {
- compile( project( ":org.qi4j.core:org.qi4j.core.bootstrap" ) )
+ compile( project( ":org.apache.zest.core:org.apache.zest.core.bootstrap" ) )
testRuntime( libraries.logback )
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/shell/src/bin/qi4j
----------------------------------------------------------------------
diff --git a/tools/shell/src/bin/qi4j b/tools/shell/src/bin/qi4j
deleted file mode 100644
index 544595b..0000000
--- a/tools/shell/src/bin/qi4j
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-
-java -jar org.qi4j.tools.shell-@@version@@.jar "$@"
-
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tools/shell/src/bin/zest
----------------------------------------------------------------------
diff --git a/tools/shell/src/bin/zest b/tools/shell/src/bin/zest
new file mode 100644
index 0000000..2438b07
--- /dev/null
+++ b/tools/shell/src/bin/zest
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+java -jar org.apache.zest.tools.shell-@@version@@.jar "$@"
+
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/cargo/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/cargo/build.gradle b/tutorials/cargo/build.gradle
index 9a301bb..b5eef48 100644
--- a/tutorials/cargo/build.gradle
+++ b/tutorials/cargo/build.gradle
@@ -22,10 +22,10 @@ description = "Tutorial on how to convert existing application into a Apache Zes
jar { manifest { name = "Apache Zest™ Tutorial - Cargo" }}
dependencies {
- compile(project(":org.qi4j.core:org.qi4j.core.bootstrap"))
- compile(project(":org.qi4j.core:org.qi4j.core.runtime")) // TODO: Get rid of this dependency
+ compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap"))
+ compile(project(":org.apache.zest.core:org.apache.zest.core.runtime")) // TODO: Get rid of this dependency
- testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport"))
+ testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport"))
testCompile(libraries.easymock)
testRuntime(libraries.logback)
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java
----------------------------------------------------------------------
diff --git a/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java b/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java
index c98681c..2521680 100644
--- a/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java
+++ b/tutorials/cargo/src/test/java/org/apache/zest/tutorials/cargo/step2/Step2TestCase.java
@@ -21,12 +21,12 @@ import org.junit.Test;
import org.apache.zest.api.composite.TransientBuilder;
import org.apache.zest.bootstrap.AssemblyException;
import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractQi4jTest;
+import org.apache.zest.test.AbstractZestTest;
import static org.junit.Assert.assertEquals;
public class Step2TestCase
- extends AbstractQi4jTest
+ extends AbstractZestTest
{
private Voyage voyage;
private ShippingService shippingService;
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/composites/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/composites/build.gradle b/tutorials/composites/build.gradle
index 534848a..7f4a505 100644
--- a/tutorials/composites/build.gradle
+++ b/tutorials/composites/build.gradle
@@ -22,10 +22,10 @@ description = "Basic tutorial on how to covert a simple 'Hello World' applicatio
jar { manifest { name = "Apache Zest™ Tutorial - Composites" }}
dependencies {
- compile(project(":org.qi4j.core:org.qi4j.core.bootstrap"))
- compile(project(":org.qi4j.libraries:org.qi4j.library.constraints"))
+ compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap"))
+ compile(project(":org.apache.zest.libraries:org.apache.zest.library.constraints"))
- testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport"))
- testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime"))
+ testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport"))
+ testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime"))
testRuntime(libraries.logback)
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/package.html
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/package.html b/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/package.html
index cded1fe..adf1505 100644
--- a/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/package.html
+++ b/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/package.html
@@ -34,7 +34,7 @@ Steps for this tutorial:
</p>
<ol>
<li>Create an interface that extends the domain interface HelloWorld and
- org.qi4j.api.composite.TransientComposite.
+ org.apache.zest.api.composite.TransientComposite.
</li>
<li>Add a @Mixins annotation to it with the name of the Mixin as argument.</li>
</ol>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial5/package.html
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial5/package.html b/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial5/package.html
index c5b40c8..adbf0ec 100644
--- a/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial5/package.html
+++ b/tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial5/package.html
@@ -52,8 +52,8 @@ Steps for this tutorial:
</ol>
<p><em>Note:</em></p>
<p>
- The previous steps had a dependency to the <code>org.qi4j.core.api</code> only. The constraints
- you've used in this step, introduce a new dependency to the <code>org.qi4j.library.constraints</code>
+ The previous steps had a dependency to the <code>org.apache.zest.core.api</code> only. The constraints
+ you've used in this step, introduce a new dependency to the <code>org.apache.zest.library.constraints</code>
library, where all the constraint related classes reside. So update your classpath settings
accordingly.
</p>
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/hello/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/hello/build.gradle b/tutorials/hello/build.gradle
index 2547c08..26924f7 100644
--- a/tutorials/hello/build.gradle
+++ b/tutorials/hello/build.gradle
@@ -19,11 +19,11 @@ description = "Basic tutorial on how to covert a simple 'Hello World' applicatio
jar { manifest { name = "Apache Zest™ Tutorial - Composites" }}
dependencies {
- compile(project(":org.qi4j.core:org.qi4j.core.bootstrap"))
- compile(project(":org.qi4j.libraries:org.qi4j.library.constraints"))
+ compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap"))
+ compile(project(":org.apache.zest.libraries:org.apache.zest.library.constraints"))
- testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport"))
+ testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport"))
- testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime"))
+ testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime"))
testRuntime(libraries.logback)
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
index 00c0092..50007b5 100644
--- a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
+++ b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
@@ -17,13 +17,13 @@ import org.junit.Test;
import org.apache.zest.api.value.ValueBuilder;
import org.apache.zest.bootstrap.AssemblyException;
import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractQi4jTest;
+import org.apache.zest.test.AbstractZestTest;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
// START SNIPPET: step1
-public class HelloTest extends AbstractQi4jTest
+public class HelloTest extends AbstractZestTest
{
// END SNIPPET: step1
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java
index ddc8e79..efaa8c3 100644
--- a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java
+++ b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest2.java
@@ -17,12 +17,12 @@ import org.junit.Test;
import org.apache.zest.api.composite.TransientBuilder;
import org.apache.zest.bootstrap.AssemblyException;
import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractQi4jTest;
+import org.apache.zest.test.AbstractZestTest;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
-public class HelloTest2 extends AbstractQi4jTest
+public class HelloTest2 extends AbstractZestTest
{
@Override
public void assemble( ModuleAssembly module )
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java
index 3d2e896..173dbfd 100644
--- a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java
+++ b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest3.java
@@ -17,12 +17,12 @@ import org.junit.Test;
import org.apache.zest.api.service.ServiceReference;
import org.apache.zest.bootstrap.AssemblyException;
import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractQi4jTest;
+import org.apache.zest.test.AbstractZestTest;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
-public class HelloTest3 extends AbstractQi4jTest
+public class HelloTest3 extends AbstractZestTest
{
@Override
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest4.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest4.java b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest4.java
index 1b034f5..3ce8125 100644
--- a/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest4.java
+++ b/tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest4.java
@@ -19,12 +19,12 @@ import org.apache.zest.api.unitofwork.UnitOfWork;
import org.apache.zest.bootstrap.AssemblyException;
import org.apache.zest.bootstrap.ModuleAssembly;
import org.apache.zest.entitystore.memory.MemoryEntityStoreService;
-import org.apache.zest.test.AbstractQi4jTest;
+import org.apache.zest.test.AbstractZestTest;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
-public class HelloTest4 extends AbstractQi4jTest
+public class HelloTest4 extends AbstractZestTest
{
@Override
public void assemble( ModuleAssembly module )