mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 04:16:19 +00:00
[#655] Switched to ASM5 to support -target 1.8 classes.
This commit is contained in:
1 parent
e0c5f30012
commit
6afa3d2ec9
6 files changed
+19
-18
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="org.projectlombok" module="lombok.patcher" revision="0.12" publication="20140301023600">
|
||||
<info organisation="org.projectlombok" module="lombok.patcher" revision="0.13" publication="20140402011000">
|
||||
<license name="MIT License" url="http://www.opensource.org/licenses/mit-license.php" />
|
||||
<ivyauthor name="rzwitserloot" url="http://zwitserloot.com/" />
|
||||
<ivyauthor name="rspilker" url="http://github.com/rspilker" />
|
||||
@@ -9,6 +9,6 @@
|
||||
<conf name="default" />
|
||||
</configurations>
|
||||
<publications>
|
||||
<artifact conf="default" url="http://projectlombok.org/downloads/lombok.patcher-0.12.jar" />
|
||||
<artifact conf="default" url="http://projectlombok.org/downloads/lombok.patcher-0.13.jar" />
|
||||
</publications>
|
||||
</ivy-module>
|
||||
@@ -14,7 +14,7 @@
|
||||
<conf name="javac7" />
|
||||
</configurations>
|
||||
<dependencies>
|
||||
<dependency org="org.projectlombok" name="lombok.patcher" rev="0.12" conf="buildBase->default; runtime->default" />
|
||||
<dependency org="org.projectlombok" name="lombok.patcher" rev="0.13" conf="buildBase->default; runtime->default" />
|
||||
<dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="buildBase->runtime; runtime" />
|
||||
|
||||
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default; contrib->sources" />
|
||||
|
||||
@@ -5,6 +5,7 @@ Lombok Changelog
|
||||
* CHANGE: suppressConstructorProperties should now be configured via lombok configuration. [Issue #659](https://code.google.com/p/projectlombok/issues/detail?id=659)
|
||||
* CHANGE: The `canEqual` method generated by `@EqualsAndHashCode`, `@Value` and `@Data` is now `protected` instead of `public`. [Issue #660](https://code.google.com/p/projectlombok/issues/detail?id=660)
|
||||
* BUGFIX: Deadlocks would occasionally occur in eclipse when using lazy getters [Issue #590](https://code.google.com/p/projectlombok/issues/detail?id=590)
|
||||
* BUGFIX: Usage of `@SneakyThrows` with a javac from JDK8 with `-target 1.8` would result in a post compiler error. [Issue #655](https://code.google.com/p/projectlombok/issues/detail?id=655)
|
||||
|
||||
### v1.12.6 (March 6th, 2014)
|
||||
* BUGFIX: Deadlocks would occasionally occur in eclipse during project builds, especially if using the gradle plugin. [Issue #645](https://code.google.com/p/projectlombok/issues/detail?id=645)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2012 The Project Lombok Authors.
|
||||
* Copyright (C) 2010-2014 The Project Lombok Authors.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -38,7 +38,7 @@ class AsmUtil {
|
||||
ClassReader reader = new ClassReader(byteCode);
|
||||
ClassWriter writer = new FixedClassWriter(reader, 0);
|
||||
|
||||
ClassVisitor visitor = new ClassVisitor(Opcodes.ASM4, writer) {
|
||||
ClassVisitor visitor = new ClassVisitor(Opcodes.ASM5, writer) {
|
||||
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
return new JSRInlinerAdapter(super.visitMethod(access, name, desc, signature, exceptions), access, name, desc, signature, exceptions);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2012 The Project Lombok Authors.
|
||||
* Copyright (C) 2010-2014 The Project Lombok Authors.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -50,10 +50,10 @@ public class PreventNullAnalysisRemover implements PostCompilerTransformation {
|
||||
|
||||
class PreventNullAnalysisVisitor extends MethodVisitor {
|
||||
PreventNullAnalysisVisitor(MethodVisitor mv) {
|
||||
super(Opcodes.ASM4, mv);
|
||||
super(Opcodes.ASM5, mv);
|
||||
}
|
||||
|
||||
@Override public void visitMethodInsn(int opcode, String owner, String name, String desc) {
|
||||
@Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
boolean hit = true;
|
||||
if (hit && opcode != Opcodes.INVOKESTATIC) hit = false;
|
||||
if (hit && !"preventNullAnalysis".equals(name)) hit = false;
|
||||
@@ -61,14 +61,14 @@ public class PreventNullAnalysisRemover implements PostCompilerTransformation {
|
||||
if (hit && !"(Ljava/lang/Object;)Ljava/lang/Object;".equals(desc)) hit = false;
|
||||
if (hit) {
|
||||
changesMade.set(true);
|
||||
if (System.getProperty("lombok.debugAsmOnly", null) != null) super.visitMethodInsn(opcode, owner, name, desc); // DEBUG for issue 470!
|
||||
if (System.getProperty("lombok.debugAsmOnly", null) != null) super.visitMethodInsn(opcode, owner, name, desc, itf); // DEBUG for issue 470!
|
||||
} else {
|
||||
super.visitMethodInsn(opcode, owner, name, desc);
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reader.accept(new ClassVisitor(Opcodes.ASM4, writer) {
|
||||
reader.accept(new ClassVisitor(Opcodes.ASM5, writer) {
|
||||
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
return new PreventNullAnalysisVisitor(super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2013 The Project Lombok Authors.
|
||||
* Copyright (C) 2010-2014 The Project Lombok Authors.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -52,12 +52,12 @@ public class SneakyThrowsRemover implements PostCompilerTransformation {
|
||||
|
||||
class SneakyThrowsRemoverVisitor extends MethodVisitor {
|
||||
SneakyThrowsRemoverVisitor(MethodVisitor mv) {
|
||||
super(Opcodes.ASM4, mv);
|
||||
super(Opcodes.ASM5, mv);
|
||||
}
|
||||
|
||||
private boolean methodInsnQueued = false;
|
||||
|
||||
@Override public void visitMethodInsn(int opcode, String owner, String name, String desc) {
|
||||
@Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
if (
|
||||
opcode == Opcodes.INVOKESTATIC &&
|
||||
"sneakyThrow".equals(name) &&
|
||||
@@ -65,18 +65,18 @@ public class SneakyThrowsRemover implements PostCompilerTransformation {
|
||||
"(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;".equals(desc)) {
|
||||
|
||||
if (System.getProperty("lombok.debugAsmOnly", null) != null) {
|
||||
super.visitMethodInsn(opcode, owner, name, desc); // DEBUG for issue 470!
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf); // DEBUG for issue 470!
|
||||
} else {
|
||||
methodInsnQueued = true;
|
||||
}
|
||||
} else {
|
||||
super.visitMethodInsn(opcode, owner, name, desc);
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleQueue() {
|
||||
if (!methodInsnQueued) return;
|
||||
super.visitMethodInsn(Opcodes.INVOKESTATIC, "lombok/Lombok", "sneakyThrow", "(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;");
|
||||
super.visitMethodInsn(Opcodes.INVOKESTATIC, "lombok/Lombok", "sneakyThrow", "(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;", false);
|
||||
methodInsnQueued = false;
|
||||
diagnostics.addWarning("Proper usage is: throw lombok.Lombok.sneakyThrow(someException);. You did not 'throw' it. Because of this, the call to sneakyThrow " +
|
||||
"remains in your classfile and you will need lombok.jar on the classpath at runtime.");
|
||||
@@ -177,7 +177,7 @@ public class SneakyThrowsRemover implements PostCompilerTransformation {
|
||||
}
|
||||
}
|
||||
|
||||
reader.accept(new ClassVisitor(Opcodes.ASM4, writer) {
|
||||
reader.accept(new ClassVisitor(Opcodes.ASM5, writer) {
|
||||
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
return new SneakyThrowsRemoverVisitor(super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user