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; }
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; }
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; }