1 /******************************************************************************* 2 * Copyright (c) 2000, 2013 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.jdt.internal.compiler; 15 16 public class DefaultErrorHandlingPolicies { 17 18 /* 19 * Accumulate all problems, then exit without proceeding. 20 * 21 * Typically, the #proceedWithProblems(Problem[]) should 22 * show the problems. 23 * 24 */ exitAfterAllProblems()25public static IErrorHandlingPolicy exitAfterAllProblems() { 26 return new IErrorHandlingPolicy() { 27 @Override 28 public boolean stopOnFirstError() { 29 return false; 30 } 31 @Override 32 public boolean proceedOnErrors(){ 33 return false; 34 } 35 @Override 36 public boolean ignoreAllErrors() { 37 return false; 38 } 39 }; 40 } 41 /* 42 * Exit without proceeding on the first problem wich appears 43 * to be an error. 44 * 45 */ 46 public static IErrorHandlingPolicy exitOnFirstError() { 47 return new IErrorHandlingPolicy() { 48 @Override 49 public boolean stopOnFirstError() { 50 return true; 51 } 52 @Override 53 public boolean proceedOnErrors(){ 54 return false; 55 } 56 @Override 57 public boolean ignoreAllErrors() { 58 return false; 59 } 60 }; 61 } 62 /* 63 * Proceed on the first error met. 64 * 65 */ 66 public static IErrorHandlingPolicy proceedOnFirstError() { 67 return new IErrorHandlingPolicy() { 68 @Override 69 public boolean stopOnFirstError() { 70 return true; 71 } 72 @Override 73 public boolean proceedOnErrors(){ 74 return true; 75 } 76 @Override 77 public boolean ignoreAllErrors() { 78 return false; 79 } 80 }; 81 } 82 /* 83 * Accumulate all problems, then proceed with them. 84 * 85 */ 86 public static IErrorHandlingPolicy proceedWithAllProblems() { 87 return new IErrorHandlingPolicy() { 88 @Override 89 public boolean stopOnFirstError() { 90 return false; 91 } 92 @Override 93 public boolean proceedOnErrors(){ 94 return true; 95 } 96 @Override 97 public boolean ignoreAllErrors() { 98 return false; 99 } 100 }; 101 } 102 /* 103 * Accumulate all problems, then proceed with them, but never report them. 104 * 105 */ 106 public static IErrorHandlingPolicy ignoreAllProblems() { 107 return new IErrorHandlingPolicy() { 108 @Override 109 public boolean stopOnFirstError() { 110 return false; 111 } 112 @Override 113 public boolean proceedOnErrors(){ 114 return true; 115 } 116 @Override 117 public boolean ignoreAllErrors() { 118 return true; 119 } 120 }; 121 } 122 } 123