/** * The default generation uses @java.lang.Override for some reason; * Let's clean that up */ void cleanOverrideAnnotation(PsiMethodMember member) { final PsiMethod[] ms = targetClass.findMethodsBySignature( member.getElement(), false); for (PsiMethod m : ms) { PsiModifierList modifierList = m.getModifierList(); PsiAnnotation annotation = modifierList.findAnnotation(Override.class.getName()); if (null != annotation) { annotation.delete(); modifierList.addAnnotation("Override"); } } }
/** * Tests that the Quick fix for a parameter with the javax @Nullable and @DefaultValue returns the * parameter without @Nullable and @DefaultValue. */ public void testQuickFix_withJavaxNullableAndDefaultAnnotation() { Project myProject = myFixture.getProject(); PsiParameter parameter = JavaPsiFacade.getInstance(myProject) .getElementFactory() .createParameter("param", PsiType.BOOLEAN); parameter.getModifierList().addAnnotation("javax.annotation.Nullable"); parameter.getModifierList().addAnnotation(GctConstants.APP_ENGINE_ANNOTATION_DEFAULT_VALUE); runQuickFixTest(parameter, " boolean param"); }
/** * Tests that the Quick fix for a parameter with the javax @Nullable returns the parameter * without @Nullable. */ public void testQuickFix_withJavaxNullableAnnotation() { Project myProject = myFixture.getProject(); PsiParameter parameter = JavaPsiFacade.getInstance(myProject) .getElementFactory() .createParameter("param", PsiType.BOOLEAN); parameter.getModifierList().addAnnotation("javax.annotation.Nullable"); runQuickFixTest(parameter, " boolean param"); }
/** * Tests that the Quick fix for a parameter with @DefaultValue returns the parameter * without @DefaultValue. */ public void testQuickFix_withDefaultAnnotation() { Project myProject = myFixture.getProject(); PsiParameter parameter = JavaPsiFacade.getInstance(myProject) .getElementFactory() .createParameter("param", PsiType.BOOLEAN); parameter.getModifierList().addAnnotation(GctConstants.APP_ENGINE_ANNOTATION_DEFAULT_VALUE); runQuickFixTest(parameter, " boolean param"); }
/** Test that the Quick fix for a parameter with @Named returns the same parameter unchanged. */ public void testQuickFix_withNamedAnnotation() { Project myProject = myFixture.getProject(); PsiParameter parameter = JavaPsiFacade.getInstance(myProject) .getElementFactory() .createParameter("param", PsiType.BOOLEAN); parameter.getModifierList().addAnnotation(GctConstants.APP_ENGINE_ANNOTATION_NAMED); runQuickFixTest(parameter, "@" + GctConstants.APP_ENGINE_ANNOTATION_NAMED + " boolean param"); }
/** * Tests that the Quick fix for a parameter with the App Engine @Nullable returns the parameter * without @Nullable. */ public void testQuickFix_withGaeNullableAnnotation() { Project myProject = myFixture.getProject(); PsiParameter parameter = JavaPsiFacade.getInstance(myProject) .getElementFactory() .createParameter("param", PsiType.BOOLEAN); parameter.getModifierList().addAnnotation(GctConstants.APP_ENGINE_ANNOTATION_NULLABLE); runQuickFixTest(parameter, " boolean param"); }