org.eclipse.xtext.diagnostics.Severity Java Examples

The following examples show how to use org.eclipse.xtext.diagnostics.Severity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XBuildRequest.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/** @return true iff the given source has issues of severity ERROR */
public boolean containsValidationErrors(URI source) {
	Collection<? extends LSPIssue> issues = this.resultIssues.get(source);
	for (LSPIssue issue : issues) {
		Severity severity = issue.getSeverity();
		if (severity != null) {
			switch (severity) {
			case ERROR:
				return true;
			case WARNING:
				break;
			case INFO:
				break;
			case IGNORE:
				break;
			}
		}
	}
	return false;
}
 
Example #2
Source File: AbstractPackageJSONValidatorExtension.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Similar to super method but with an adjusted issue severity computation using {@link #getJSONSeverity(String)}.
 */
@Override
protected void addIssue(String message, EObject source, EStructuralFeature feature, int index, String issueCode,
		String... issueData) {
	// use custom getJSONSeverity instead of getIssueSeverities()
	Severity severity = getJSONSeverity(issueCode);
	if (severity != null) {
		switch (severity) {
		case WARNING:
			getMessageAcceptor().acceptWarning(message, source, feature, index, issueCode, issueData);
			break;
		case INFO:
			getMessageAcceptor().acceptInfo(message, source, feature, index, issueCode, issueData);
			break;
		case ERROR:
			getMessageAcceptor().acceptError(message, source, feature, index, issueCode, issueData);
			break;
		default:
			break;
		}
	}
}
 
Example #3
Source File: N4JSResource.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This is aware of warnings from the {@link N4JSStringValueConverter}.
 *
 * Issues from the parser are commonly treated as errors but here we want to create a warning.
 */
@Override
protected void addSyntaxErrors() {
	if (isValidationDisabled())
		return;
	// EList.add unnecessarily checks for uniqueness by default
	// so we use #addUnique below to save some CPU cycles for heavily broken
	// models
	BasicEList<Diagnostic> errorList = (BasicEList<Diagnostic>) getErrors();
	BasicEList<Diagnostic> warningList = (BasicEList<Diagnostic>) getWarnings();

	for (INode error : getParseResult().getSyntaxErrors()) {
		processSyntaxDiagnostic(error, diagnostic -> {
			String code = diagnostic.getCode();
			Severity severity = IssueCodes.getDefaultSeverity(code);
			if (AbstractN4JSStringValueConverter.WARN_ISSUE_CODE.equals(code)
					|| RegExLiteralConverter.ISSUE_CODE.equals(code)
					|| LegacyOctalIntValueConverter.ISSUE_CODE.equals(code)
					|| severity == Severity.WARNING) {
				warningList.addUnique(diagnostic);
			} else if (!InternalSemicolonInjectingParser.SEMICOLON_INSERTED.equals(code)) {
				errorList.addUnique(diagnostic);
			}
		});
	}
}
 
Example #4
Source File: DerivedResourceMarkerCopier.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private int getMaxSeverity(IFile srcFile) {
	URI resourceURI = URI.createPlatformResourceURI(srcFile.getFullPath().toString(), true);
	IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(resourceURI);
	if (serviceProvider == null)
		return Integer.MAX_VALUE;
	IssueSeveritiesProvider severitiesProvider = serviceProvider.get(IssueSeveritiesProvider.class);
	Severity severity = severitiesProvider.getIssueSeverities(new ResourceImpl(resourceURI)).getSeverity(
			COPY_JAVA_PROBLEMS_ISSUECODE);
	switch (severity) {
		case WARNING:
			return IMarker.SEVERITY_WARNING;
		case ERROR:
			return IMarker.SEVERITY_ERROR;
		case INFO:
		case IGNORE:
			return Integer.MAX_VALUE;
		default:
			break;
	}
	return Integer.MAX_VALUE;
}
 
Example #5
Source File: AbstractPendingLinkingCandidate.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected boolean validateArity(IAcceptor<? super AbstractDiagnostic> result) {
	if (getArityMismatch() != 0) {
		String message; 
		if (getArguments().isEmpty()) {
			message = String.format("Invalid number of arguments. The %1$s %2$s%3$s is not applicable without arguments" , 
					getFeatureTypeName(), 
					getSimpleFeatureName(), 
					getFeatureParameterTypesAsString());
		} else {
			message = String.format("Invalid number of arguments. The %1$s %2$s%3$s is not applicable for the arguments %4$s" , 
					getFeatureTypeName(), 
					getSimpleFeatureName(), 
					getFeatureParameterTypesAsString(), 
					getArgumentTypesAsString());
		}
		AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(
				Severity.ERROR, 
				IssueCodes.INVALID_NUMBER_OF_ARGUMENTS, 
				message, 
				getExpression(), 
				getInvalidArgumentsValidationFeature(), -1, null);
		result.accept(diagnostic);
		return false;
	}
	return true;
}
 
Example #6
Source File: ValidationTestHelper.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @since 2.8
 */
protected Iterable<Issue> doMatchIssues(final Resource resource, final EClass objectType, final String code,
		final int offset, final int length, final Severity severity, final List<Issue> validate,
		final String... messageParts) {
	return Iterables.filter(validate, new Predicate<Issue>() {
		@Override
		public boolean apply(Issue input) {
			if (Strings.equal(input.getCode(), code) && input.getSeverity()==severity) {
				if ((offset < 0 || offset == input.getOffset()) && (length < 0 || length == input.getLength())) {
					EObject object = resource.getResourceSet().getEObject(input.getUriToProblem(), true);
					if (objectType.isInstance(object)) {
						for (String messagePart : messageParts) {
							if (!input.getMessage().toLowerCase().contains(messagePart.toLowerCase())) {
								return false;
							}
						}
						return true;
					}
				}
			}
			return false;
		}
	});
}
 
Example #7
Source File: XtextLinker.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void linkModel(EObject model, IDiagnosticConsumer consumer) {
	if (model instanceof Grammar) {
		final Xtext2EcoreTransformer transformer = createTransformer((Grammar) model, consumer);
		//TODO duplicate
		transformer.removeGeneratedPackages();
		super.linkModel(model, consumer);
		updateOverriddenRules((Grammar) model);
		try {
			transformer.transform();
		} catch (Exception e) {
			log.error(e.getMessage(), e);
			consumer.consume(new ExceptionDiagnostic(e), Severity.ERROR);
		}
		if (!model.eResource().eAdapters().contains(packageRemover))
			model.eResource().eAdapters().add(packageRemover);
	} else {
		super.linkModel(model, consumer);
	}
}
 
Example #8
Source File: ConvertJavaCode.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
private boolean validateResource(Resource resource) {
	if (resource.getErrors().size() == 0) {
		List<Issue> issues = Lists.newArrayList(filter(((XtextResource) resource).getResourceServiceProvider()
				.getResourceValidator().validate(resource, CheckMode.ALL, CancelIndicator.NullImpl),
				new Predicate<Issue>() {
					@Override
					public boolean apply(Issue issue) {
						String code = issue.getCode();
						return issue.getSeverity() == Severity.ERROR
								&& !(IssueCodes.DUPLICATE_TYPE.equals(code) || org.eclipse.xtend.core.validation.IssueCodes.XBASE_LIB_NOT_ON_CLASSPATH
										.equals(code));
					}
				}));
		return issues.size() == 0;
	}
	return false;
}
 
Example #9
Source File: TestValidator.java    From sarl with Apache License 2.0 6 votes vote down vote up
private void assertIssue(Severity severity, EClass objectType, String code, int offset, String... messageParts) {
	final List<Issue> issues = getIssues();
	final Iterable<Issue> fissues = this.testHelper.matchIssues(this.resource, objectType, code, offset,
			-1, severity, issues, messageParts);
	if (isEmpty(fissues)) {
		final StringBuilder message = new StringBuilder("Expected ")
			.append(severity)
			.append(" '")
			.append(code)
			.append("' on ")
			.append(objectType.getName())
			.append(" but got\n");
		message.append(this.testHelper.getIssuesAsString(this.resource, issues, message));
		assertEquals(Joiner.on('\n').join(messageParts), message.toString());
		fail(message.toString());
	} else {
		final Issue[] issueTab = Iterables.toArray(fissues, Issue.class);
		for (final Issue removableIssue : issueTab) {
			this.issues.remove(removableIssue);
		}
	}
}
 
Example #10
Source File: BuildRequest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public boolean afterValidate(URI validated, Iterable<Issue> issues) {
	for (Issue issue : issues) {
		Severity severity = issue.getSeverity();
		if (severity != null) {
			switch (severity) {
			case ERROR:
				LOG.error(issue.toString());
				return false;
			case WARNING:
				LOG.warn(issue.toString());
				break;
			case INFO:
				LOG.info(issue.toString());
				break;
			case IGNORE:
				LOG.debug(issue.toString());
				break;
			}
		}
	}
	return true;
}
 
Example #11
Source File: LogicalContainerAwareReentrantTypeResolver.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
/* @Nullable */
protected JvmTypeReference doGetTypeReference(XComputedTypeReferenceImplCustom context) {
	try {
		resolvedTypes.addDiagnostic(new EObjectDiagnosticImpl(
				Severity.ERROR, 
				IssueCodes.TOO_LITTLE_TYPE_INFORMATION, 
				"Cannot infer type",
				typeResolver.getSourceElement(member), 
				null, 
				-1, 
				null));
		return TypesFactory.eINSTANCE.createJvmAnyTypeReference();
	} finally {
		context.unsetTypeProviderWithoutNotification();
	}
}
 
Example #12
Source File: QuickFixXpectMethod.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Example: {@code // XPECT quickFixList  at 'a.<|>method' --> 'import A','do other things' }
 *
 * @param expectation
 *            comma separated strings, which are proposed as quick fix
 * @param resource
 *            injected xtext-file
 * @param offset
 *            cursor position at '<|>'
 * @param checkType
 *            'display': verify list of provided proposals comparing their user-displayed strings.
 * @param selected
 *            which proposal to pick
 * @param mode
 *            modus of operation
 * @param offset2issue
 *            mapping of offset(!) to issues.
 * @throws Exception
 *             if failing
 */
@Xpect
@ParameterParser(syntax = "('at' (arg2=STRING (arg3=ID  (arg4=STRING)?  (arg5=ID)? )? )? )?")
@ConsumedIssues({ Severity.INFO, Severity.ERROR, Severity.WARNING })
public void quickFixList(
		@CommaSeparatedValuesExpectation(quoted = true, ordered = true) ICommaSeparatedValuesExpectation expectation, // arg0
		@ThisResource XtextResource resource, // arg1
		RegionWithCursor offset, // arg2
		String checkType, // arg3
		String selected, // arg4
		String mode, // arg5
		@IssuesByLine Multimap<Integer, Issue> offset2issue) throws Exception {

	List<IssueResolution> resolutions = collectAllResolutions(resource, offset, offset2issue);

	List<String> resolutionNames = Lists.newArrayList();
	for (IssueResolution resolution : resolutions) {
		resolutionNames.add(resolution.getLabel());
	}

	expectation.assertEquals(resolutionNames);
}
 
Example #13
Source File: AbstractDeclarativeValidator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @since 2.4
 */
protected void addIssue(String message, EObject source, EStructuralFeature feature, int index, String issueCode,
		String... issueData) {
	Severity severity = getIssueSeverities(getContext(), getCurrentObject()).getSeverity(issueCode);
	if (severity != null) {
		switch (severity) {
			case WARNING:
				getMessageAcceptor().acceptWarning(message, source, feature, index, issueCode, issueData);
				break;
			case INFO:
				getMessageAcceptor().acceptInfo(message, source, feature, index, issueCode, issueData);
				break;
			case ERROR:
				getMessageAcceptor().acceptError(message, source, feature, index, issueCode, issueData);
				break;
			default:
				break;
		}
	}
}
 
Example #14
Source File: ResourceSetGlobalCompilationContext.java    From sarl with Apache License 2.0 6 votes vote down vote up
private synchronized SarlScript file(String code, boolean validate, boolean updateResourceSet) throws Exception {
	SarlScript script;
	if (this.resourceSet == null) {
		script = this.parser.parse(code);
		if (updateResourceSet) {
			this.resourceSet = script.eResource().getResourceSet();
		}
	} else {
		script = this.parser.parse(code, this.resourceSet);
	}
	if (this.resourceSet instanceof XtextResourceSet) {
		((XtextResourceSet) this.resourceSet).setClasspathURIContext(getClass());
	}
	Resource resource = script.eResource();
	assertEquals(0, resource.getErrors().size(), () -> resource.getErrors().toString());
	if (validate) {
		Collection<Issue> issues = Collections2.filter(this.validator.validate(resource), new Predicate<Issue>() {
			@Override
			public boolean apply(Issue input) {
				return input.getSeverity() == Severity.ERROR;
			}
		});
		assertTrue(issues.isEmpty(), () -> "Resource contained errors : " + issues.toString()); //$NON-NLS-1$
	}
	return script;
}
 
Example #15
Source File: ValidationService.java    From xtext-web with Eclipse Public License 2.0 6 votes vote down vote up
protected String translate(Severity severity) {
	if (severity != null) {
		switch (severity) {
		case WARNING:
			return "warning";
		case ERROR:
			return "error";
		case INFO:
			return "info";
		default:
			return "ignore";
		}
	} else {
		return "ignore";
	}
}
 
Example #16
Source File: XbaseTypeComputer.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected void checkValidReturnExpression(XExpression returnValue, ITypeComputationState expressionState) {
	ITypeComputationResult result = expressionState.computeTypes(returnValue);
	LightweightTypeReference actualType = result.getActualExpressionType();
	int conformanceFlags = result.getConformanceFlags();
	if (actualType.isPrimitiveVoid() && (conformanceFlags & ConformanceFlags.NO_IMPLICIT_RETURN) != 0) {
		String message = "Invalid return's expression.";
		if (returnValue instanceof XReturnExpression) {
			// when the return's expression is directory a return
			// we provide a more detailed error
			message = "Return cannot be nested.";
		}
		expressionState.addDiagnostic(new EObjectDiagnosticImpl(
				Severity.ERROR,
				IssueCodes.INVALID_RETURN,
				message,
				returnValue,
				null,
				-1,
				new String[] { 
				}));
	}
}
 
Example #17
Source File: XbaseTypeComputer.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected void _computeTypes(XSynchronizedExpression expr, ITypeComputationState state) {
	ITypeComputationState paramState = state.withExpectation(state.getReferenceOwner().newReferenceToObject());
	ITypeComputationResult paramType = paramState.computeTypes(expr.getParam());
	LightweightTypeReference actualParamType = paramType.getActualExpressionType();
	if (actualParamType != null && (actualParamType.isPrimitive() || actualParamType.isAny())) {
		state.addDiagnostic(new EObjectDiagnosticImpl(
				Severity.ERROR,
				IssueCodes.INCOMPATIBLE_TYPES,
				actualParamType.getHumanReadableName() +  " is not a valid type's argument for the synchronized expression.",
				expr.getParam(),
				null,
				-1,
				new String[] { 
				}));
	}
	state.computeTypes(expr.getExpression());
}
 
Example #18
Source File: DefaultCheckImpl.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets a numeric value mapped to a given {@link Severity}. Severities are mapped to
 * <ul>
 * <li>{@link Diagnostic#ERROR}
 * <li>{@link Diagnostic#WARNING}
 * <li>{@link Diagnostic#INFO}
 * </ul>
 *
 * @param severity
 *          the issue severity
 * @return the numeric value representing a severity
 */
protected int toDiagnosticSeverity(final Severity severity) {
  int diagnosticSeverity = -1;
  switch (severity) {
  case ERROR:
    diagnosticSeverity = Diagnostic.ERROR;
    break;
  case WARNING:
    diagnosticSeverity = Diagnostic.WARNING;
    break;
  case INFO:
    diagnosticSeverity = Diagnostic.INFO;
    break;
  default:
    throw new IllegalArgumentException("Unknow severity " + severity); //$NON-NLS-1$
  }
  return diagnosticSeverity;
}
 
Example #19
Source File: ReducedXtextResourceValidator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void issueFromXtextResourceDiagnostic(Diagnostic diagnostic, Severity severity,
		IAcceptor<Issue> acceptor) {
	if (diagnostic instanceof XtextSyntaxDiagnostic) {
		super.issueFromXtextResourceDiagnostic(diagnostic, severity, acceptor);
	} else if (diagnostic instanceof XtextLinkingDiagnostic) {
		XtextLinkingDiagnostic linkingDiagnostic = (XtextLinkingDiagnostic) diagnostic;
		if (linkingDiagnostic.getCode().equals(XtextLinkingDiagnosticMessageProvider.UNRESOLVED_RULE)) {
			super.issueFromXtextResourceDiagnostic(diagnostic, severity, acceptor);
		} else if (linkingDiagnostic.getMessage().contains("reference to Grammar")) {
			super.issueFromXtextResourceDiagnostic(diagnostic, severity, acceptor);
		}
	}
}
 
Example #20
Source File: N4JSIssueSeverities.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @return the Severity for the given severity code. If no configured severity could be found in the configurable
 *         issue codes, the default severity configured in messages.properties (contained in this package) will be
 *         returned.
 */
@Override
public Severity getSeverity(String code) {
	if (!configurableIssueCodes.containsKey(code)) {
		Severity severity = IssueCodes.getDefaultSeverity(code);
		if (severity != null) {
			return severity;
		}
	}
	return super.getSeverity(code);
}
 
Example #21
Source File: XProjectManager.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/** Report an issue. */
public void reportProjectIssue(String message, String code, Severity severity) {
	LSPIssue result = new LSPIssue();
	result.setMessage(message);
	result.setCode(code);
	result.setSeverity(severity);
	result.setUriToProblem(getBaseDir());
	issueRegistry.addIssueOfPersistedState(projectConfig.getName(), getBaseDir(), result);
}
 
Example #22
Source File: ResourceValidatorImplTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test public void testSemanticWarning() throws Exception {
	XtextResource resource = getResourceAndExpect(new StringInputStream("type Bar"), 0);
	List<Issue> list = getValidator().validate(resource, CheckMode.NORMAL_AND_FAST, null);
	assertEquals(1,list.size());
	assertFalse(list.get(0).isSyntaxError());
	assertEquals(Severity.WARNING, list.get(0).getSeverity());
}
 
Example #23
Source File: DiagnosticIssueConverter.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Convert the {@link Severity} to a lsp {@link DiagnosticSeverity}.
 *
 * Defaults to severity {@link DiagnosticSeverity#Hint}.
 */
protected DiagnosticSeverity toSeverity(Severity severity) {
	switch (severity) {
	case ERROR:
		return DiagnosticSeverity.Error;
	case IGNORE:
		return DiagnosticSeverity.Hint;
	case INFO:
		return DiagnosticSeverity.Information;
	case WARNING:
		return DiagnosticSeverity.Warning;
	default:
		return DiagnosticSeverity.Hint;
	}
}
 
Example #24
Source File: AbstractPendingLinkingCandidate.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected boolean validateTypeArgumentConformance(IAcceptor<? super AbstractDiagnostic> result) {
	if (getTypeArgumentConformanceFailures(result) == 0) {
		// TODO use early exit computation
		List<XExpression> arguments = getSyntacticArguments();
		for(int i = 0; i < arguments.size(); i++) {
			XExpression argument = arguments.get(i);
			if (isDefiniteEarlyExit(argument)) {
				XExpression errorOn = getExpression();
				String message = "Unreachable code.";
				EStructuralFeature errorFeature = null;
				if (i < arguments.size() - 1) {
					errorOn = arguments.get(i + 1);
				} else {
					errorFeature = getDefaultValidationFeature();
					if (errorOn instanceof XBinaryOperation) {
						message = "Unreachable code. The right argument expression does not complete normally.";
					} else {
						message = "Unreachable code. The last argument expression does not complete normally.";
					}
				}
				AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(
						Severity.ERROR, 
						IssueCodes.UNREACHABLE_CODE, 
						message, 
						errorOn, 
						errorFeature, 
						-1, null);
				result.accept(diagnostic);
				return false;
			}
		}
	} else {
		return false;
	}
	return true;
}
 
Example #25
Source File: SarlBatchCompiler.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Reports the given error message.
 *
 * @param message the warning message.
 * @param parameters the values of the parameters that must be dynamically replaced within the message text.
 * @since 0.8
 */
protected void reportInternalError(String message, Object... parameters) {
	getLogger().severe(MessageFormat.format(message, parameters));
	if (getReportInternalProblemsAsIssues()) {
		final org.eclipse.emf.common.util.URI uri  = null;
		final Issue.IssueImpl issue = new Issue.IssueImpl();
		issue.setCode(INTERNAL_ERROR_CODE);
		issue.setMessage(message);
		issue.setUriToProblem(uri);
		issue.setSeverity(Severity.ERROR);
		notifiesIssueMessageListeners(issue, uri, message);
	}
}
 
Example #26
Source File: ValidationTestHelper.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.8
 */
public void assertNoErrors(final Resource resource) {
	final List<Issue> validate = validate(resource);
	Iterable<Issue> issues = filter(validate, new Predicate<Issue>() {
		@Override
		public boolean apply(Issue input) {
			return Severity.ERROR == input.getSeverity();
		}
	});
	if (!isEmpty(issues))
		fail("Expected no errors, but got :" + getIssuesAsString(resource, issues, new StringBuilder()));
}
 
Example #27
Source File: DiagnosticOnFirstKeyword.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public DiagnosticOnFirstKeyword(
		Severity severity,
		String problemCode,
		String message,
		EObject problematicObject,
		String[] data) {
	super(severity, problemCode, message, problematicObject, null, -1, data);
}
 
Example #28
Source File: XbaseTypeComputer.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
private void checkTypeParameterNotAllowedAsLiteral(EObject ctx, JvmType type, ITypeComputationState state) {
	if (type instanceof JvmTypeParameter) {
		state.addDiagnostic(new EObjectDiagnosticImpl(
				Severity.ERROR,
				IssueCodes.INVALID_USE_OF_TYPE_PARAMETER,
				"Illegal class literal for the type parameter " + type.getSimpleName()+".",
				ctx,
				null,
				-1,
				new String[] { 
				}));
	}
}
 
Example #29
Source File: SarlBatchCompiler.java    From sarl with Apache License 2.0 5 votes vote down vote up
private static int compareSafe(Severity s1, Severity s2) {
	if (s1 == null) {
		return s2 == null ? 0 : -1;
	}
	if (s2 == null) {
		return 1;
	}
	return s1.compareTo(s2);
}
 
Example #30
Source File: IConfigurableIssueSeveritiesProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void setAllSeverities() throws Exception {
	this.provider.setAllSeverities(Severity.INFO);
	//
	SarlScript script = file(getParseHelper(), getValidationHelper(), SNIPSET);
	//
	IssueSeverities severities = this.provider.getIssueSeverities(script.eResource());
	assertNotNull(severities);
	Severity severity = severities.getSeverity(IssueCodes.UNREACHABLE_BEHAVIOR_UNIT);
	assertNotNull(severity);
	assertSame(Severity.INFO, severity);
}