diff --git a/AUTHORS b/AUTHORS index d83703dead..fc2b09257f 100755 --- a/AUTHORS +++ b/AUTHORS @@ -5,6 +5,7 @@ Aleksandr Zhelezniak Amine Touzani Andre Brait Anshuman Mishra +Björn Michael Bulgakov Alexander Caleb Brinkman Christian Nüssgens diff --git a/src/core/lombok/bytecode/AsmUtil.java b/src/core/lombok/bytecode/AsmUtil.java index fc2533e5d8..f3dcdec4f8 100644 --- a/src/core/lombok/bytecode/AsmUtil.java +++ b/src/core/lombok/bytecode/AsmUtil.java @@ -30,7 +30,7 @@ class AsmUtil { private AsmUtil() { - throw new UnsupportedOperationException(); + throw new AssertionError(); } static byte[] fixJSRInlining(byte[] byteCode) { diff --git a/src/core/lombok/eclipse/handlers/HandleLog.java b/src/core/lombok/eclipse/handlers/HandleLog.java index 2bbc300a8b..5368b705d4 100644 --- a/src/core/lombok/eclipse/handlers/HandleLog.java +++ b/src/core/lombok/eclipse/handlers/HandleLog.java @@ -54,7 +54,7 @@ public class HandleLog { private static final IdentifierName LOG = IdentifierName.valueOf("log"); private HandleLog() { - throw new UnsupportedOperationException(); + throw new AssertionError(); } public static void processAnnotation(LoggingFramework framework, AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { diff --git a/src/core/lombok/eclipse/handlers/HandleUtilityClass.java b/src/core/lombok/eclipse/handlers/HandleUtilityClass.java index 9a18b20bdd..2cc31ed629 100644 --- a/src/core/lombok/eclipse/handlers/HandleUtilityClass.java +++ b/src/core/lombok/eclipse/handlers/HandleUtilityClass.java @@ -141,11 +141,11 @@ private void changeModifiersAndGenerateConstructor(EclipseNode typeNode, Eclipse if (requiresClInit && !alreadyHasClinit) classDecl.addClinit(); } - private static final char[][] JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION = new char[][] { - TypeConstants.JAVA, TypeConstants.LANG, "UnsupportedOperationException".toCharArray() + private static final char[][] JAVA_LANG_ASSERTION_ERROR = new char[][] { + TypeConstants.JAVA, TypeConstants.LANG, "AssertionError".toCharArray() }; - private static final char[] UNSUPPORTED_MESSAGE = "This is a utility class and cannot be instantiated".toCharArray(); + private static final char[] ERROR_MESSAGE = "This is a utility class and cannot be instantiated".toCharArray(); private void createPrivateDefaultConstructor(EclipseNode typeNode, EclipseNode sourceNode) { ASTNode source = sourceNode.get(); @@ -162,11 +162,11 @@ private void createPrivateDefaultConstructor(EclipseNode typeNode, EclipseNode s constructor.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; constructor.arguments = null; - long[] ps = new long[JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION.length]; + long[] ps = new long[JAVA_LANG_ASSERTION_ERROR.length]; AllocationExpression exception = new AllocationExpression(); - exception.type = new QualifiedTypeReference(JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION, ps); + exception.type = new QualifiedTypeReference(JAVA_LANG_ASSERTION_ERROR, ps); exception.arguments = new Expression[] { - new StringLiteral(UNSUPPORTED_MESSAGE, 0, 0, 0) + new StringLiteral(ERROR_MESSAGE, 0, 0, 0) }; ThrowStatement throwStatement = new ThrowStatement(exception, 0, 0); diff --git a/src/core/lombok/experimental/UtilityClass.java b/src/core/lombok/experimental/UtilityClass.java index f828166056..aaa1d30748 100644 --- a/src/core/lombok/experimental/UtilityClass.java +++ b/src/core/lombok/experimental/UtilityClass.java @@ -31,7 +31,7 @@ * * If a class is annotated with {@code @UtilityClass}, the following things happen to it:
    *
  • It is marked final.
  • - *
  • If any constructors are declared in it, an error is generated. Otherwise, a private no-args constructor is generated; it throws a {@code UnsupportedOperationException}.
  • + *
  • If any constructors are declared in it, an error is generated. Otherwise, a private no-args constructor is generated; it throws a {@code AssertionError}.
  • *
  • All methods, inner classes, and fields in the class are marked static.
  • *
  • WARNING: Do not use non-star static imports to import these members; javac won't be able to figure it out. Use either: * import static ThisType.*; or don't static-import.
  • diff --git a/src/core/lombok/javac/handlers/HandleLog.java b/src/core/lombok/javac/handlers/HandleLog.java index 7484ae661b..7f05558dce 100644 --- a/src/core/lombok/javac/handlers/HandleLog.java +++ b/src/core/lombok/javac/handlers/HandleLog.java @@ -52,7 +52,7 @@ public class HandleLog { private static final IdentifierName LOG = IdentifierName.valueOf("log"); private HandleLog() { - throw new UnsupportedOperationException(); + throw new AssertionError(); } public static void processAnnotation(LoggingFramework framework, AnnotationValues annotation, JavacNode annotationNode) { diff --git a/src/core/lombok/javac/handlers/HandleUtilityClass.java b/src/core/lombok/javac/handlers/HandleUtilityClass.java index bc171b8f89..f7d6148dcd 100644 --- a/src/core/lombok/javac/handlers/HandleUtilityClass.java +++ b/src/core/lombok/javac/handlers/HandleUtilityClass.java @@ -154,7 +154,7 @@ private void createPrivateDefaultConstructor(JavacNode typeNode) { } private List createThrowStatement(JavacNode typeNode, JavacTreeMaker maker) { - JCExpression exceptionType = genJavaLangTypeRef(typeNode, "UnsupportedOperationException"); + JCExpression exceptionType = genJavaLangTypeRef(typeNode, "AssertionError"); List jceBlank = List.nil(); JCExpression message = maker.Literal("This is a utility class and cannot be instantiated"); JCExpression exceptionInstance = maker.NewClass(null, jceBlank, exceptionType, List.of(message), null); diff --git a/test/transform/resource/after-delombok/UtilityClass.java b/test/transform/resource/after-delombok/UtilityClass.java index 983fbc29c3..0177f71d83 100644 --- a/test/transform/resource/after-delombok/UtilityClass.java +++ b/test/transform/resource/after-delombok/UtilityClass.java @@ -14,7 +14,7 @@ protected static class InnerStaticClass { @java.lang.SuppressWarnings("all") @lombok.Generated private UtilityClass() { - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } class UtilityInner { @@ -24,7 +24,7 @@ static final class InnerInnerInner { @java.lang.SuppressWarnings("all") @lombok.Generated private InnerInnerInner() { - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } } @@ -35,7 +35,7 @@ static final class InsideEnum { @java.lang.SuppressWarnings("all") @lombok.Generated private InsideEnum() { - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } } @@ -45,7 +45,7 @@ final class InsideInterface { @java.lang.SuppressWarnings("all") @lombok.Generated private InsideInterface() { - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } } diff --git a/test/transform/resource/after-delombok/UtilityClassGeneric.java b/test/transform/resource/after-delombok/UtilityClassGeneric.java index 82bd1630a8..2e95a62b57 100644 --- a/test/transform/resource/after-delombok/UtilityClassGeneric.java +++ b/test/transform/resource/after-delombok/UtilityClassGeneric.java @@ -13,6 +13,6 @@ static class DTO { @java.lang.SuppressWarnings("all") @lombok.Generated private UtilityClassGeneric() { - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } diff --git a/test/transform/resource/after-delombok/UtilityClassInner.java b/test/transform/resource/after-delombok/UtilityClassInner.java index cd91bc2d7c..5eb36fcd05 100644 --- a/test/transform/resource/after-delombok/UtilityClassInner.java +++ b/test/transform/resource/after-delombok/UtilityClassInner.java @@ -4,7 +4,7 @@ static final class UtilClass implements java.io.Serializable { @java.lang.SuppressWarnings("all") @lombok.Generated private UtilClass() { - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } } diff --git a/test/transform/resource/after-ecj/UtilityClass.java b/test/transform/resource/after-ecj/UtilityClass.java index db83c53c97..0413edfe8b 100644 --- a/test/transform/resource/after-ecj/UtilityClass.java +++ b/test/transform/resource/after-ecj/UtilityClass.java @@ -21,7 +21,7 @@ static void someMethod() { } private @java.lang.SuppressWarnings("all") @lombok.Generated UtilityClass() { super(); - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } class UtilityInner { @@ -32,7 +32,7 @@ static class InnerInner { } private @java.lang.SuppressWarnings("all") @lombok.Generated InnerInnerInner() { super(); - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } InnerInner() { @@ -46,7 +46,7 @@ enum UtilityInsideEnum { } private @java.lang.SuppressWarnings("all") @lombok.Generated InsideEnum() { super(); - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } FOO(), @@ -64,7 +64,7 @@ interface UtilityInsideInterface { } private @java.lang.SuppressWarnings("all") @lombok.Generated InsideInterface() { super(); - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } } diff --git a/test/transform/resource/after-ecj/UtilityClassGeneric.java b/test/transform/resource/after-ecj/UtilityClassGeneric.java index d339a5faa7..f264a61ffd 100644 --- a/test/transform/resource/after-ecj/UtilityClassGeneric.java +++ b/test/transform/resource/after-ecj/UtilityClassGeneric.java @@ -16,6 +16,6 @@ static Object convert(DTO dto) { } private @java.lang.SuppressWarnings("all") @lombok.Generated UtilityClassGeneric() { super(); - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } diff --git a/test/transform/resource/after-ecj/UtilityClassInner.java b/test/transform/resource/after-ecj/UtilityClassInner.java index 31bd396c41..ee8620319d 100644 --- a/test/transform/resource/after-ecj/UtilityClassInner.java +++ b/test/transform/resource/after-ecj/UtilityClassInner.java @@ -2,7 +2,7 @@ static final @lombok.experimental.UtilityClass class UtilClass implements java.io.Serializable { private @java.lang.SuppressWarnings("all") @lombok.Generated UtilClass() { super(); - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } } UtilityClassInner() { diff --git a/website/usageExamples/experimental/UtilityClassExample_post.jpage b/website/usageExamples/experimental/UtilityClassExample_post.jpage index ad6cf58322..4cc5b552ad 100644 --- a/website/usageExamples/experimental/UtilityClassExample_post.jpage +++ b/website/usageExamples/experimental/UtilityClassExample_post.jpage @@ -2,7 +2,7 @@ public final class UtilityClassExample { private static final int CONSTANT = 5; private UtilityClassExample() { - throw new java.lang.UnsupportedOperationException("This is a utility class and cannot be instantiated"); + throw new java.lang.AssertionError("This is a utility class and cannot be instantiated"); } public static int addSomething(int in) {