public void annotationMethodModifiersCheck(AnnotationMethodDeclaration md) { modifiersCheck(md.astModifiers(), METHOD_MODIFIERS_EXCLUSIVITY, METHOD_MODIFIERS_LEGAL & ~K_STRICTFP, "annotation method declarations"); checkStaticChain(md.astModifiers()); }
public void enumDeclarationModifiersCheck(EnumDeclaration ad) { int flags = typeModifiersCheck(ad, "enum declarations"); generateNotAllowedKeywordError(ad.astModifiers(), flags, K_FINAL, "final", "Enums cannot be marked final"); }
private int typeModifiersCheck(TypeDeclaration td, String desc) { int flags = modifiersCheck(td.astModifiers(), TYPE_MODIFIERS_EXCLUSIVITY, TYPE_MODIFIERS_LEGAL, desc); boolean staticWarningEmitted = false; if (td.upIfTopLevelToCompilationUnit() != null) { generateNotAllowedKeywordError(td.astModifiers(), flags, K_PRIVATE, "private", "Top-level types cannot be private."); staticWarningEmitted |= generateNotAllowedKeywordError(td.astModifiers(), flags, K_STATIC, "static", "Top-level types cannot be static."); } else if (td.upToBlock() != null) { generateNotAllowedKeywordError(td.astModifiers(), flags, K_PRIVATE, "private", "Method-local types cannot be private."); generateNotAllowedKeywordError(td.astModifiers(), flags, K_PROTECTED, "protected", "Method-local types cannot be protected."); generateNotAllowedKeywordError(td.astModifiers(), flags, K_PUBLIC, "public", "Method-local types cannot be public."); staticWarningEmitted |= generateNotAllowedKeywordError(td.astModifiers(), flags, K_STATIC, "static", "Method-local types cannot be static."); } if (!staticWarningEmitted) checkStaticChain(td.astModifiers()); return flags; }
public void localVariableModifiersCheck(VariableDefinition vd) { boolean applies = vd.upUpIfLocalVariableToBlock() != null; if (!applies) applies = vd.upToForEach() != null; if (!applies) applies = vd.upToFor() != null; if (!applies) return; modifiersCheck(vd.astModifiers(), new int[0], K_FINAL, "local variable declarations"); }
public void classDeclarationModifiersCheck(ClassDeclaration cd) { typeModifiersCheck(cd, "class declarations"); }
generateExclusivityError(implicits, exclusive, modifiers);
private int typeModifiersCheck(TypeDeclaration td, String desc) { int flags = modifiersCheck(td.astModifiers(), TYPE_MODIFIERS_EXCLUSIVITY, TYPE_MODIFIERS_LEGAL, desc); boolean staticWarningEmitted = false; if (td.upIfTopLevelToCompilationUnit() != null) { generateNotAllowedKeywordError(td.astModifiers(), flags, K_PRIVATE, "private", "Top-level types cannot be private."); staticWarningEmitted |= generateNotAllowedKeywordError(td.astModifiers(), flags, K_STATIC, "static", "Top-level types cannot be static."); } else if (td.upToBlock() != null) { generateNotAllowedKeywordError(td.astModifiers(), flags, K_PRIVATE, "private", "Method-local types cannot be private."); generateNotAllowedKeywordError(td.astModifiers(), flags, K_PROTECTED, "protected", "Method-local types cannot be protected."); generateNotAllowedKeywordError(td.astModifiers(), flags, K_PUBLIC, "public", "Method-local types cannot be public."); staticWarningEmitted |= generateNotAllowedKeywordError(td.astModifiers(), flags, K_STATIC, "static", "Method-local types cannot be static."); } if (!staticWarningEmitted) checkStaticChain(td.astModifiers()); return flags; }
public void localVariableModifiersCheck(VariableDefinition vd) { boolean applies = vd.upUpIfLocalVariableToBlock() != null; if (!applies) applies = vd.upToForEach() != null; if (!applies) applies = vd.upToFor() != null; if (!applies) return; modifiersCheck(vd.astModifiers(), new int[0], K_FINAL, "local variable declarations"); }
public void classDeclarationModifiersCheck(ClassDeclaration cd) { typeModifiersCheck(cd, "class declarations"); }
generateExclusivityError(implicits, exclusive, modifiers);
public void annotationMethodModifiersCheck(AnnotationMethodDeclaration md) { modifiersCheck(md.astModifiers(), METHOD_MODIFIERS_EXCLUSIVITY, METHOD_MODIFIERS_LEGAL & ~K_STRICTFP, "annotation method declarations"); checkStaticChain(md.astModifiers()); }
public void annotationDeclarationModifiersCheck(AnnotationDeclaration ad) { int flags = typeModifiersCheck(ad, "annotation declarations"); generateNotAllowedKeywordError(ad.astModifiers(), flags, K_FINAL, "final", "Annotations cannot be final"); }
private int typeModifiersCheck(TypeDeclaration td, String desc) { int flags = modifiersCheck(td.astModifiers(), TYPE_MODIFIERS_EXCLUSIVITY, TYPE_MODIFIERS_LEGAL, desc); boolean staticWarningEmitted = false; if (td.upIfTopLevelToCompilationUnit() != null) { generateNotAllowedKeywordError(td.astModifiers(), flags, K_PRIVATE, "private", "Top-level types cannot be private."); staticWarningEmitted |= generateNotAllowedKeywordError(td.astModifiers(), flags, K_STATIC, "static", "Top-level types cannot be static."); } else if (td.upToBlock() != null) { generateNotAllowedKeywordError(td.astModifiers(), flags, K_PRIVATE, "private", "Method-local types cannot be private."); generateNotAllowedKeywordError(td.astModifiers(), flags, K_PROTECTED, "protected", "Method-local types cannot be protected."); generateNotAllowedKeywordError(td.astModifiers(), flags, K_PUBLIC, "public", "Method-local types cannot be public."); staticWarningEmitted |= generateNotAllowedKeywordError(td.astModifiers(), flags, K_STATIC, "static", "Method-local types cannot be static."); } if (!staticWarningEmitted) checkStaticChain(td.astModifiers()); return flags; }
public void localVariableModifiersCheck(VariableDefinition vd) { boolean applies = vd.upUpIfLocalVariableToBlock() != null; if (!applies) applies = vd.upToForEach() != null; if (!applies) applies = vd.upToFor() != null; if (!applies) return; modifiersCheck(vd.astModifiers(), new int[0], K_FINAL, "local variable declarations"); }
public void classDeclarationModifiersCheck(ClassDeclaration cd) { typeModifiersCheck(cd, "class declarations"); }
generateExclusivityError(implicits, exclusive, modifiers);
public void methodModifiersCheck(MethodDeclaration md) { modifiersCheck(md.astModifiers(), METHOD_MODIFIERS_EXCLUSIVITY, METHOD_MODIFIERS_LEGAL, "method declarations"); checkStaticChain(md.astModifiers()); }
public void annotationDeclarationModifiersCheck(AnnotationDeclaration ad) { int flags = typeModifiersCheck(ad, "annotation declarations"); generateNotAllowedKeywordError(ad.astModifiers(), flags, K_FINAL, "final", "Annotations cannot be final"); }
public void annotationMethodModifiersCheck(AnnotationMethodDeclaration md) { modifiersCheck(md.astModifiers(), METHOD_MODIFIERS_EXCLUSIVITY, METHOD_MODIFIERS_LEGAL & ~K_STRICTFP, "annotation method declarations"); checkStaticChain(md.astModifiers()); }
public void annotationDeclarationModifiersCheck(AnnotationDeclaration ad) { int flags = typeModifiersCheck(ad, "annotation declarations"); generateNotAllowedKeywordError(ad.astModifiers(), flags, K_FINAL, "final", "Annotations cannot be final"); }