diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-03-27 00:11:20 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-03-27 00:11:20 +0200 |
commit | 19466a5413d0c451b89d0d70a8ba8f5fe0fc98aa (patch) | |
tree | c73c3cfed0c85ab853042337568e0405f5374394 /src/core | |
parent | e98d226cfb9a4b76b12e38e8ac590fb6c6ebbacc (diff) | |
parent | a264677ffcbd929acef5f6fde4915f4c3117b052 (diff) | |
download | lombok-19466a5413d0c451b89d0d70a8ba8f5fe0fc98aa.tar.gz lombok-19466a5413d0c451b89d0d70a8ba8f5fe0fc98aa.tar.bz2 lombok-19466a5413d0c451b89d0d70a8ba8f5fe0fc98aa.zip |
Merge branch 'master' into accessors
Solved trivial merge conflict based on ordering of import statements
Conflicts:
src/core/lombok/javac/handlers/JavacHandlerUtil.java
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/bytecode/FixedClassWriter.java | 44 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/JavacHandlerUtil.java | 17 |
2 files changed, 13 insertions, 48 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 diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index 8803ca3d..fc7666ec 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -36,11 +36,11 @@ import java.util.regex.Pattern; import lombok.AccessLevel; import lombok.Data; import lombok.Getter; +import lombok.core.AST.Kind; import lombok.core.AnnotationValues; +import lombok.core.AnnotationValues.AnnotationValue; import lombok.core.TransformationsUtil; import lombok.core.TypeResolver; -import lombok.core.AST.Kind; -import lombok.core.AnnotationValues.AnnotationValue; import lombok.experimental.Accessors; import lombok.javac.Javac; import lombok.javac.JavacNode; @@ -48,10 +48,6 @@ 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; @@ -59,15 +55,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. @@ -701,6 +701,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; } } |