Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Aleksandr Zhelezniak <[email protected]>
Amine Touzani <[email protected]>
Andre Brait <[email protected]>
Anshuman Mishra <[email protected]>
Björn Michael <[email protected]>
Bulgakov Alexander <[email protected]>
Caleb Brinkman <[email protected]>
Christian Nüssgens <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion src/core/lombok/bytecode/AsmUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

class AsmUtil {
private AsmUtil() {
throw new UnsupportedOperationException();
throw new AssertionError();
}

static byte[] fixJSRInlining(byte[] byteCode) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/lombok/eclipse/handlers/HandleLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends java.lang.annotation.Annotation> annotation, Annotation source, EclipseNode annotationNode) {
Expand Down
12 changes: 6 additions & 6 deletions src/core/lombok/eclipse/handlers/HandleUtilityClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/core/lombok/experimental/UtilityClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* If a class is annotated with {@code @UtilityClass}, the following things happen to it:<ul>
* <li>It is marked final.</li>
* <li>If any constructors are declared in it, an error is generated. Otherwise, a private no-args constructor is generated; it throws a {@code UnsupportedOperationException}.</li>
* <li>If any constructors are declared in it, an error is generated. Otherwise, a private no-args constructor is generated; it throws a {@code AssertionError}.</li>
* <li>All methods, inner classes, and fields in the class are marked static.</li>
* <li><em>WARNING:</em> Do not use non-star static imports to import these members; javac won't be able to figure it out. Use either:
* <code>import static ThisType.*;</code> or don't static-import.</li>
Expand Down
2 changes: 1 addition & 1 deletion src/core/lombok/javac/handlers/HandleLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/lombok/javac/handlers/HandleUtilityClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void createPrivateDefaultConstructor(JavacNode typeNode) {
}

private List<JCStatement> createThrowStatement(JavacNode typeNode, JavacTreeMaker maker) {
JCExpression exceptionType = genJavaLangTypeRef(typeNode, "UnsupportedOperationException");
JCExpression exceptionType = genJavaLangTypeRef(typeNode, "AssertionError");
List<JCExpression> 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);
Expand Down
8 changes: 4 additions & 4 deletions test/transform/resource/after-delombok/UtilityClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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");
}
}
}
Expand All @@ -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");
}
}
}
Expand All @@ -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");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
8 changes: 4 additions & 4 deletions test/transform/resource/after-ecj/UtilityClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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() {
Expand All @@ -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(),
Expand All @@ -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");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/transform/resource/after-ecj/UtilityClassGeneric.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
2 changes: 1 addition & 1 deletion test/transform/resource/after-ecj/UtilityClassInner.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down