mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-15 14:16:39 +00:00
Refactored the name of the cleanup method arg to 'value'.
This commit is contained in:
1 parent
2f74334b6d
commit
97974b9104
3 files changed
+4
-4
No files matched your search
@@ -78,5 +78,5 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Cleanup {
|
||||
/** The name of the method that cleans up the resource. By default, 'close'. The method must not have any parameters. */
|
||||
String cleanupMethod() default "close";
|
||||
String value() default "close";
|
||||
}
|
||||
@@ -51,7 +51,7 @@ import org.mangosdk.spi.ProviderFor;
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
|
||||
public boolean handle(AnnotationValues<Cleanup> annotation, Annotation ast, Node annotationNode) {
|
||||
String cleanupName = annotation.getInstance().cleanupMethod();
|
||||
String cleanupName = annotation.getInstance().value();
|
||||
if ( cleanupName.length() == 0 ) {
|
||||
annotationNode.addError("cleanupName cannot be the empty string.");
|
||||
return true;
|
||||
@@ -146,7 +146,7 @@ public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> {
|
||||
unsafeClose.receiver = receiver;
|
||||
long nameSourcePosition = (long)ast.sourceStart << 32 | ast.sourceEnd;
|
||||
if ( ast.memberValuePairs() != null ) for ( MemberValuePair pair : ast.memberValuePairs() ) {
|
||||
if ( pair.name != null && new String(pair.name).equals("cleanupMethod") ) {
|
||||
if ( pair.name != null && new String(pair.name).equals("value") ) {
|
||||
nameSourcePosition = (long)pair.value.sourceStart << 32 | pair.value.sourceEnd;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ import com.sun.tools.javac.util.Name;
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public class HandleCleanup implements JavacAnnotationHandler<Cleanup> {
|
||||
@Override public boolean handle(AnnotationValues<Cleanup> annotation, JCAnnotation ast, Node annotationNode) {
|
||||
String cleanupName = annotation.getInstance().cleanupMethod();
|
||||
String cleanupName = annotation.getInstance().value();
|
||||
if ( cleanupName.length() == 0 ) {
|
||||
annotationNode.addError("cleanupName cannot be the empty string.");
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user