1 11 package org.eclipse.jdt.internal.ui.text.correction; 12 13 import java.util.ArrayList ; 14 import java.util.Collection ; 15 import java.util.HashSet ; 16 17 import org.eclipse.core.runtime.CoreException; 18 19 import org.eclipse.jdt.core.IBuffer; 20 import org.eclipse.jdt.core.ICompilationUnit; 21 import org.eclipse.jdt.core.JavaModelException; 22 import org.eclipse.jdt.core.compiler.IProblem; 23 24 import org.eclipse.jdt.internal.corext.util.JavaModelUtil; 25 26 import org.eclipse.jdt.ui.text.java.IInvocationContext; 27 import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal; 28 import org.eclipse.jdt.ui.text.java.IProblemLocation; 29 import org.eclipse.jdt.ui.text.java.IQuickFixProcessor; 30 31 33 public class QuickFixProcessor implements IQuickFixProcessor { 34 35 36 public boolean hasCorrections(ICompilationUnit cu, int problemId) { 37 switch (problemId) { 38 case IProblem.UnterminatedString: 39 case IProblem.UnusedImport: 40 case IProblem.DuplicateImport: 41 case IProblem.CannotImportPackage: 42 case IProblem.ConflictingImport: 43 case IProblem.ImportNotFound: 44 case IProblem.UndefinedMethod: 45 case IProblem.UndefinedConstructor: 46 case IProblem.ParameterMismatch: 47 case IProblem.MethodButWithConstructorName: 48 case IProblem.UndefinedField: 49 case IProblem.UndefinedName: 50 case IProblem.PublicClassMustMatchFileName: 51 case IProblem.PackageIsNotExpectedPackage: 52 case IProblem.UndefinedType: 53 case IProblem.TypeMismatch: 54 case IProblem.UnhandledException: 55 case IProblem.UnreachableCatch: 56 case IProblem.InvalidCatchBlockSequence: 57 case IProblem.VoidMethodReturnsValue: 58 case IProblem.ShouldReturnValue: 59 case IProblem.MissingReturnType: 60 case IProblem.NonExternalizedStringLiteral: 61 case IProblem.NonStaticAccessToStaticField: 62 case IProblem.NonStaticAccessToStaticMethod: 63 case IProblem.StaticMethodRequested: 64 case IProblem.NonStaticFieldFromStaticInvocation: 65 case IProblem.InstanceMethodDuringConstructorInvocation: 66 case IProblem.InstanceFieldDuringConstructorInvocation: 67 case IProblem.NotVisibleMethod: 68 case IProblem.NotVisibleConstructor: 69 case IProblem.NotVisibleType: 70 case IProblem.NotVisibleField: 71 case IProblem.BodyForAbstractMethod: 72 case IProblem.AbstractMethodInAbstractClass: 73 case IProblem.AbstractMethodMustBeImplemented: 74 case IProblem.BodyForNativeMethod: 75 case IProblem.OuterLocalMustBeFinal: 76 case IProblem.UninitializedLocalVariable: 77 case IProblem.UndefinedConstructorInDefaultConstructor: 78 case IProblem.UnhandledExceptionInDefaultConstructor: 79 case IProblem.NotVisibleConstructorInDefaultConstructor: 80 case IProblem.AmbiguousType: 81 case IProblem.UnusedPrivateMethod: 82 case IProblem.UnusedPrivateConstructor: 83 case IProblem.UnusedPrivateField: 84 case IProblem.UnusedPrivateType: 85 case IProblem.LocalVariableIsNeverUsed: 86 case IProblem.ArgumentIsNeverUsed: 87 case IProblem.MethodRequiresBody: 88 case IProblem.NeedToEmulateFieldReadAccess: 89 case IProblem.NeedToEmulateFieldWriteAccess: 90 case IProblem.NeedToEmulateMethodAccess: 91 case IProblem.NeedToEmulateConstructorAccess: 92 case IProblem.SuperfluousSemicolon: 93 case IProblem.UnnecessaryCast: 94 case IProblem.UnnecessaryInstanceof: 95 case IProblem.IndirectAccessToStaticField: 96 case IProblem.IndirectAccessToStaticMethod: 97 case IProblem.Task: 98 case IProblem.UnusedMethodDeclaredThrownException: 99 case IProblem.UnusedConstructorDeclaredThrownException: 100 case IProblem.UnqualifiedFieldAccess: 101 case IProblem.JavadocMissing: 102 case IProblem.JavadocMissingParamTag: 103 case IProblem.JavadocMissingReturnTag: 104 case IProblem.JavadocMissingThrowsTag: 105 case IProblem.JavadocUndefinedType: 106 case IProblem.JavadocAmbiguousType: 107 case IProblem.JavadocNotVisibleType: 108 case IProblem.JavadocInvalidThrowsClassName: 109 case IProblem.JavadocDuplicateThrowsClassName: 110 case IProblem.JavadocDuplicateReturnTag: 111 case IProblem.JavadocDuplicateParamName: 112 case IProblem.JavadocInvalidParamName: 113 case IProblem.JavadocUnexpectedTag: 114 case IProblem.JavadocInvalidTag: 115 case IProblem.NonBlankFinalLocalAssignment: 116 case IProblem.DuplicateFinalLocalInitialization: 117 case IProblem.FinalFieldAssignment: 118 case IProblem.DuplicateBlankFinalFieldInitialization: 119 case IProblem.AnonymousClassCannotExtendFinalClass: 120 case IProblem.ClassExtendFinalClass: 121 case IProblem.FinalMethodCannotBeOverridden: 122 case IProblem.InheritedMethodReducesVisibility: 123 case IProblem.MethodReducesVisibility: 124 case IProblem.OverridingNonVisibleMethod: 125 case IProblem.CannotOverrideAStaticMethodWithAnInstanceMethod: 126 case IProblem.CannotHideAnInstanceMethodWithAStaticMethod: 127 case IProblem.UnexpectedStaticModifierForMethod: 128 case IProblem.LocalVariableHidingLocalVariable: 129 case IProblem.LocalVariableHidingField: 130 case IProblem.FieldHidingLocalVariable: 131 case IProblem.FieldHidingField: 132 case IProblem.ArgumentHidingLocalVariable: 133 case IProblem.ArgumentHidingField: 134 case IProblem.DuplicateField: 135 case IProblem.DuplicateMethod: 136 case IProblem.DuplicateTypeVariable: 137 case IProblem.DuplicateNestedType: 138 case IProblem.IllegalModifierForInterfaceMethod: 139 case IProblem.IllegalModifierForInterface: 140 case IProblem.IllegalModifierForClass: 141 case IProblem.IllegalModifierForInterfaceField: 142 case IProblem.IllegalModifierForMemberInterface: 143 case IProblem.IllegalModifierForMemberClass: 144 case IProblem.IllegalModifierForLocalClass: 145 case IProblem.IllegalModifierForArgument: 146 case IProblem.IllegalModifierForField: 147 case IProblem.IllegalModifierForMethod: 148 case IProblem.IllegalModifierForVariable: 149 case IProblem.UnexpectedStaticModifierForField: 150 case IProblem.IllegalModifierCombinationFinalVolatileForField: 151 case IProblem.IllegalVisibilityModifierForInterfaceMemberType: 152 case IProblem.IncompatibleReturnType: 153 case IProblem.IncompatibleExceptionInThrowsClause: 154 case IProblem.NoMessageSendOnArrayType: 155 case IProblem.InvalidOperator: 156 case IProblem.MissingSerialVersion: 157 case IProblem.UnnecessaryElse: 158 case IProblem.SuperclassMustBeAClass: 159 case IProblem.UseAssertAsAnIdentifier: 160 case IProblem.UseEnumAsAnIdentifier: 161 case IProblem.RedefinedLocal: 162 case IProblem.RedefinedArgument: 163 case IProblem.CodeCannotBeReached: 164 case IProblem.InvalidUsageOfTypeParameters: 165 case IProblem.InvalidUsageOfStaticImports: 166 case IProblem.InvalidUsageOfForeachStatements: 167 case IProblem.InvalidUsageOfTypeArguments: 168 case IProblem.InvalidUsageOfEnumDeclarations: 169 case IProblem.InvalidUsageOfVarargs: 170 case IProblem.InvalidUsageOfAnnotations: 171 case IProblem.InvalidUsageOfAnnotationDeclarations: 172 case IProblem.FieldMissingDeprecatedAnnotation: 173 case IProblem.OverridingDeprecatedMethod: 174 case IProblem.MethodMissingDeprecatedAnnotation: 175 case IProblem.TypeMissingDeprecatedAnnotation: 176 case IProblem.MissingOverrideAnnotation: 177 case IProblem.MethodMustOverride: 178 case IProblem.MethodMustOverrideOrImplement: 179 case IProblem.IsClassPathCorrect: 180 case IProblem.MethodReturnsVoid: 181 case IProblem.ForbiddenReference: 182 case IProblem.DiscouragedReference: 183 case IProblem.UnnecessaryNLSTag: 184 case IProblem.AssignmentHasNoEffect: 185 case IProblem.UnsafeTypeConversion: 186 case IProblem.UndefinedAnnotationMember: 187 case IProblem.MissingValueForAnnotationMember: 188 case IProblem.FallthroughCase: 189 case IProblem.NonGenericType: 190 case IProblem.UnhandledWarningToken: 191 return true; 192 default: 193 if (JavaModelUtil.is50OrHigher(cu.getJavaProject())) { 194 return SuppressWarningsSubProcessor.hasSuppressWarningsProposal(problemId); 195 } 196 return false; 197 } 198 } 199 200 private static int moveBack(int offset, int start, String ignoreCharacters, ICompilationUnit cu) { 201 try { 202 IBuffer buf= cu.getBuffer(); 203 while (offset >= start) { 204 if (ignoreCharacters.indexOf(buf.getChar(offset - 1)) == -1) { 205 return offset; 206 } 207 offset--; 208 } 209 } catch(JavaModelException e) { 210 } 211 return start; 212 } 213 214 215 218 public IJavaCompletionProposal[] getCorrections(IInvocationContext context, IProblemLocation[] locations) throws CoreException { 219 if (locations == null || locations.length == 0) { 220 return null; 221 } 222 223 HashSet handledProblems= new HashSet (locations.length); 224 ArrayList resultingCollections= new ArrayList (); 225 for (int i= 0; i < locations.length; i++) { 226 IProblemLocation curr= locations[i]; 227 Integer id= new Integer (curr.getProblemId()); 228 if (handledProblems.add(id)) { 229 process(context, curr, resultingCollections); 230 } 231 } 232 return (IJavaCompletionProposal[]) resultingCollections.toArray(new IJavaCompletionProposal[resultingCollections.size()]); 233 } 234 235 private void process(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { 236 int id= problem.getProblemId(); 237 if (id == 0) { return; 239 } 240 switch (id) { 241 case IProblem.UnterminatedString: 242 String quoteLabel= CorrectionMessages.JavaCorrectionProcessor_addquote_description; 243 int pos= moveBack(problem.getOffset() + problem.getLength(), problem.getOffset(), "\n\r", context.getCompilationUnit()); proposals.add(new ReplaceCorrectionProposal(quoteLabel, context.getCompilationUnit(), pos, 0, "\"", 0)); break; 246 case IProblem.UnusedImport: 247 case IProblem.DuplicateImport: 248 case IProblem.CannotImportPackage: 249 case IProblem.ConflictingImport: 250 ReorgCorrectionsSubProcessor.removeImportStatementProposals(context, problem, proposals); 251 break; 252 case IProblem.ImportNotFound: 253 ReorgCorrectionsSubProcessor.importNotFoundProposals(context, problem, proposals); 254 ReorgCorrectionsSubProcessor.removeImportStatementProposals(context, problem, proposals); 255 break; 256 case IProblem.UndefinedMethod: 257 UnresolvedElementsSubProcessor.getMethodProposals(context, problem, false, proposals); 258 break; 259 case IProblem.UndefinedConstructor: 260 UnresolvedElementsSubProcessor.getConstructorProposals(context, problem, proposals); 261 break; 262 case IProblem.UndefinedAnnotationMember: 263 UnresolvedElementsSubProcessor.getAnnotationMemberProposals(context, problem, proposals); 264 break; 265 case IProblem.ParameterMismatch: 266 UnresolvedElementsSubProcessor.getMethodProposals(context, problem, true, proposals); 267 break; 268 case IProblem.MethodButWithConstructorName: 269 ReturnTypeSubProcessor.addMethodWithConstrNameProposals(context, problem, proposals); 270 break; 271 case IProblem.UndefinedField: 272 case IProblem.UndefinedName: 273 UnresolvedElementsSubProcessor.getVariableProposals(context, problem, null, proposals); 274 break; 275 case IProblem.AmbiguousType: 276 case IProblem.JavadocAmbiguousType: 277 UnresolvedElementsSubProcessor.getAmbiguosTypeReferenceProposals(context, problem, proposals); 278 break; 279 case IProblem.PublicClassMustMatchFileName: 280 ReorgCorrectionsSubProcessor.getWrongTypeNameProposals(context, problem, proposals); 281 break; 282 case IProblem.PackageIsNotExpectedPackage: 283 ReorgCorrectionsSubProcessor.getWrongPackageDeclNameProposals(context, problem, proposals); 284 break; 285 case IProblem.UndefinedType: 286 case IProblem.JavadocUndefinedType: 287 UnresolvedElementsSubProcessor.getTypeProposals(context, problem, proposals); 288 break; 289 case IProblem.TypeMismatch: 290 TypeMismatchSubProcessor.addTypeMismatchProposals(context, problem, proposals); 291 break; 292 case IProblem.IncompatibleReturnType: 293 TypeMismatchSubProcessor.addIncompatibleReturnTypeProposals(context, problem, proposals); 294 break; 295 case IProblem.IncompatibleExceptionInThrowsClause: 296 TypeMismatchSubProcessor.addIncompatibleThrowsProposals(context, problem, proposals); 297 break; 298 case IProblem.UnhandledException: 299 LocalCorrectionsSubProcessor.addUncaughtExceptionProposals(context, problem, proposals); 300 break; 301 case IProblem.UnreachableCatch: 302 case IProblem.InvalidCatchBlockSequence: 303 LocalCorrectionsSubProcessor.addUnreachableCatchProposals(context, problem, proposals); 304 break; 305 case IProblem.VoidMethodReturnsValue: 306 ReturnTypeSubProcessor.addVoidMethodReturnsProposals(context, problem, proposals); 307 break; 308 case IProblem.MethodReturnsVoid: 309 ReturnTypeSubProcessor.addMethodRetunsVoidProposals(context, problem, proposals); 310 break; 311 case IProblem.MissingReturnType: 312 ReturnTypeSubProcessor.addMissingReturnTypeProposals(context, problem, proposals); 313 break; 314 case IProblem.ShouldReturnValue: 315 ReturnTypeSubProcessor.addMissingReturnStatementProposals(context, problem, proposals); 316 break; 317 case IProblem.NonExternalizedStringLiteral: 318 LocalCorrectionsSubProcessor.addNLSProposals(context, problem, proposals); 319 break; 320 case IProblem.UnnecessaryNLSTag: 321 LocalCorrectionsSubProcessor.getUnnecessaryNLSTagProposals(context, problem, proposals); 322 break; 323 case IProblem.NonStaticAccessToStaticField: 324 case IProblem.NonStaticAccessToStaticMethod: 325 case IProblem.IndirectAccessToStaticField: 326 case IProblem.IndirectAccessToStaticMethod: 327 LocalCorrectionsSubProcessor.addCorrectAccessToStaticProposals(context, problem, proposals); 328 break; 329 case IProblem.StaticMethodRequested: 330 case IProblem.NonStaticFieldFromStaticInvocation: 331 case IProblem.InstanceMethodDuringConstructorInvocation: 332 case IProblem.InstanceFieldDuringConstructorInvocation: 333 ModifierCorrectionSubProcessor.addNonAccessibleReferenceProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_STATIC, 5); 334 break; 335 case IProblem.NonBlankFinalLocalAssignment: 336 case IProblem.DuplicateFinalLocalInitialization: 337 case IProblem.FinalFieldAssignment: 338 case IProblem.DuplicateBlankFinalFieldInitialization: 339 case IProblem.AnonymousClassCannotExtendFinalClass: 340 case IProblem.ClassExtendFinalClass: 341 ModifierCorrectionSubProcessor.addNonAccessibleReferenceProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_NON_FINAL, 9); 342 break; 343 case IProblem.InheritedMethodReducesVisibility: 344 case IProblem.MethodReducesVisibility: 345 case IProblem.OverridingNonVisibleMethod: 346 ModifierCorrectionSubProcessor.addChangeOverriddenModfierProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_VISIBLE); 347 break; 348 case IProblem.FinalMethodCannotBeOverridden: 349 ModifierCorrectionSubProcessor.addChangeOverriddenModfierProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_NON_FINAL); 350 break; 351 case IProblem.CannotOverrideAStaticMethodWithAnInstanceMethod: 352 ModifierCorrectionSubProcessor.addChangeOverriddenModfierProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_NON_STATIC); 353 break; 354 case IProblem.CannotHideAnInstanceMethodWithAStaticMethod: 355 case IProblem.IllegalModifierForInterfaceMethod: 356 case IProblem.IllegalModifierForInterface: 357 case IProblem.IllegalModifierForClass: 358 case IProblem.IllegalModifierForInterfaceField: 359 case IProblem.UnexpectedStaticModifierForField: 360 case IProblem.IllegalModifierCombinationFinalVolatileForField: 361 case IProblem.IllegalModifierForMemberInterface: 362 case IProblem.IllegalModifierForMemberClass: 363 case IProblem.IllegalModifierForLocalClass: 364 case IProblem.IllegalModifierForArgument: 365 case IProblem.IllegalModifierForField: 366 case IProblem.IllegalModifierForMethod: 367 case IProblem.IllegalModifierForVariable: 368 case IProblem.IllegalVisibilityModifierForInterfaceMemberType: 369 case IProblem.UnexpectedStaticModifierForMethod: 370 ModifierCorrectionSubProcessor.addRemoveInvalidModfiersProposal(context, problem, proposals, 5); 371 break; 372 case IProblem.NotVisibleField: 373 ModifierCorrectionSubProcessor.addGetterSetterProposal(context,problem,proposals, 15); 374 ModifierCorrectionSubProcessor.addNonAccessibleReferenceProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_VISIBLE, 10); 375 break; 376 case IProblem.NotVisibleMethod: 377 case IProblem.NotVisibleConstructor: 378 case IProblem.NotVisibleType: 379 case IProblem.JavadocNotVisibleType: 380 ModifierCorrectionSubProcessor.addNonAccessibleReferenceProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_VISIBLE, 10); 381 break; 382 case IProblem.BodyForAbstractMethod: 383 case IProblem.AbstractMethodInAbstractClass: 384 ModifierCorrectionSubProcessor.addAbstractMethodProposals(context, problem, proposals); 385 break; 386 case IProblem.AbstractMethodMustBeImplemented: 387 LocalCorrectionsSubProcessor.addUnimplementedMethodsProposals(context, problem, proposals); 388 break; 389 case IProblem.MissingValueForAnnotationMember: 390 LocalCorrectionsSubProcessor.addValueForAnnotationProposals(context, problem, proposals); 391 break; 392 case IProblem.BodyForNativeMethod: 393 ModifierCorrectionSubProcessor.addNativeMethodProposals(context, problem, proposals); 394 break; 395 case IProblem.MethodRequiresBody: 396 ModifierCorrectionSubProcessor.addMethodRequiresBodyProposals(context, problem, proposals); 397 break; 398 case IProblem.OuterLocalMustBeFinal: 399 ModifierCorrectionSubProcessor.addNonFinalLocalProposal(context, problem, proposals); 400 break; 401 case IProblem.UninitializedLocalVariable: 402 LocalCorrectionsSubProcessor.addUninitializedLocalVariableProposal(context, problem, proposals); 403 break; 404 case IProblem.UnhandledExceptionInDefaultConstructor: 405 case IProblem.UndefinedConstructorInDefaultConstructor: 406 case IProblem.NotVisibleConstructorInDefaultConstructor: 407 LocalCorrectionsSubProcessor.addConstructorFromSuperclassProposal(context, problem, proposals); 408 break; 409 case IProblem.UnusedPrivateMethod: 410 case IProblem.UnusedPrivateConstructor: 411 case IProblem.UnusedPrivateField: 412 case IProblem.UnusedPrivateType: 413 case IProblem.LocalVariableIsNeverUsed: 414 case IProblem.ArgumentIsNeverUsed: 415 LocalCorrectionsSubProcessor.addUnusedMemberProposal(context, problem, proposals); 416 break; 417 case IProblem.NeedToEmulateFieldReadAccess: 418 case IProblem.NeedToEmulateFieldWriteAccess: 419 case IProblem.NeedToEmulateMethodAccess: 420 case IProblem.NeedToEmulateConstructorAccess: 421 ModifierCorrectionSubProcessor.addNonAccessibleReferenceProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_NON_PRIVATE, 5); 422 break; 423 case IProblem.SuperfluousSemicolon: 424 LocalCorrectionsSubProcessor.addSuperfluousSemicolonProposal(context, problem, proposals); 425 break; 426 case IProblem.UnnecessaryCast: 427 LocalCorrectionsSubProcessor.addUnnecessaryCastProposal(context, problem, proposals); 428 break; 429 case IProblem.UnnecessaryInstanceof: 430 LocalCorrectionsSubProcessor.addUnnecessaryInstanceofProposal(context, problem, proposals); 431 break; 432 case IProblem.UnusedMethodDeclaredThrownException: 433 case IProblem.UnusedConstructorDeclaredThrownException: 434 LocalCorrectionsSubProcessor.addUnnecessaryThrownExceptionProposal(context, problem, proposals); 435 break; 436 case IProblem.UnqualifiedFieldAccess: 437 ModifierCorrectionSubProcessor.addGetterSetterProposal(context, problem, proposals, 15); 438 LocalCorrectionsSubProcessor.addUnqualifiedFieldAccessProposal(context, problem, proposals); 439 break; 440 case IProblem.Task: 441 proposals.add(new TaskMarkerProposal(context.getCompilationUnit(), problem, 10)); 442 break; 443 case IProblem.JavadocMissing: 444 JavadocTagsSubProcessor.getMissingJavadocCommentProposals(context, problem, proposals); 445 break; 446 case IProblem.JavadocMissingParamTag: 447 case IProblem.JavadocMissingReturnTag: 448 case IProblem.JavadocMissingThrowsTag: 449 JavadocTagsSubProcessor.getMissingJavadocTagProposals(context, problem, proposals); 450 break; 451 case IProblem.JavadocInvalidThrowsClassName: 452 case IProblem.JavadocDuplicateThrowsClassName: 453 case IProblem.JavadocDuplicateReturnTag: 454 case IProblem.JavadocDuplicateParamName: 455 case IProblem.JavadocInvalidParamName: 456 case IProblem.JavadocUnexpectedTag: 457 case IProblem.JavadocInvalidTag: 458 JavadocTagsSubProcessor.getRemoveJavadocTagProposals(context, problem, proposals); 459 break; 460 case IProblem.LocalVariableHidingLocalVariable: 461 case IProblem.LocalVariableHidingField: 462 case IProblem.FieldHidingLocalVariable: 463 case IProblem.FieldHidingField: 464 case IProblem.ArgumentHidingLocalVariable: 465 case IProblem.ArgumentHidingField: 466 case IProblem.UseAssertAsAnIdentifier: 467 case IProblem.UseEnumAsAnIdentifier: 468 case IProblem.RedefinedLocal: 469 case IProblem.RedefinedArgument: 470 case IProblem.DuplicateField: 471 case IProblem.DuplicateMethod: 472 case IProblem.DuplicateTypeVariable: 473 case IProblem.DuplicateNestedType: 474 LocalCorrectionsSubProcessor.addInvalidVariableNameProposals(context, problem, proposals); 475 break; 476 case IProblem.NoMessageSendOnArrayType: 477 UnresolvedElementsSubProcessor.getArrayAccessProposals(context, problem, proposals); 478 break; 479 case IProblem.InvalidOperator: 480 LocalCorrectionsSubProcessor.getInvalidOperatorProposals(context, problem, proposals); 481 break; 482 case IProblem.MissingSerialVersion: 483 SerialVersionSubProcessor.getSerialVersionProposals(context, problem, proposals); 484 break; 485 case IProblem.UnnecessaryElse: 486 LocalCorrectionsSubProcessor.getUnnecessaryElseProposals(context, problem, proposals); 487 break; 488 case IProblem.SuperclassMustBeAClass: 489 LocalCorrectionsSubProcessor.getInterfaceExtendsClassProposals(context, problem, proposals); 490 break; 491 case IProblem.CodeCannotBeReached: 492 LocalCorrectionsSubProcessor.getUnreachableCodeProposals(context, problem, proposals); 493 break; 494 case IProblem.InvalidUsageOfTypeParameters: 495 case IProblem.InvalidUsageOfStaticImports: 496 case IProblem.InvalidUsageOfForeachStatements: 497 case IProblem.InvalidUsageOfTypeArguments: 498 case IProblem.InvalidUsageOfEnumDeclarations: 499 case IProblem.InvalidUsageOfVarargs: 500 case IProblem.InvalidUsageOfAnnotations: 501 case IProblem.InvalidUsageOfAnnotationDeclarations: 502 ReorgCorrectionsSubProcessor.getNeed50ComplianceProposals(context, problem, proposals); 503 break; 504 case IProblem.NonGenericType: 505 TypeParameterMismatchSubProcessor.removeMismatchedParameters(context, problem, proposals); 506 break; 507 case IProblem.MissingOverrideAnnotation: 508 ModifierCorrectionSubProcessor.addOverrideAnnotationProposal(context, problem, proposals); 509 break; 510 case IProblem.MethodMustOverride: 511 case IProblem.MethodMustOverrideOrImplement: 512 ModifierCorrectionSubProcessor.removeOverrideAnnotationProposal(context, problem, proposals); 513 break; 514 case IProblem.FieldMissingDeprecatedAnnotation: 515 case IProblem.MethodMissingDeprecatedAnnotation: 516 case IProblem.TypeMissingDeprecatedAnnotation: 517 ModifierCorrectionSubProcessor.addDeprecatedAnnotationProposal(context, problem, proposals); 518 break; 519 case IProblem.OverridingDeprecatedMethod: 520 ModifierCorrectionSubProcessor.addOverridingDeprecatedMethodProposal(context, problem, proposals); 521 break; 522 case IProblem.IsClassPathCorrect: 523 ReorgCorrectionsSubProcessor.getIncorrectBuildPathProposals(context, problem, proposals); 524 break; 525 case IProblem.ForbiddenReference: 526 case IProblem.DiscouragedReference: 527 ReorgCorrectionsSubProcessor.getAccessRulesProposals(context, problem, proposals); 528 break; 529 case IProblem.AssignmentHasNoEffect: 530 LocalCorrectionsSubProcessor.getAssignmentHasNoEffectProposals(context, problem, proposals); 531 break; 532 case IProblem.UnsafeTypeConversion: 533 case IProblem.RawTypeReference: 534 case IProblem.UnsafeRawMethodInvocation: 535 LocalCorrectionsSubProcessor.addDeprecatedFieldsToMethodsProposals(context, problem, proposals); 536 LocalCorrectionsSubProcessor.addTypePrametersToRawTypeReference(context, problem, proposals); 537 break; 538 case IProblem.FallthroughCase: 539 LocalCorrectionsSubProcessor.addFallThroughProposals(context, problem, proposals); 540 break; 541 case IProblem.UnhandledWarningToken: 542 SuppressWarningsSubProcessor.addUnknownSuppressWarningProposals(context, problem, proposals); 543 break; 544 default: 545 } 546 if (JavaModelUtil.is50OrHigher(context.getCompilationUnit().getJavaProject())) { 547 SuppressWarningsSubProcessor.addSuppressWarningsProposals(context, problem, proposals); 548 } 549 } 550 } 551 | Popular Tags |