2019-12-08 02:14:42 +01:00
|
|
|
/*
|
|
|
|
|
* sbt
|
2023-06-20 13:42:07 +02:00
|
|
|
* Copyright 2023, Scala center
|
|
|
|
|
* Copyright 2011 - 2022, Lightbend, Inc.
|
2019-12-08 02:14:42 +01:00
|
|
|
* Copyright 2008 - 2010, Mark Harrah
|
|
|
|
|
* Licensed under Apache License 2.0 (see LICENSE)
|
2010-10-23 22:34:22 +02:00
|
|
|
*/
|
2019-12-08 02:14:42 +01:00
|
|
|
|
2010-10-23 22:34:22 +02:00
|
|
|
package xsbti;
|
|
|
|
|
|
2022-04-12 10:50:28 +02:00
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
2018-08-27 19:03:47 +02:00
|
|
|
import java.util.Optional;
|
|
|
|
|
|
2023-05-14 06:38:34 +02:00
|
|
|
// Note: Update InterfaceUtil.scala as well.
|
|
|
|
|
|
2020-01-14 23:19:42 +01:00
|
|
|
public interface Problem {
|
|
|
|
|
String category();
|
|
|
|
|
|
|
|
|
|
Severity severity();
|
|
|
|
|
|
|
|
|
|
String message();
|
|
|
|
|
|
|
|
|
|
Position position();
|
2018-08-27 19:03:47 +02:00
|
|
|
|
|
|
|
|
// Default value to avoid breaking binary compatibility
|
|
|
|
|
/**
|
2020-01-14 23:19:42 +01:00
|
|
|
* If present, the string shown to the user when displaying this Problem. Otherwise, the Problem
|
|
|
|
|
* will be shown in an implementation-defined way based on the values of its other fields.
|
2018-08-27 19:03:47 +02:00
|
|
|
*/
|
2020-01-14 23:19:42 +01:00
|
|
|
default Optional<String> rendered() {
|
|
|
|
|
return Optional.empty();
|
|
|
|
|
}
|
2022-04-12 10:50:28 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The unique code attached to the diagnostic being reported.
|
|
|
|
|
*
|
|
|
|
|
* <p>NOTE: To avoid breaking compatibility we provide a default to account for older Scala
|
|
|
|
|
* versions that do not have codes.
|
|
|
|
|
*/
|
|
|
|
|
default Optional<DiagnosticCode> diagnosticCode() {
|
|
|
|
|
return Optional.empty();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-08 13:38:15 +02:00
|
|
|
/** @deprecated use {@link #diagnosticRelatedInformation()} instead. */
|
|
|
|
|
@Deprecated
|
|
|
|
|
default List<DiagnosticRelatedInformation> diagnosticRelatedInforamation() {
|
|
|
|
|
return diagnosticRelatedInformation();
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-12 10:50:28 +02:00
|
|
|
/**
|
2025-02-04 07:11:28 +01:00
|
|
|
* The possible related information for the diagnostic being reported.
|
2022-04-12 10:50:28 +02:00
|
|
|
*
|
|
|
|
|
* <p>NOTE: To avoid breaking compatibility we provide a default to account for older Scala
|
|
|
|
|
* versions that do not have the concept of "related information".
|
|
|
|
|
*/
|
2023-05-08 13:38:15 +02:00
|
|
|
default List<DiagnosticRelatedInformation> diagnosticRelatedInformation() {
|
2022-04-12 10:50:28 +02:00
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
2023-05-08 15:07:15 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Actions (aka quick fixes) that are able to either fix or address the issue that is causing this
|
|
|
|
|
* Problem.
|
|
|
|
|
*
|
|
|
|
|
* <p>For example given the following code:
|
|
|
|
|
*
|
|
|
|
|
* <pre>
|
|
|
|
|
* trait Example:
|
|
|
|
|
* def foo(): Unit
|
|
|
|
|
* def bar(): Unit
|
|
|
|
|
*
|
|
|
|
|
* class MyExample extends Example
|
|
|
|
|
* </pre>
|
|
|
|
|
*
|
|
|
|
|
* You could expect this to have multiple actions attatched:
|
|
|
|
|
*
|
|
|
|
|
* <ul>
|
|
|
|
|
* <li>An option to implement a stub method for `foo()` and `bar()`
|
|
|
|
|
* <li>An option to make `MyExample` abstract
|
|
|
|
|
* </ul>
|
|
|
|
|
*/
|
|
|
|
|
default List<Action> actions() {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
2018-08-27 19:03:47 +02:00
|
|
|
}
|