diff options
author | zaaarf <zaaarf@proton.me> | 2023-03-25 21:29:28 +0100 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-03-25 21:29:28 +0100 |
commit | d2fe55db7a5a82f7f165df1bb57b8c9a19ab0525 (patch) | |
tree | c1c7a33c1f7cc9a89faea13fa221f1a7d754c09b /src/main/java/ftbsc/lll/exceptions/OrphanElementException.java | |
parent | c688b55fc3f8d1401d4fd5460b10646a97a36af6 (diff) |
chore: implemented matching by name for finders, added OrphanExceptions to prevent ungraceful crashes in generated code
Diffstat (limited to 'src/main/java/ftbsc/lll/exceptions/OrphanElementException.java')
-rw-r--r-- | src/main/java/ftbsc/lll/exceptions/OrphanElementException.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/lll/exceptions/OrphanElementException.java b/src/main/java/ftbsc/lll/exceptions/OrphanElementException.java new file mode 100644 index 0000000..17c1180 --- /dev/null +++ b/src/main/java/ftbsc/lll/exceptions/OrphanElementException.java @@ -0,0 +1,25 @@ +package ftbsc.lll.exceptions; + +import javax.lang.model.element.Element; +import javax.lang.model.element.QualifiedNameable; + +/** + * Thrown when an annotated element that needs to be paired with + * another does not match with any. + * @since 0.5.0 + */ +public class OrphanElementException extends RuntimeException { + /** + * Constructs an exception for the specified method. + * @param element the orphan element + */ + public OrphanElementException(Element element) { + super( + String.format( + "Could not find a valid target for element %s.%s!", + ((QualifiedNameable) element.getEnclosingElement()).getQualifiedName().toString(), + element.getSimpleName().toString() + ) + ); + } +} |