[Git][java-team/lombok-patcher][upstream] New upstream version 0.28
Markus Koschany
gitlab at salsa.debian.org
Tue Oct 2 21:49:50 BST 2018
Markus Koschany pushed to branch upstream at Debian Java Maintainers / lombok-patcher
Commits:
cb57947a by Markus Koschany at 2018-10-02T20:39:55Z
New upstream version 0.28
- - - - -
16 changed files:
- build.xml
- − buildScripts/ivy-repo/projectlombok.org-junit-4.8.1.xml
- buildScripts/ivy.xml
- src/patcher/lombok/patcher/Hook.java
- src/patcher/lombok/patcher/MethodLogistics.java
- src/patcher/lombok/patcher/MethodTarget.java
- src/patcher/lombok/patcher/PatchScript.java
- src/patcher/lombok/patcher/StackRequest.java
- src/patcher/lombok/patcher/Version.java
- src/patcher/lombok/patcher/scripts/AddFieldScript.java
- src/patcher/lombok/patcher/scripts/ExitFromMethodEarlyScript.java
- src/patcher/lombok/patcher/scripts/ReplaceMethodCallScript.java
- src/patcher/lombok/patcher/scripts/SetSymbolDuringMethodCallScript.java
- src/patcher/lombok/patcher/scripts/WrapMethodCallScript.java
- src/patcher/lombok/patcher/scripts/WrapReturnValuesScript.java
- src/patcher/lombok/patcher/scripts/WrapperMethodDescriptor.java
Changes:
=====================================
build.xml
=====================================
@@ -1,5 +1,5 @@
<!--
- Copyright (C) 2009-2014 The Project Lombok Authors.
+ Copyright (C) 2009-2018 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
@@ -30,7 +30,7 @@
<target name="load-ipp" depends="download-ipp">
<taskdef classpath="lib/ivyplusplus.jar" resource="com/zwitserloot/ivyplusplus/antlib.xml" uri="antlib:com.zwitserloot.ivyplusplus" />
- <ivy:ensureippversion version="1.13" property="ivyplusplus.minimumAvailable" />
+ <ivy:ensureippversion version="1.22" property="ivyplusplus.minimumAvailable" />
</target>
<target name="redownload-ipp" unless="ivyplusplus.minimumAvailable">
@@ -89,7 +89,7 @@
<target name="version" depends="ensure-ipp" description="Shows the version number.">
<mkdir dir="build/pack" />
- <javac srcdir="src/patcher" debug="on" destdir="build/pack" target="1.5" source="1.5" includes="lombok/patcher/Version.java" />
+ <ivy:compile srcdir="src/patcher" destdir="build/pack" target="1.5" source="1.5" ecj="true" includes="lombok/patcher/Version.java" />
<java
classname="lombok.patcher.Version"
classpath="build/pack"
@@ -106,10 +106,11 @@
<unjar dest="build/packInjector">
<path refid="runtimeInjector.path" />
</unjar>
+ <delete file="build/pack/module-info.class" quiet="true" />
</target>
<target name="compile" depends="unpackLibs, ensureBuildDeps" description="Compiles lombok.patcher" unless="pointless">
- <ivy:compile destdir="build/pack" target="1.5" source="1.5">
+ <ivy:compile destdir="build/pack" target="1.5" source="1.5" ecj="true">
<src path="src/patcher" />
<src path="src/injector" />
<classpath refid="build.path" />
@@ -117,7 +118,8 @@
</target>
<target name="compileTests" depends="compile, ensureTestDeps" description="Compiles the unit tests" unless="skipTests">
- <ivy:compile srcdir="test" destdir="build/tests" target="1.5" source="1.5">
+ <ivy:compile destdir="build/tests" target="1.5" source="1.5" ecj="true">
+ <src path="test" />
<classpath path="build/pack" />
<classpath refid="test.path" />
</ivy:compile>
@@ -145,7 +147,6 @@
</fileset>
</batchtest>
</junit>
- <echo level="info">All tests successful.</echo>
</target>
<target name="test" depends="-test" description="Runs the unit tests" />
=====================================
buildScripts/ivy-repo/projectlombok.org-junit-4.8.1.xml deleted
=====================================
@@ -1,13 +0,0 @@
-<ivy-module version="2.0">
- <info organisation="projectlombok.org" module="junit" revision="4.8.1" publication="20100225011200">
- <license name="MIT License" url="http://www.opensource.org/licenses/mit-license.php" />
- <ivyauthor name="KentBeck" url="http://www.threeriversinstitute.org/Kent%20Beck.htm" />
- <description homepage="http://junit.org/" />
- </info>
- <configurations>
- <conf name="test" />
- </configurations>
- <publications>
- <artifact conf="test" url="https://cloud.github.com/downloads/KentBeck/junit/junit-4.8.1.jar" />
- </publications>
-</ivy-module>
=====================================
buildScripts/ivy.xml
=====================================
@@ -8,13 +8,12 @@
<conf name="contrib" />
</configurations>
<dependencies>
- <dependency org="org.projectlombok" name="lombok" rev="1.12.6" conf="build->default" />
- <dependency org="projectlombok.org" name="junit" rev="4.8.1" conf="test" />
+ <dependency org="junit" name="junit" rev="4.12" conf="test -> default"/>
<dependency org="com.jcraft" name="jsch" rev="0.1.42" conf="build->default" />
<dependency org="projectlombok.org" name="jsch-ant-fixed" rev="0.1.45" conf="build" />
- <dependency org="org.ow2.asm" name="asm" rev="5.0.1" conf="runtime, build -> default; contrib->sources" />
- <dependency org="org.ow2.asm" name="asm-tree" rev="5.0.1" conf="runtime, build->default; contrib->sources" />
- <dependency org="org.ow2.asm" name="asm-commons" rev="5.0.1" conf="runtime, build->default; contrib->sources" />
+ <dependency org="org.ow2.asm" name="asm" rev="6.2.1" conf="runtime, build -> default; contrib->sources" />
+ <dependency org="org.ow2.asm" name="asm-tree" rev="6.2.1" conf="runtime, build->default; contrib->sources" />
+ <dependency org="org.ow2.asm" name="asm-commons" rev="6.2.1" conf="runtime, build->default; contrib->sources" />
<dependency org="net.java.dev.jna" name="jna" rev="3.2.2" conf="runtimeInjector, build->master" />
</dependencies>
</ivy-module>
=====================================
src/patcher/lombok/patcher/Hook.java
=====================================
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2010 The Project Lombok Authors.
+ * Copyright (C) 2009-2017 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
@@ -27,11 +27,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NonNull;
-import lombok.ToString;
-
/**
* Represents a method you write yourself; calls to it will be inserted into
* code-to-be-patched by a {@code PatchScript}.
@@ -42,25 +37,12 @@ import lombok.ToString;
*
* @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#1169">JVM Spec on method names and descriptors</a>
*/
- at ToString
- at EqualsAndHashCode
public class Hook {
- @Getter @NonNull
private final String className;
-
- @Getter @NonNull
private final String methodName;
-
- @Getter @NonNull
private final String returnType;
-
- @Getter @NonNull
private final List<String> parameterTypes;
- public boolean isConstructor() {
- return "<init>".equals(methodName);
- }
-
public Hook(String className, String methodName, String returnType, String... parameterTypes) {
if (className == null) throw new NullPointerException("classSpec");
if (methodName == null) throw new NullPointerException("methodName");
@@ -75,6 +57,26 @@ public class Hook {
this.parameterTypes = Collections.unmodifiableList(params);
}
+ public boolean isConstructor() {
+ return "<init>".equals(methodName);
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public String getReturnType() {
+ return returnType;
+ }
+
+ public List<String> getParameterTypes() {
+ return parameterTypes;
+ }
+
public String getClassSpec() {
return convertType(className);
}
@@ -130,4 +132,38 @@ public class Hook {
}
return out.toString();
}
+
+ @Override public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((className == null) ? 0 : className.hashCode());
+ result = prime * result + ((methodName == null) ? 0 : methodName.hashCode());
+ result = prime * result + ((parameterTypes == null) ? 0 : parameterTypes.hashCode());
+ result = prime * result + ((returnType == null) ? 0 : returnType.hashCode());
+ return result;
+ }
+
+ @Override public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ Hook other = (Hook) obj;
+ if (className == null) {
+ if (other.className != null) return false;
+ } else if (!className.equals(other.className)) return false;
+ if (methodName == null) {
+ if (other.methodName != null) return false;
+ } else if (!methodName.equals(other.methodName)) return false;
+ if (parameterTypes == null) {
+ if (other.parameterTypes != null) return false;
+ } else if (!parameterTypes.equals(other.parameterTypes)) return false;
+ if (returnType == null) {
+ if (other.returnType != null) return false;
+ } else if (!returnType.equals(other.returnType)) return false;
+ return true;
+ }
+
+ @Override public String toString() {
+ return "Hook [className=" + className + ", methodName=" + methodName + ", returnType=" + returnType + ", parameterTypes=" + parameterTypes + "]";
+ }
}
=====================================
src/patcher/lombok/patcher/MethodLogistics.java
=====================================
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Project Lombok Authors.
+ * Copyright (C) 2009-2017 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
@@ -26,8 +26,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import lombok.Getter;
-
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
@@ -40,8 +38,6 @@ import org.objectweb.asm.Opcodes;
*/
public class MethodLogistics {
private final int staticOffset;
-
- @Getter
private final int returnOpcode;
private final int returnSize;
@@ -94,6 +90,10 @@ public class MethodLogistics {
return this.paramSizes.size();
}
+ public int getReturnOpcode() {
+ return returnOpcode;
+ }
+
/**
* Writes the opcode to load the i-th parameter to the supplied {@code MethodVisitor}.
*
=====================================
src/patcher/lombok/patcher/MethodTarget.java
=====================================
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Project Lombok Authors.
+ * Copyright (C) 2009-2017 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
@@ -30,10 +30,6 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-
/**
* Represents a target method that you want to transform.
*
@@ -41,24 +37,33 @@ import lombok.ToString;
* overloaded the method name. You can choose to focus on just one of a set of overloaded methods by also specifying return
* type and parameter types.
*/
- at ToString
- at EqualsAndHashCode
public final class MethodTarget implements TargetMatcher {
- @Getter
private final String classSpec;
-
- @Getter
private final String methodName;
-
- @Getter
private final String returnSpec;
-
- @Getter
private final List<String> parameterSpec;
-
- @Getter
private boolean hasDescription;
+ public String getClassSpec() {
+ return classSpec;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public String getReturnSpec() {
+ return returnSpec;
+ }
+
+ public List<String> getParameterSpec() {
+ return parameterSpec;
+ }
+
+ public boolean isHasDescription() {
+ return hasDescription;
+ }
+
/**
* Target any method with the provided name that appears in the provided class, regardless of return type and parameter types.
*
@@ -216,4 +221,40 @@ public final class MethodTarget implements TargetMatcher {
public static boolean typeMatches(String type, String pattern) {
return type.replace("/", ".").equals(pattern);
}
+
+ @Override public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((classSpec == null) ? 0 : classSpec.hashCode());
+ result = prime * result + (hasDescription ? 1231 : 1237);
+ result = prime * result + ((methodName == null) ? 0 : methodName.hashCode());
+ result = prime * result + ((parameterSpec == null) ? 0 : parameterSpec.hashCode());
+ result = prime * result + ((returnSpec == null) ? 0 : returnSpec.hashCode());
+ return result;
+ }
+
+ @Override public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ MethodTarget other = (MethodTarget) obj;
+ if (classSpec == null) {
+ if (other.classSpec != null) return false;
+ } else if (!classSpec.equals(other.classSpec)) return false;
+ if (hasDescription != other.hasDescription) return false;
+ if (methodName == null) {
+ if (other.methodName != null) return false;
+ } else if (!methodName.equals(other.methodName)) return false;
+ if (parameterSpec == null) {
+ if (other.parameterSpec != null) return false;
+ } else if (!parameterSpec.equals(other.parameterSpec)) return false;
+ if (returnSpec == null) {
+ if (other.returnSpec != null) return false;
+ } else if (!returnSpec.equals(other.returnSpec)) return false;
+ return true;
+ }
+
+ @Override public String toString() {
+ return "MethodTarget[classSpec=" + classSpec + ", methodName=" + methodName + ", returnSpec=" + returnSpec + ", parameterSpec=" + parameterSpec + ", hasDescription=" + hasDescription + "]";
+ }
}
=====================================
src/patcher/lombok/patcher/PatchScript.java
=====================================
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2012 The Project Lombok Authors.
+ * Copyright (C) 2009-2017 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
@@ -22,15 +22,13 @@
package lombok.patcher;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import lombok.Cleanup;
-import lombok.Getter;
-
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Attribute;
import org.objectweb.asm.ClassReader;
@@ -141,8 +139,9 @@ public abstract class PatchScript {
}
private static byte[] readStream(String resourceName) {
+ InputStream wrapStream = null;
try {
- @Cleanup InputStream wrapStream = PatchScript.class.getResourceAsStream(resourceName);
+ wrapStream = PatchScript.class.getResourceAsStream(resourceName);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] b = new byte[65536];
while (true) {
@@ -154,12 +153,16 @@ public abstract class PatchScript {
return baos.toByteArray();
} catch (Exception e) {
throw new IllegalArgumentException("resource " + resourceName + " does not exist.", e);
+ } finally {
+ if (wrapStream != null) try {
+ wrapStream.close();
+ } catch (IOException ignore) {}
}
}
private static abstract class NoopClassVisitor extends ClassVisitor {
public NoopClassVisitor() {
- super(Opcodes.ASM4);
+ super(Opcodes.ASM6);
}
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {}
@@ -205,7 +208,7 @@ public abstract class PatchScript {
private static final class InsertBodyOfMethodIntoAnotherVisitor extends MethodVisitor {
private InsertBodyOfMethodIntoAnotherVisitor(MethodVisitor mv) {
- super(Opcodes.ASM4, mv);
+ super(Opcodes.ASM6, mv);
}
@Override public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) { return null; }
@@ -235,18 +238,22 @@ public abstract class PatchScript {
*/
protected static class MethodPatcher extends ClassVisitor {
private List<TargetMatcher> targets = new ArrayList<TargetMatcher>();
- private @Getter String ownClassSpec;
+ private String ownClassSpec;
private final MethodPatcherFactory factory;
private List<Hook> transplants = new ArrayList<Hook>();
private final TransplantMapper transplantMapper;
private int classFileFormatVersion;
public MethodPatcher(ClassVisitor cv, TransplantMapper transplantMapper, MethodPatcherFactory factory) {
- super(Opcodes.ASM4, cv);
+ super(Opcodes.ASM6, cv);
this.factory = factory;
this.transplantMapper = transplantMapper;
}
+ public String getOwnClassSpec() {
+ return ownClassSpec;
+ }
+
/**
* The {@code factory} will be called for any methods that match any added target.
*/
=====================================
src/patcher/lombok/patcher/StackRequest.java
=====================================
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Project Lombok Authors.
+ * Copyright (C) 2009-2017 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
@@ -25,8 +25,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import lombok.Getter;
-
/**
* Various patch scripts support various method parmater signatures in your hook methods; use StackRequest values to specify
* which parameters you want. It doesn't matter how you specify your StackRequest values; you <em>MUST</em> order your parameters
@@ -35,13 +33,16 @@ import lombok.Getter;
public enum StackRequest {
RETURN_VALUE(-1), THIS(-1), PARAM1(0), PARAM2(1), PARAM3(2), PARAM4(3), PARAM5(4), PARAM6(5);
- @Getter
private final int paramPos;
StackRequest(int paramPos) {
this.paramPos = paramPos;
}
+ public int getParamPos() {
+ return paramPos;
+ }
+
public static final List<StackRequest> PARAMS_IN_ORDER = Collections.unmodifiableList(Arrays.asList(
- PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6));
+ PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6));
}
=====================================
src/patcher/lombok/patcher/Version.java
=====================================
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2016 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 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
@@ -26,7 +26,7 @@ package lombok.patcher;
*/
public class Version {
// ** CAREFUL ** - this class must always compile with 0 dependencies (it must not refer to any other sources or libraries).
- private static final String VERSION = "0.22";
+ private static final String VERSION = "0.28";
private Version() {
//Prevent instantiation
=====================================
src/patcher/lombok/patcher/scripts/AddFieldScript.java
=====================================
@@ -65,7 +65,7 @@ public class AddFieldScript extends PatchScript {
}
@Override protected ClassVisitor createClassVisitor(ClassWriter writer, String classSpec, TransplantMapper transplantMapper) {
- return new ClassVisitor(Opcodes.ASM4, writer) {
+ return new ClassVisitor(Opcodes.ASM6, writer) {
private boolean alreadyAdded = false;
@Override public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
=====================================
src/patcher/lombok/patcher/scripts/ExitFromMethodEarlyScript.java
=====================================
@@ -82,7 +82,7 @@ public class ExitFromMethodEarlyScript extends MethodLevelPatchScript {
private final String ownClassSpec;
public ExitEarly(MethodVisitor mv, MethodLogistics logistics, String ownClassSpec) {
- super(Opcodes.ASM4, mv);
+ super(Opcodes.ASM6, mv);
this.logistics = logistics;
this.ownClassSpec = ownClassSpec;
}
=====================================
src/patcher/lombok/patcher/scripts/ReplaceMethodCallScript.java
=====================================
@@ -74,7 +74,7 @@ public class ReplaceMethodCallScript extends MethodLevelPatchScript {
private final MethodLogistics logistics;
public ReplaceMethodCall(MethodVisitor mv, String ownClassSpec, MethodLogistics logistics) {
- super(Opcodes.ASM4, mv);
+ super(Opcodes.ASM6, mv);
this.ownClassSpec = ownClassSpec;
this.logistics = logistics;
}
=====================================
src/patcher/lombok/patcher/scripts/SetSymbolDuringMethodCallScript.java
=====================================
@@ -107,7 +107,7 @@ public class SetSymbolDuringMethodCallScript extends MethodLevelPatchScript {
private final List<WrapperMethodDescriptor> descriptors;
public WrapWithSymbol(String selfMethodName, MethodVisitor mv, String selfTypeName, List<WrapperMethodDescriptor> descriptors) {
- super(Opcodes.ASM4, mv);
+ super(Opcodes.ASM6, mv);
this.selfMethodName = selfMethodName;
this.selfTypeName = selfTypeName;
this.descriptors = descriptors;
=====================================
src/patcher/lombok/patcher/scripts/WrapMethodCallScript.java
=====================================
@@ -80,7 +80,7 @@ public class WrapMethodCallScript extends MethodLevelPatchScript {
private final MethodLogistics logistics;
public WrapMethodCall(MethodVisitor mv, String ownClassSpec, MethodLogistics logistics) {
- super(Opcodes.ASM4, mv);
+ super(Opcodes.ASM6, mv);
this.ownClassSpec = ownClassSpec;
this.logistics = logistics;
}
=====================================
src/patcher/lombok/patcher/scripts/WrapReturnValuesScript.java
=====================================
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2014 The Project Lombok Authors.
+ * Copyright (C) 2009-2017 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
@@ -24,8 +24,6 @@ package lombok.patcher.scripts;
import java.util.List;
import java.util.Set;
-import lombok.NonNull;
-import lombok.ToString;
import lombok.patcher.Hook;
import lombok.patcher.MethodLogistics;
import lombok.patcher.StackRequest;
@@ -39,9 +37,8 @@ import org.objectweb.asm.Opcodes;
/**
* Will find every 'return' instruction in the target method and will insert right before it a call to the wrapper.
*/
- at ToString
public final class WrapReturnValuesScript extends MethodLevelPatchScript {
- private final @NonNull Hook wrapper;
+ private final Hook wrapper;
private final Set<StackRequest> requests;
private final boolean hijackReturnValue;
private final boolean transplant, insert;
@@ -81,7 +78,7 @@ public final class WrapReturnValuesScript extends MethodLevelPatchScript {
private final String ownClassSpec;
public WrapReturnValues(MethodVisitor mv, MethodLogistics logistics, String ownClassSpec) {
- super(Opcodes.ASM4, mv);
+ super(Opcodes.ASM6, mv);
this.logistics = logistics;
this.ownClassSpec = ownClassSpec;
}
@@ -117,4 +114,8 @@ public final class WrapReturnValuesScript extends MethodLevelPatchScript {
super.visitInsn(opcode);
}
}
+
+ @Override public String toString() {
+ return "WrapReturnValues(wrapper: " + wrapper + ", hijackReturn: " + hijackReturnValue + ", transplant: " + transplant + ", insert: " + insert + ", requests: " + requests + ")";
+ }
}
=====================================
src/patcher/lombok/patcher/scripts/WrapperMethodDescriptor.java
=====================================
@@ -1,18 +1,114 @@
+/*
+ * Copyright (C) 2017 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
package lombok.patcher.scripts;
-import lombok.Value;
-
- at Value
public class WrapperMethodDescriptor {
- int count;
- int opcode;
- String owner;
- String name;
- String wrapperDescriptor;
- String targetDescriptor;
- boolean itf;
+ private final int count;
+ private final int opcode;
+ private final String owner;
+ private final String name;
+ private final String wrapperDescriptor;
+ private final String targetDescriptor;
+ private final boolean itf; // interface
+
+ public WrapperMethodDescriptor(int count, int opcode, String owner, String name, String wrapperDescriptor, String targetDescriptor, boolean itf) {
+ this.count = count;
+ this.opcode = opcode;
+ this.owner = owner;
+ this.name = name;
+ this.wrapperDescriptor = wrapperDescriptor;
+ this.targetDescriptor = targetDescriptor;
+ this.itf = itf;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public int getOpcode() {
+ return opcode;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getWrapperDescriptor() {
+ return wrapperDescriptor;
+ }
+
+ public String getTargetDescriptor() {
+ return targetDescriptor;
+ }
+
+ public boolean isItf() {
+ return itf;
+ }
public String getWrapperName() {
return "$lombok$$wrapper$" + count + "$" + name;
}
+
+ @Override public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + count;
+ result = prime * result + (itf ? 1231 : 1237);
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + opcode;
+ result = prime * result + ((owner == null) ? 0 : owner.hashCode());
+ result = prime * result + ((targetDescriptor == null) ? 0 : targetDescriptor.hashCode());
+ result = prime * result + ((wrapperDescriptor == null) ? 0 : wrapperDescriptor.hashCode());
+ return result;
+ }
+
+ @Override public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ WrapperMethodDescriptor other = (WrapperMethodDescriptor) obj;
+ if (count != other.count) return false;
+ if (itf != other.itf) return false;
+ if (name == null) {
+ if (other.name != null) return false;
+ } else if (!name.equals(other.name)) return false;
+ if (opcode != other.opcode) return false;
+ if (owner == null) {
+ if (other.owner != null) return false;
+ } else if (!owner.equals(other.owner)) return false;
+ if (targetDescriptor == null) {
+ if (other.targetDescriptor != null) return false;
+ } else if (!targetDescriptor.equals(other.targetDescriptor)) return false;
+ if (wrapperDescriptor == null) {
+ if (other.wrapperDescriptor != null) return false;
+ } else if (!wrapperDescriptor.equals(other.wrapperDescriptor)) return false;
+ return true;
+ }
+
+ @Override public String toString() {
+ return "WrapperMethodDescriptor[count=" + count + ", opcode=" + opcode + ", owner=" + owner + ", name=" + name + ", wrapperDescriptor=" + wrapperDescriptor + ", targetDescriptor=" + targetDescriptor + ", itf=" + itf + "]";
+ }
}
View it on GitLab: https://salsa.debian.org/java-team/lombok-patcher/commit/cb57947a6917e3bebb9b92c7fa0322aa990b98be
--
View it on GitLab: https://salsa.debian.org/java-team/lombok-patcher/commit/cb57947a6917e3bebb9b92c7fa0322aa990b98be
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20181002/8ed0c57e/attachment.html>
More information about the pkg-java-commits
mailing list