aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-04-02 01:20:01 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-04-02 01:20:01 +0200
commit6afa3d2ec9ec18ed8ae5f6c5217b9fb1710c69c7 (patch)
treee435f98b96cdac3525a57ec923049ec5669248ba /src/core/lombok
parente0c5f3001276b94fd14e7e81e38f72070bda0c4d (diff)
downloadlombok-6afa3d2ec9ec18ed8ae5f6c5217b9fb1710c69c7.tar.gz
lombok-6afa3d2ec9ec18ed8ae5f6c5217b9fb1710c69c7.tar.bz2
lombok-6afa3d2ec9ec18ed8ae5f6c5217b9fb1710c69c7.zip
[#655] Switched to ASM5 to support -target 1.8 classes.
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/bytecode/AsmUtil.java4
-rw-r--r--src/core/lombok/bytecode/PreventNullAnalysisRemover.java12
-rw-r--r--src/core/lombok/bytecode/SneakyThrowsRemover.java14
3 files changed, 15 insertions, 15 deletions
diff --git a/src/core/lombok/bytecode/AsmUtil.java b/src/core/lombok/bytecode/AsmUtil.java
index b0606a18..6ac1dac4 100644
--- a/src/core/lombok/bytecode/AsmUtil.java
+++ b/src/core/lombok/bytecode/AsmUtil.java
@@ -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);
}
diff --git a/src/core/lombok/bytecode/PreventNullAnalysisRemover.java b/src/core/lombok/bytecode/PreventNullAnalysisRemover.java
index 751e691f..5f2f5f18 100644
--- a/src/core/lombok/bytecode/PreventNullAnalysisRemover.java
+++ b/src/core/lombok/bytecode/PreventNullAnalysisRemover.java
@@ -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));
}
diff --git a/src/core/lombok/bytecode/SneakyThrowsRemover.java b/src/core/lombok/bytecode/SneakyThrowsRemover.java
index 914c313a..8ef64e59 100644
--- a/src/core/lombok/bytecode/SneakyThrowsRemover.java
+++ b/src/core/lombok/bytecode/SneakyThrowsRemover.java
@@ -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));
}