Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @Generator annotation #3372

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
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 @@ -54,5 +54,6 @@ Till Brychcy <[email protected]>
Victor Williams Stafusa da Silva <[email protected]>
Yonatan Sherwin <[email protected]>
Yun Zhi Lin <[email protected]>
Yoon Tae Min <[email protected]>

By adding your name to this list, you grant full and irrevocable copyright and patent indemnity to Project Lombok and all use of Project Lombok in relation to all commits you add to Project Lombok, and you certify that you have the right to do so.
8 changes: 8 additions & 0 deletions src/core/lombok/ConfigurationKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,14 @@ private ConfigurationKeys() {}
*/
public static final ConfigurationKey<FlagUsageType> FIELD_NAME_CONSTANTS_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.fieldNameConstants.flagUsage", "Emit a warning or error if @FieldNameConstants is used.") {};

// ----- Generator -----
/**
* lombok configuration: {@code lombok.generator.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @Generator} results in a warning / error.
*/
public static final ConfigurationKey<FlagUsageType> GENERATOR_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.generator.flagUsage", "Emit a warning or error if @Generator is used.") {};

/**
* lombok configuration: {@code lombok.fieldNameConstants.innerTypeName} = &lt;String: AValidJavaTypeName&gt; (Default: {@code Fields}).
*
Expand Down
37 changes: 37 additions & 0 deletions src/core/lombok/Lombok.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
package lombok;

import java.util.Iterator;

/**
* Useful utility methods to manipulate lombok-generated code.
*/
Expand Down Expand Up @@ -82,4 +84,39 @@ public static <T> T checkNotNull(T value, String message) {
if (value == null) throw new NullPointerException(message);
return value;
}

/**
* Stub class for {@code GeneratorPostTransformation}
*/
public static abstract class Generator<T> implements Iterable<T>, Iterator<T> {

protected abstract void advance();

protected final void yieldThis(T target) {
throw new UnsupportedOperationException("Unimplemented method 'yieldThis'");
}

protected final void yieldAll(Iterable<T> target) {
throw new UnsupportedOperationException("Unimplemented method 'yieldAll'");
}
protected final void yieldAll(T[] target) {
throw new UnsupportedOperationException("Unimplemented method 'yieldAll'");
}

@Override public boolean hasNext() {
throw new UnsupportedOperationException("Unimplemented method 'hasNext'");
}

@Override public T next() {
throw new UnsupportedOperationException("Unimplemented method 'next'");
}

@Override public Iterator<T> iterator() {
throw new UnsupportedOperationException("Unimplemented method 'iterator'");
}

@Override public void remove() {
throw new UnsupportedOperationException("Unimplemented method 'remove'");
}
}
}
Loading