From 45ebee789696097cae6347bb777ac81bf16ddcad Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 26 Mar 2012 20:05:41 +0200 Subject: Trivial update to build script. --- build.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build.xml b/build.xml index d6134f14..5083bedf 100644 --- a/build.xml +++ b/build.xml @@ -397,10 +397,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr - - - - + -- cgit From c49848a4b13cc883aa8b15a0ab56731222be4ea6 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 26 Mar 2012 22:42:51 +0200 Subject: Fix for issue 339: return "java/lang/Object" when an error occurs. --- src/core/lombok/bytecode/FixedClassWriter.java | 44 ++------------------------ 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/src/core/lombok/bytecode/FixedClassWriter.java b/src/core/lombok/bytecode/FixedClassWriter.java index 528bc79d..f18dc3a4 100644 --- a/src/core/lombok/bytecode/FixedClassWriter.java +++ b/src/core/lombok/bytecode/FixedClassWriter.java @@ -21,9 +21,6 @@ */ package lombok.bytecode; -import java.io.InputStream; -import java.util.Arrays; - import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; @@ -37,45 +34,10 @@ class FixedClassWriter extends ClassWriter { //environment with custom classloaders, such as Equinox. It's just an optimization; returning Object is always legal. try { return super.getCommonSuperClass(type1, type2); - } catch (Exception e) { + } catch (OutOfMemoryError e) { + throw e; + } catch (Throwable t) { return "java/lang/Object"; - } catch (ClassFormatError e) { - ClassLoader cl = this.getClass().getClassLoader(); - if (cl == null) cl = ClassLoader.getSystemClassLoader(); - String message = debugCheckClassFormatErrorIssue(cl, type1) + - debugCheckClassFormatErrorIssue(cl, type2); - throw new ClassFormatError(message); - } - } - - - // This is debug-aiding code in an attempt to find the cause of issue: - // http://code.google.com/p/projectlombok/issues/detail?id=339 - private static String debugCheckClassFormatErrorIssue(ClassLoader cl, String type) { - try { - Class.forName(type.replace('/', '.'), false, cl); - return String.format("Class.forName debug on %s: no issues\n", type); - } catch (ClassFormatError e) { - // expected - } catch (Throwable e) { - return String.format("Class.forName debug on %s: Exception: %s\n", type, e); - } - - try { - InputStream in = cl.getResourceAsStream(type + ".class"); - if (in == null) return String.format("Class.forName debug on %s: Can't find resource %s\n", type, type + ".class"); - try { - int[] firstBytes = new int[4]; - for (int i = 0; i < 4; i++) firstBytes[0] = in.read(); - if (firstBytes[0] == -1) return String.format("Class.forName debug on %s: file size is 0\n", type); - if (firstBytes[3] == -1) return String.format("Class.forName debug on %s: Less than 4 bytes in class file\n", type); - if (!Arrays.equals(new int[] {0xCA, 0xFE, 0xBA, 0xBE}, firstBytes)) return String.format("Class.forName debug on %s: no CAFEBABE: %s\n", type, Arrays.toString(firstBytes)); - return String.format("Class.forName debug on %s: No immediately obvious reason for failure found\n", type); - } finally { - in.close(); - } - } catch (Throwable e) { - return String.format("Class.forName debug on %s: Can't read as stream: %s\n", type, e); } } } \ No newline at end of file -- cgit From 704b806d67db3c4bbc4edcbc64b4fdfa8438c5fb Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Mon, 26 Mar 2012 23:03:17 +0200 Subject: Added issue 339 to the changelog --- doc/changelog.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog.markdown b/doc/changelog.markdown index d1743147..694da2ab 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -3,6 +3,7 @@ Lombok Changelog ### v0.10.9 (edge) * FEATURE: The combination of `@Delegate` and `@Getter` or `@Data` will now delegate to the result of a generated getter. [Issue #328](http://code.google.com/p/projectlombok/issues/detail?id=328) +* BUGFIX: Some classes that contain @SneakyThrows would not compile (throw ClassFormatError). [Issue 339](http://code.google.com/p/projectlombok/issues/detail?id=339) * BUGFIX: When `@Delegate` would generate a method with type parameters of the type `T extends package.Class`, a dot would be prepended to the type name. [Issue #341](http://code.google.com/p/projectlombok/issues/detail?id=341) * BUGFIX: @Getter and @Setter now generate deprecated methods for deprecated fields. Fixes [Issue #342](http://code.google.com/p/projectlombok/issues/detail?id=342) * BUGFIX: Using `val` with a type like `Outer.Inner` now works. [Issue #343](http://code.google.com/p/projectlombok/issues/detail?id=343) -- cgit From 693bf6678f5633c6c9db296dd60988211950ff4a Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 26 Mar 2012 23:57:36 +0200 Subject: trivial update to changelog. --- doc/changelog.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 694da2ab..2e8979aa 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -4,12 +4,12 @@ Lombok Changelog ### v0.10.9 (edge) * FEATURE: The combination of `@Delegate` and `@Getter` or `@Data` will now delegate to the result of a generated getter. [Issue #328](http://code.google.com/p/projectlombok/issues/detail?id=328) * BUGFIX: Some classes that contain @SneakyThrows would not compile (throw ClassFormatError). [Issue 339](http://code.google.com/p/projectlombok/issues/detail?id=339) -* BUGFIX: When `@Delegate` would generate a method with type parameters of the type `T extends package.Class`, a dot would be prepended to the type name. [Issue #341](http://code.google.com/p/projectlombok/issues/detail?id=341) +* BUGFIX: delombok: When `@Delegate` would generate a method with type parameters of the type `T extends package.Class`, a dot would be prepended to the type name. [Issue #341](http://code.google.com/p/projectlombok/issues/detail?id=341) * BUGFIX: @Getter and @Setter now generate deprecated methods for deprecated fields. Fixes [Issue #342](http://code.google.com/p/projectlombok/issues/detail?id=342) +* BUGFIX: @Delegate would not generate @Deprecated on methods marked deprecated in javadoc. Fixes [Issue #348](http://code.google.com/p/projectlombok/issues/detail?id=348) * BUGFIX: Using `val` with a type like `Outer.Inner` now works. [Issue #343](http://code.google.com/p/projectlombok/issues/detail?id=343) * BUGFIX: `@Getter(lazy=true)` where the variable type is a primitive and the initializing expression is of a different primitive type that would type coerce implicitly, i.e. ints can be assigned to longs without a cast, didn't work before. [Issue #345](http://code.google.com/p/projectlombok/issues/detail?id=345) * BUGFIX: `val` is no longer legal inside basic for loops (the old kind, not the foreach kind). These variables should rarely be final, and in practice it wasn't possible to delombok this code properly. [Issue #346](http://code.google.com/p/projectlombok/issues/detail?id=346) -* BUGFIX: @Delegate would not generate @Deprecated on methods marked deprecated in javadoc [Issue #348](http://code.google.com/p/projectlombok/issues/detail?id=348) * BUGFIX: PrettyCommentsPrinter now prints default clause of annotation methods. Fixes [Issue #350](http://code.google.com/p/projectlombok/issues/detail?id=350) ### v0.10.8 (January 19th, 2012) -- cgit From dbe96eb74a8b0304bafcc72ae9a952e722d32912 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Tue, 27 Mar 2012 00:00:14 +0200 Subject: Fixes issue 326: In NetBeans, the generated default constructor was compiled into the classfile, even when lombok generated constructors. --- src/core/lombok/javac/handlers/JavacHandlerUtil.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 32b17322..a6b33308 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -36,20 +36,16 @@ import java.util.regex.Pattern; import lombok.AccessLevel; import lombok.Data; import lombok.Getter; -import lombok.core.AnnotationValues; -import lombok.core.TypeResolver; import lombok.core.AST.Kind; +import lombok.core.AnnotationValues; import lombok.core.AnnotationValues.AnnotationValue; +import lombok.core.TypeResolver; import lombok.javac.Javac; import lombok.javac.JavacNode; import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.TypeTags; import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.TreeScanner; -import com.sun.tools.javac.tree.JCTree.JCLiteral; -import com.sun.tools.javac.tree.JCTree.JCModifiers; -import com.sun.tools.javac.tree.TreeMaker; import com.sun.tools.javac.tree.JCTree.JCAnnotation; import com.sun.tools.javac.tree.JCTree.JCAssign; import com.sun.tools.javac.tree.JCTree.JCClassDecl; @@ -57,15 +53,19 @@ import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; import com.sun.tools.javac.tree.JCTree.JCExpression; import com.sun.tools.javac.tree.JCTree.JCIdent; import com.sun.tools.javac.tree.JCTree.JCImport; +import com.sun.tools.javac.tree.JCTree.JCLiteral; import com.sun.tools.javac.tree.JCTree.JCMethodDecl; import com.sun.tools.javac.tree.JCTree.JCMethodInvocation; +import com.sun.tools.javac.tree.JCTree.JCModifiers; import com.sun.tools.javac.tree.JCTree.JCNewArray; import com.sun.tools.javac.tree.JCTree.JCStatement; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; +import com.sun.tools.javac.tree.TreeMaker; +import com.sun.tools.javac.tree.TreeScanner; +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Name; -import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; /** * Container for static utility methods useful to handlers written for javac. @@ -589,6 +589,9 @@ public class JavacHandlerUtil { JavacNode tossMe = typeNode.getNodeFor(def); if (tossMe != null) tossMe.up().removeChild(tossMe); type.defs = addAllButOne(type.defs, idx); + if (type.sym != null && type.sym.members_field != null) { + type.sym.members_field.remove(((JCMethodDecl)def).sym); + } break; } } -- cgit From a264677ffcbd929acef5f6fde4915f4c3117b052 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Tue, 27 Mar 2012 00:04:49 +0200 Subject: Updated changelog: issue 326 --- doc/changelog.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 2e8979aa..f06cd563 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -3,6 +3,7 @@ Lombok Changelog ### v0.10.9 (edge) * FEATURE: The combination of `@Delegate` and `@Getter` or `@Data` will now delegate to the result of a generated getter. [Issue #328](http://code.google.com/p/projectlombok/issues/detail?id=328) +* BUGFIX: In NetBeans the generated default constructor would still be generated even if Lombok also generated constructors. [Issue #326](http://code.google.com/p/projectlombok/issues/detail?id=326) * BUGFIX: Some classes that contain @SneakyThrows would not compile (throw ClassFormatError). [Issue 339](http://code.google.com/p/projectlombok/issues/detail?id=339) * BUGFIX: delombok: When `@Delegate` would generate a method with type parameters of the type `T extends package.Class`, a dot would be prepended to the type name. [Issue #341](http://code.google.com/p/projectlombok/issues/detail?id=341) * BUGFIX: @Getter and @Setter now generate deprecated methods for deprecated fields. Fixes [Issue #342](http://code.google.com/p/projectlombok/issues/detail?id=342) -- cgit