aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-07-08 20:56:50 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-07-08 21:20:24 +0200
commitbf8e2afed07b4062ac3d3fee8b2f8981d1213f7e (patch)
tree1c52864bc38f4e7e78aeea5b5c5c86723db25dc8
parent867929c79f344e2fa63aa280cf452d39eb7aabf7 (diff)
downloadlombok-bf8e2afed07b4062ac3d3fee8b2f8981d1213f7e.tar.gz
lombok-bf8e2afed07b4062ac3d3fee8b2f8981d1213f7e.tar.bz2
lombok-bf8e2afed07b4062ac3d3fee8b2f8981d1213f7e.zip
gave up on adding support for moving javadoc to getter/setter in eclipse. Eclipse breaks the javadoc out of the raw source and we can't modify that without breaking a billion things. To solve this issue we'd have to write some very complicated patches to intercept this process and somehow propagate the node that the javadoc is attached to AND translate from the ast model to dom or whatever is being used there. Not gonna happen for this low priority feature.
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java4
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java2
-rw-r--r--test/transform/resource/after-ecj/GetterSetterJavadoc.java60
-rw-r--r--test/transform/resource/after-ecj/JavadocGenerally.java11
4 files changed, 74 insertions, 3 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 87493e39..6aed5508 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -1165,7 +1165,7 @@ public class JavacHandlerUtil {
return (JCExpression) in;
}
- private static final Pattern SECTION_FINDER = Pattern.compile("^\\s*\\**\\s*[-*][-*]+\\s*(GETTER|SETTER)\\s*[-*][-*]+\\s*\\**\\s*$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
+ private static final Pattern SECTION_FINDER = Pattern.compile("^\\s*\\**\\s*[-*][-*]+\\s*([GS]ETTER)\\s*[-*][-*]+\\s*\\**\\s*$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
private static String stripLinesWithTagFromJavadoc(String javadoc, String regexpFragment) {
Pattern p = Pattern.compile("^\\s*\\**\\s*" + regexpFragment + "\\s*\\**\\s*$", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
@@ -1201,7 +1201,7 @@ public class JavacHandlerUtil {
public static enum CopyJavadoc {
VERBATIM, GETTER {
@Override public String[] split(String javadoc) {
- // step 1: Check if there is a 'GETTER' section. If yes, that becomes the new one and we strip that from the original.
+ // step 1: Check if there is a 'GETTER' section. If yes, that becomes the new method's javadoc and we strip that from the original.
String[] out = splitJavadocOnSectionIfPresent(javadoc, "GETTER");
if (out != null) return out;
// failing that, create a copy, but strip @return from the original and @param from the copy.
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index 12f2e252..f7294f1f 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -54,6 +54,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
options.complianceLevel = Eclipse.getLatestEcjCompilerVersionConstant();
options.sourceLevel = Eclipse.getLatestEcjCompilerVersionConstant();
options.targetJDK = Eclipse.getLatestEcjCompilerVersionConstant();
+ options.docCommentSupport = false;
options.parseLiteralExpressionsAsConstants = true;
options.inlineJsrBytecode = true;
options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false;
@@ -64,7 +65,6 @@ public class RunTestsViaEcj extends AbstractRunTests {
options.reportUnusedParameterWhenOverridingConcrete = false;
options.reportDeadCodeInTrivialIfStatement = false;
options.generateClassFiles = false;
- options.docCommentSupport = false;
Map<String, String> warnings = new HashMap<String, String>();
warnings.put(CompilerOptions.OPTION_ReportUnusedLocal, "ignore");
warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore");
diff --git a/test/transform/resource/after-ecj/GetterSetterJavadoc.java b/test/transform/resource/after-ecj/GetterSetterJavadoc.java
new file mode 100644
index 00000000..73f26180
--- /dev/null
+++ b/test/transform/resource/after-ecj/GetterSetterJavadoc.java
@@ -0,0 +1,60 @@
+@lombok.Data class GetterSetterJavadoc1 {
+ private int fieldName;
+ public @java.lang.SuppressWarnings("all") int getFieldName() {
+ return this.fieldName;
+ }
+ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
+ this.fieldName = fieldName;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof GetterSetterJavadoc1)))
+ return false;
+ final @java.lang.SuppressWarnings("all") GetterSetterJavadoc1 other = (GetterSetterJavadoc1) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getFieldName() != other.getFieldName()))
+ return false;
+ return true;
+ }
+ public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof GetterSetterJavadoc1);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = ((result * PRIME) + this.getFieldName());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("GetterSetterJavadoc1(fieldName=" + this.getFieldName()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") GetterSetterJavadoc1() {
+ super();
+ }
+}
+class GetterSetterJavadoc2 {
+ private @lombok.Getter @lombok.Setter int fieldName;
+ GetterSetterJavadoc2() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") int getFieldName() {
+ return this.fieldName;
+ }
+ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
+ this.fieldName = fieldName;
+ }
+}
+class GetterSetterJavadoc3 {
+ private @lombok.Getter @lombok.Setter int fieldName;
+ GetterSetterJavadoc3() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") int getFieldName() {
+ return this.fieldName;
+ }
+ public @java.lang.SuppressWarnings("all") void setFieldName(final int fieldName) {
+ this.fieldName = fieldName;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/JavadocGenerally.java b/test/transform/resource/after-ecj/JavadocGenerally.java
new file mode 100644
index 00000000..be9ed756
--- /dev/null
+++ b/test/transform/resource/after-ecj/JavadocGenerally.java
@@ -0,0 +1,11 @@
+package testPackage;
+class JavadocGenerally {
+ public interface TestingInner {
+ }
+ private int someField;
+ JavadocGenerally() {
+ super();
+ }
+ public void test() {
+ }
+} \ No newline at end of file