mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-15 06:16:14 +00:00
There was a bug in the annotation builder for javac, which would trigger exceptions anytime you used a lombok annotation in implicit-value-parameter form (e.g: @Cleanup("release") instead of @Cleanup or @Cleanup(value="release").
Fixes issue #14
This commit is contained in:
1 parent
8428be5c68
commit
383586c705
2 files changed
+16
-4
No files matched your search
@@ -146,6 +146,7 @@ public class HandlerLibrary {
|
||||
/** Generates an error in the Messager that was used to initialize this HandlerLibrary. */
|
||||
public void javacError(String message, Throwable t) {
|
||||
messager.printMessage(Diagnostic.Kind.ERROR, message + (t == null ? "" : (": " + t)));
|
||||
if ( t != null ) t.printStackTrace();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +181,9 @@ public class HandlerLibrary {
|
||||
} catch ( AnnotationValueDecodeFail fail ) {
|
||||
fail.owner.setError(fail.getMessage(), fail.idx);
|
||||
} catch ( Throwable t ) {
|
||||
javacError(String.format("Lombok annotation handler %s failed", container.handler.getClass()), t);
|
||||
String sourceName = "(unknown).java";
|
||||
if ( unit != null && unit.sourcefile != null ) sourceName = unit.sourcefile.getName();
|
||||
javacError(String.format("Lombok annotation handler %s failed on " + sourceName, container.handler.getClass()), t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,10 +94,19 @@ public class Javac {
|
||||
final List<DiagnosticPosition> positions = new ArrayList<DiagnosticPosition>();
|
||||
|
||||
for ( JCExpression arg : arguments ) {
|
||||
JCAssign assign = (JCAssign) arg;
|
||||
String mName = assign.lhs.toString();
|
||||
String mName;
|
||||
JCExpression rhs;
|
||||
|
||||
if ( arg instanceof JCAssign ) {
|
||||
JCAssign assign = (JCAssign) arg;
|
||||
mName = assign.lhs.toString();
|
||||
rhs = assign.rhs;
|
||||
} else {
|
||||
rhs = arg;
|
||||
mName = "value";
|
||||
}
|
||||
|
||||
if ( !mName.equals(name) ) continue;
|
||||
JCExpression rhs = assign.rhs;
|
||||
if ( rhs instanceof JCNewArray ) {
|
||||
List<JCExpression> elems = ((JCNewArray)rhs).elems;
|
||||
for ( JCExpression inner : elems ) {
|
||||
|
||||
Reference in new issue
Block a user