You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2018/11/29 00:34:12 UTC
[25/46] tapestry-5 git commit: TAP5-2588: upgrading from ASM 6 to 7
for Java 9+ support
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/Remapper.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/Remapper.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/Remapper.java
old mode 100644
new mode 100755
index f1cad6f..c6da2a5
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/Remapper.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/Remapper.java
@@ -1,260 +1,330 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.commons;
+import org.apache.tapestry5.internal.plastic.asm.ConstantDynamic;
import org.apache.tapestry5.internal.plastic.asm.Handle;
+import org.apache.tapestry5.internal.plastic.asm.Opcodes;
import org.apache.tapestry5.internal.plastic.asm.Type;
import org.apache.tapestry5.internal.plastic.asm.signature.SignatureReader;
import org.apache.tapestry5.internal.plastic.asm.signature.SignatureVisitor;
import org.apache.tapestry5.internal.plastic.asm.signature.SignatureWriter;
/**
- * A class responsible for remapping types and names. Subclasses can override
- * the following methods:
- *
- * <ul>
- * <li>{@link #map(String)} - map type</li>
- * <li>{@link #mapFieldName(String, String, String)} - map field name</li>
- * <li>{@link #mapMethodName(String, String, String)} - map method name</li>
- * </ul>
- *
+ * A class responsible for remapping types and names.
+ *
* @author Eugene Kuleshov
*/
public abstract class Remapper {
- public String mapDesc(String desc) {
- Type t = Type.getType(desc);
- switch (t.getSort()) {
- case Type.ARRAY:
- String s = mapDesc(t.getElementType().getDescriptor());
- for (int i = 0; i < t.getDimensions(); ++i) {
- s = '[' + s;
- }
- return s;
- case Type.OBJECT:
- String newType = map(t.getInternalName());
- if (newType != null) {
- return 'L' + newType + ';';
- }
- }
- return desc;
- }
+ /**
+ * Returns the given descriptor, remapped with {@link #map(String)}.
+ *
+ * @param descriptor a type descriptor.
+ * @return the given descriptor, with its [array element type] internal name remapped with {@link
+ * #map(String)} (if the descriptor corresponds to an array or object type, otherwise the
+ * descriptor is returned as is).
+ */
+ public String mapDesc(final String descriptor) {
+ return mapType(Type.getType(descriptor)).getDescriptor();
+ }
- private Type mapType(Type t) {
- switch (t.getSort()) {
- case Type.ARRAY:
- String s = mapDesc(t.getElementType().getDescriptor());
- for (int i = 0; i < t.getDimensions(); ++i) {
- s = '[' + s;
- }
- return Type.getType(s);
- case Type.OBJECT:
- s = map(t.getInternalName());
- return s != null ? Type.getObjectType(s) : t;
- case Type.METHOD:
- return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
+ /**
+ * Returns the given {@link Type}, remapped with {@link #map(String)} or {@link
+ * #mapMethodDesc(String)}.
+ *
+ * @param type a type, which can be a method type.
+ * @return the given type, with its [array element type] internal name remapped with {@link
+ * #map(String)} (if the type is an array or object type, otherwise the type is returned as
+ * is) or, of the type is a method type, with its descriptor remapped with {@link
+ * #mapMethodDesc(String)}.
+ */
+ private Type mapType(final Type type) {
+ switch (type.getSort()) {
+ case Type.ARRAY:
+ StringBuilder remappedDescriptor = new StringBuilder();
+ for (int i = 0; i < type.getDimensions(); ++i) {
+ remappedDescriptor.append('[');
}
- return t;
+ remappedDescriptor.append(mapType(type.getElementType()).getDescriptor());
+ return Type.getType(remappedDescriptor.toString());
+ case Type.OBJECT:
+ String remappedInternalName = map(type.getInternalName());
+ return remappedInternalName != null ? Type.getObjectType(remappedInternalName) : type;
+ case Type.METHOD:
+ return Type.getMethodType(mapMethodDesc(type.getDescriptor()));
+ default:
+ return type;
}
+ }
- public String mapType(String type) {
- if (type == null) {
- return null;
- }
- return mapType(Type.getObjectType(type)).getInternalName();
+ /**
+ * Returns the given internal name, remapped with {@link #map(String)}.
+ *
+ * @param internalName the internal name (or array type descriptor) of some (array) class.
+ * @return the given internal name, remapped with {@link #map(String)}.
+ */
+ public String mapType(final String internalName) {
+ if (internalName == null) {
+ return null;
}
+ return mapType(Type.getObjectType(internalName)).getInternalName();
+ }
- public String[] mapTypes(String[] types) {
- String[] newTypes = null;
- boolean needMapping = false;
- for (int i = 0; i < types.length; i++) {
- String type = types[i];
- String newType = map(type);
- if (newType != null && newTypes == null) {
- newTypes = new String[types.length];
- if (i > 0) {
- System.arraycopy(types, 0, newTypes, 0, i);
- }
- needMapping = true;
- }
- if (needMapping) {
- newTypes[i] = newType == null ? type : newType;
- }
+ /**
+ * Returns the given internal names, remapped with {@link #map(String)}.
+ *
+ * @param internalNames the internal names (or array type descriptors) of some (array) classes.
+ * @return the given internal name, remapped with {@link #map(String)}.
+ */
+ public String[] mapTypes(final String[] internalNames) {
+ String[] remappedInternalNames = null;
+ for (int i = 0; i < internalNames.length; ++i) {
+ String internalName = internalNames[i];
+ String remappedInternalName = mapType(internalName);
+ if (remappedInternalName != null) {
+ if (remappedInternalNames == null) {
+ remappedInternalNames = new String[internalNames.length];
+ System.arraycopy(internalNames, 0, remappedInternalNames, 0, internalNames.length);
}
- return needMapping ? newTypes : types;
+ remappedInternalNames[i] = remappedInternalName;
+ }
}
+ return remappedInternalNames != null ? remappedInternalNames : internalNames;
+ }
- public String mapMethodDesc(String desc) {
- if ("()V".equals(desc)) {
- return desc;
- }
-
- Type[] args = Type.getArgumentTypes(desc);
- StringBuilder sb = new StringBuilder("(");
- for (int i = 0; i < args.length; i++) {
- sb.append(mapDesc(args[i].getDescriptor()));
- }
- Type returnType = Type.getReturnType(desc);
- if (returnType == Type.VOID_TYPE) {
- sb.append(")V");
- return sb.toString();
- }
- sb.append(')').append(mapDesc(returnType.getDescriptor()));
- return sb.toString();
+ /**
+ * Returns the given method descriptor, with its argument and return type descriptors remapped
+ * with {@link #mapDesc(String)}.
+ *
+ * @param methodDescriptor a method descriptor.
+ * @return the given method descriptor, with its argument and return type descriptors remapped
+ * with {@link #mapDesc(String)}.
+ */
+ public String mapMethodDesc(final String methodDescriptor) {
+ if ("()V".equals(methodDescriptor)) {
+ return methodDescriptor;
}
- public Object mapValue(Object value) {
- if (value instanceof Type) {
- return mapType((Type) value);
- }
- if (value instanceof Handle) {
- Handle h = (Handle) value;
- return new Handle(h.getTag(), mapType(h.getOwner()), mapMethodName(
- h.getOwner(), h.getName(), h.getDesc()),
- mapMethodDesc(h.getDesc()), h.isInterface());
- }
- return value;
+ StringBuilder stringBuilder = new StringBuilder("(");
+ for (Type argumentType : Type.getArgumentTypes(methodDescriptor)) {
+ stringBuilder.append(mapType(argumentType).getDescriptor());
}
-
- /**
- * @param signature
- * signature for mapper
- * @param typeSignature
- * true if signature is a FieldTypeSignature, such as the
- * signature parameter of the ClassVisitor.visitField or
- * MethodVisitor.visitLocalVariable methods
- * @return signature rewritten as a string
- */
- public String mapSignature(String signature, boolean typeSignature) {
- if (signature == null) {
- return null;
- }
- SignatureReader r = new SignatureReader(signature);
- SignatureWriter w = new SignatureWriter();
- SignatureVisitor a = createSignatureRemapper(w);
- if (typeSignature) {
- r.acceptType(a);
- } else {
- r.accept(a);
- }
- return w.toString();
+ Type returnType = Type.getReturnType(methodDescriptor);
+ if (returnType == Type.VOID_TYPE) {
+ stringBuilder.append(")V");
+ } else {
+ stringBuilder.append(')').append(mapType(returnType).getDescriptor());
}
+ return stringBuilder.toString();
+ }
- /**
- * @deprecated use {@link #createSignatureRemapper} instead.
- */
- @Deprecated
- protected SignatureVisitor createRemappingSignatureAdapter(
- SignatureVisitor v) {
- return new SignatureRemapper(v, this);
+ /**
+ * Returns the given value, remapped with this remapper. Possible values are {@link Boolean},
+ * {@link Byte}, {@link Short}, {@link Character}, {@link Integer}, {@link Long}, {@link Double},
+ * {@link Float}, {@link String}, {@link Type}, {@link Handle}, {@link ConstantDynamic} or arrays
+ * of primitive types .
+ *
+ * @param value an object. Only {@link Type}, {@link Handle} and {@link ConstantDynamic} values
+ * are remapped.
+ * @return the given value, remapped with this remapper.
+ */
+ public Object mapValue(final Object value) {
+ if (value instanceof Type) {
+ return mapType((Type) value);
}
-
- protected SignatureVisitor createSignatureRemapper(
- SignatureVisitor v) {
- return createRemappingSignatureAdapter(v);
+ if (value instanceof Handle) {
+ Handle handle = (Handle) value;
+ return new Handle(
+ handle.getTag(),
+ mapType(handle.getOwner()),
+ mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()),
+ handle.getTag() <= Opcodes.H_PUTSTATIC
+ ? mapDesc(handle.getDesc())
+ : mapMethodDesc(handle.getDesc()),
+ handle.isInterface());
}
-
- /**
- * Map method name to the new name. Subclasses can override.
- *
- * @param owner
- * owner of the method.
- * @param name
- * name of the method.
- * @param desc
- * descriptor of the method.
- * @return new name of the method
- */
- public String mapMethodName(String owner, String name, String desc) {
- return name;
+ if (value instanceof ConstantDynamic) {
+ ConstantDynamic constantDynamic = (ConstantDynamic) value;
+ int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount();
+ Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArgumentCount];
+ for (int i = 0; i < bootstrapMethodArgumentCount; ++i) {
+ remappedBootstrapMethodArguments[i] =
+ mapValue(constantDynamic.getBootstrapMethodArgument(i));
+ }
+ String descriptor = constantDynamic.getDescriptor();
+ return new ConstantDynamic(
+ mapInvokeDynamicMethodName(constantDynamic.getName(), descriptor),
+ mapDesc(descriptor),
+ (Handle) mapValue(constantDynamic.getBootstrapMethod()),
+ remappedBootstrapMethodArguments);
}
+ return value;
+ }
- /**
- * Map invokedynamic method name to the new name. Subclasses can override.
- *
- * @param name
- * name of the invokedynamic.
- * @param desc
- * descriptor of the invokedynamic.
- * @return new invokdynamic name.
- */
- public String mapInvokeDynamicMethodName(String name, String desc) {
- return name;
+ /**
+ * Returns the given signature, remapped with the {@link SignatureVisitor} returned by {@link
+ * #createSignatureRemapper(SignatureVisitor)}.
+ *
+ * @param signature a <i>JavaTypeSignature</i>, <i>ClassSignature</i> or <i>MethodSignature</i>.
+ * @param typeSignature whether the given signature is a <i>JavaTypeSignature</i>.
+ * @return signature the given signature, remapped with the {@link SignatureVisitor} returned by
+ * {@link #createSignatureRemapper(SignatureVisitor)}.
+ */
+ public String mapSignature(final String signature, final boolean typeSignature) {
+ if (signature == null) {
+ return null;
}
-
- /**
- * Map field name to the new name. Subclasses can override.
- *
- * @param owner
- * owner of the field.
- * @param name
- * name of the field
- * @param desc
- * descriptor of the field
- * @return new name of the field.
- */
- public String mapFieldName(String owner, String name, String desc) {
- return name;
+ SignatureReader signatureReader = new SignatureReader(signature);
+ SignatureWriter signatureWriter = new SignatureWriter();
+ SignatureVisitor signatureRemapper = createSignatureRemapper(signatureWriter);
+ if (typeSignature) {
+ signatureReader.acceptType(signatureRemapper);
+ } else {
+ signatureReader.accept(signatureRemapper);
}
+ return signatureWriter.toString();
+ }
- /**
- * Map package name to the new name. Subclasses can override.
- *
- * @param name name of the package
- * @return new name of the package
- */
- public String mapPackageName(String name) {
- String fakeName = map(name + ".FakeClassName");
- int index;
- return fakeName == null || (index = fakeName.lastIndexOf('.')) == -1 ? name: fakeName.substring(0, index);
- }
-
- /**
- * Map module name to the new name. Subclasses can override.
- *
- * @param name name of the module
- * @return new name of the module
- */
- public String mapModuleName(String name) {
- return name;
- }
-
- /**
- * Map type name to the new name. Subclasses can override.
- *
- * @param typeName
- * the type name
- * @return new name, default implementation is the identity.
- */
- public String map(String typeName) {
- return typeName;
+ /**
+ * Constructs a new remapper for signatures. The default implementation of this method returns a
+ * new {@link SignatureRemapper}.
+ *
+ * @param signatureVisitor the SignatureVisitor the remapper must delegate to.
+ * @return the newly created remapper.
+ * @deprecated use {@link #createSignatureRemapper} instead.
+ */
+ @Deprecated
+ protected SignatureVisitor createRemappingSignatureAdapter(
+ final SignatureVisitor signatureVisitor) {
+ return createSignatureRemapper(signatureVisitor);
+ }
+
+ /**
+ * Constructs a new remapper for signatures. The default implementation of this method returns a
+ * new {@link SignatureRemapper}.
+ *
+ * @param signatureVisitor the SignatureVisitor the remapper must delegate to.
+ * @return the newly created remapper.
+ */
+ protected SignatureVisitor createSignatureRemapper(final SignatureVisitor signatureVisitor) {
+ return new SignatureRemapper(signatureVisitor, this);
+ }
+
+ /**
+ * Maps an inner class name to its new name. The default implementation of this method provides a
+ * strategy that will work for inner classes produced by Java, but not necessarily other
+ * languages. Subclasses can override.
+ *
+ * @param name the fully-qualified internal name of the inner class.
+ * @param ownerName the internal name of the owner class of the inner class.
+ * @param innerName the internal name of the inner class.
+ * @return the new inner name of the inner class.
+ */
+ public String mapInnerClassName(
+ final String name, final String ownerName, final String innerName) {
+ final String remappedInnerName = this.mapType(name);
+ if (remappedInnerName.contains("$")) {
+ return remappedInnerName.substring(remappedInnerName.lastIndexOf('$') + 1);
+ } else {
+ return innerName;
}
+ }
+
+ /**
+ * Maps a method name to its new name. The default implementation of this method returns the given
+ * name, unchanged. Subclasses can override.
+ *
+ * @param owner the internal name of the owner class of the method.
+ * @param name the name of the method.
+ * @param descriptor the descriptor of the method.
+ * @return the new name of the method.
+ */
+ public String mapMethodName(final String owner, final String name, final String descriptor) {
+ return name;
+ }
+
+ /**
+ * Maps an invokedynamic or a constant dynamic method name to its new name. The default
+ * implementation of this method returns the given name, unchanged. Subclasses can override.
+ *
+ * @param name the name of the method.
+ * @param descriptor the descriptor of the method.
+ * @return the new name of the method.
+ */
+ public String mapInvokeDynamicMethodName(final String name, final String descriptor) {
+ return name;
+ }
+
+ /**
+ * Maps a field name to its new name. The default implementation of this method returns the given
+ * name, unchanged. Subclasses can override.
+ *
+ * @param owner the internal name of the owner class of the field.
+ * @param name the name of the field.
+ * @param descriptor the descriptor of the field.
+ * @return the new name of the field.
+ */
+ public String mapFieldName(final String owner, final String name, final String descriptor) {
+ return name;
+ }
+
+ /**
+ * Maps a package name to its new name. The default implementation of this method returns the
+ * given name, unchanged. Subclasses can override.
+ *
+ * @param name the fully qualified name of the package (using dots).
+ * @return the new name of the package.
+ */
+ public String mapPackageName(final String name) {
+ return name;
+ }
+
+ /**
+ * Maps a module name to its new name. The default implementation of this method returns the given
+ * name, unchanged. Subclasses can override.
+ *
+ * @param name the fully qualified name (using dots) of a module.
+ * @return the new name of the module.
+ */
+ public String mapModuleName(final String name) {
+ return name;
+ }
+
+ /**
+ * Maps the internal name of a class to its new name. The default implementation of this method
+ * returns the given name, unchanged. Subclasses can override.
+ *
+ * @param internalName the internal name of a class.
+ * @return the new internal name.
+ */
+ public String map(final String internalName) {
+ return internalName;
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingAnnotationAdapter.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingAnnotationAdapter.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingAnnotationAdapter.java
old mode 100644
new mode 100755
index ebb34b8..cf7ada2
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingAnnotationAdapter.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingAnnotationAdapter.java
@@ -1,32 +1,30 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.commons;
@@ -35,47 +33,53 @@ import org.apache.tapestry5.internal.plastic.asm.Opcodes;
/**
* An {@link AnnotationVisitor} adapter for type remapping.
- *
+ *
* @deprecated use {@link AnnotationRemapper} instead.
* @author Eugene Kuleshov
*/
@Deprecated
public class RemappingAnnotationAdapter extends AnnotationVisitor {
- protected final Remapper remapper;
+ protected final Remapper remapper;
- public RemappingAnnotationAdapter(final AnnotationVisitor av,
- final Remapper remapper) {
- this(Opcodes.ASM6, av, remapper);
- }
+ public RemappingAnnotationAdapter(
+ final AnnotationVisitor annotationVisitor, final Remapper remapper) {
+ this(Opcodes.ASM6, annotationVisitor, remapper);
+ }
- protected RemappingAnnotationAdapter(final int api,
- final AnnotationVisitor av, final Remapper remapper) {
- super(api, av);
- this.remapper = remapper;
- }
+ protected RemappingAnnotationAdapter(
+ final int api, final AnnotationVisitor annotationVisitor, final Remapper remapper) {
+ super(api, annotationVisitor);
+ this.remapper = remapper;
+ }
- @Override
- public void visit(String name, Object value) {
- av.visit(name, remapper.mapValue(value));
- }
+ @Override
+ public void visit(final String name, final Object value) {
+ av.visit(name, remapper.mapValue(value));
+ }
- @Override
- public void visitEnum(String name, String desc, String value) {
- av.visitEnum(name, remapper.mapDesc(desc), value);
- }
+ @Override
+ public void visitEnum(final String name, final String descriptor, final String value) {
+ av.visitEnum(name, remapper.mapDesc(descriptor), value);
+ }
- @Override
- public AnnotationVisitor visitAnnotation(String name, String desc) {
- AnnotationVisitor v = av.visitAnnotation(name, remapper.mapDesc(desc));
- return v == null ? null : (v == av ? this
- : new RemappingAnnotationAdapter(v, remapper));
- }
+ @Override
+ public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
+ AnnotationVisitor annotationVisitor = av.visitAnnotation(name, remapper.mapDesc(descriptor));
+ return annotationVisitor == null
+ ? null
+ : (annotationVisitor == av
+ ? this
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper));
+ }
- @Override
- public AnnotationVisitor visitArray(String name) {
- AnnotationVisitor v = av.visitArray(name);
- return v == null ? null : (v == av ? this
- : new RemappingAnnotationAdapter(v, remapper));
- }
+ @Override
+ public AnnotationVisitor visitArray(final String name) {
+ AnnotationVisitor annotationVisitor = av.visitArray(name);
+ return annotationVisitor == null
+ ? null
+ : (annotationVisitor == av
+ ? this
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper));
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingClassAdapter.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingClassAdapter.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingClassAdapter.java
old mode 100644
new mode 100755
index baf6a41..72b110c
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingClassAdapter.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingClassAdapter.java
@@ -1,32 +1,30 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.commons;
@@ -40,104 +38,130 @@ import org.apache.tapestry5.internal.plastic.asm.TypePath;
/**
* A {@link ClassVisitor} for type remapping.
- *
+ *
* @deprecated use {@link ClassRemapper} instead.
* @author Eugene Kuleshov
*/
@Deprecated
public class RemappingClassAdapter extends ClassVisitor {
- protected final Remapper remapper;
-
- protected String className;
-
- public RemappingClassAdapter(final ClassVisitor cv, final Remapper remapper) {
- this(Opcodes.ASM6, cv, remapper);
- }
-
- protected RemappingClassAdapter(final int api, final ClassVisitor cv,
- final Remapper remapper) {
- super(api, cv);
- this.remapper = remapper;
- }
-
- @Override
- public void visit(int version, int access, String name, String signature,
- String superName, String[] interfaces) {
- this.className = name;
- super.visit(version, access, remapper.mapType(name), remapper
- .mapSignature(signature, false), remapper.mapType(superName),
- interfaces == null ? null : remapper.mapTypes(interfaces));
- }
-
- @Override
- public ModuleVisitor visitModule(String name, int flags, String version) {
- throw new RuntimeException("RemappingClassAdapter is deprecated, use ClassRemapper instead");
- }
-
- @Override
- public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
- AnnotationVisitor av = super.visitAnnotation(remapper.mapDesc(desc),
- visible);
- return av == null ? null : createRemappingAnnotationAdapter(av);
- }
-
- @Override
- public AnnotationVisitor visitTypeAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- AnnotationVisitor av = super.visitTypeAnnotation(typeRef, typePath,
- remapper.mapDesc(desc), visible);
- return av == null ? null : createRemappingAnnotationAdapter(av);
- }
-
- @Override
- public FieldVisitor visitField(int access, String name, String desc,
- String signature, Object value) {
- FieldVisitor fv = super.visitField(access,
- remapper.mapFieldName(className, name, desc),
- remapper.mapDesc(desc), remapper.mapSignature(signature, true),
- remapper.mapValue(value));
- return fv == null ? null : createRemappingFieldAdapter(fv);
- }
-
- @Override
- public MethodVisitor visitMethod(int access, String name, String desc,
- String signature, String[] exceptions) {
- String newDesc = remapper.mapMethodDesc(desc);
- MethodVisitor mv = super.visitMethod(access, remapper.mapMethodName(
- className, name, desc), newDesc, remapper.mapSignature(
- signature, false),
- exceptions == null ? null : remapper.mapTypes(exceptions));
- return mv == null ? null : createRemappingMethodAdapter(access,
- newDesc, mv);
- }
-
- @Override
- public void visitInnerClass(String name, String outerName,
- String innerName, int access) {
- // TODO should innerName be changed?
- super.visitInnerClass(remapper.mapType(name), outerName == null ? null
- : remapper.mapType(outerName), innerName, access);
- }
-
- @Override
- public void visitOuterClass(String owner, String name, String desc) {
- super.visitOuterClass(remapper.mapType(owner), name == null ? null
- : remapper.mapMethodName(owner, name, desc),
- desc == null ? null : remapper.mapMethodDesc(desc));
- }
-
- protected FieldVisitor createRemappingFieldAdapter(FieldVisitor fv) {
- return new RemappingFieldAdapter(fv, remapper);
- }
-
- protected MethodVisitor createRemappingMethodAdapter(int access,
- String newDesc, MethodVisitor mv) {
- return new RemappingMethodAdapter(access, newDesc, mv, remapper);
- }
-
- protected AnnotationVisitor createRemappingAnnotationAdapter(
- AnnotationVisitor av) {
- return new RemappingAnnotationAdapter(av, remapper);
- }
+ protected final Remapper remapper;
+
+ protected String className;
+
+ public RemappingClassAdapter(final ClassVisitor classVisitor, final Remapper remapper) {
+ this(Opcodes.ASM6, classVisitor, remapper);
+ }
+
+ protected RemappingClassAdapter(
+ final int api, final ClassVisitor classVisitor, final Remapper remapper) {
+ super(api, classVisitor);
+ this.remapper = remapper;
+ }
+
+ @Override
+ public void visit(
+ final int version,
+ final int access,
+ final String name,
+ final String signature,
+ final String superName,
+ final String[] interfaces) {
+ this.className = name;
+ super.visit(
+ version,
+ access,
+ remapper.mapType(name),
+ remapper.mapSignature(signature, false),
+ remapper.mapType(superName),
+ interfaces == null ? null : remapper.mapTypes(interfaces));
+ }
+
+ @Override
+ public ModuleVisitor visitModule(final String name, final int flags, final String version) {
+ throw new RuntimeException("RemappingClassAdapter is deprecated, use ClassRemapper instead");
+ }
+
+ @Override
+ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitAnnotation(remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null ? null : createRemappingAnnotationAdapter(annotationVisitor);
+ }
+
+ @Override
+ public AnnotationVisitor visitTypeAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null ? null : createRemappingAnnotationAdapter(annotationVisitor);
+ }
+
+ @Override
+ public FieldVisitor visitField(
+ final int access,
+ final String name,
+ final String descriptor,
+ final String signature,
+ final Object value) {
+ FieldVisitor fieldVisitor =
+ super.visitField(
+ access,
+ remapper.mapFieldName(className, name, descriptor),
+ remapper.mapDesc(descriptor),
+ remapper.mapSignature(signature, true),
+ remapper.mapValue(value));
+ return fieldVisitor == null ? null : createRemappingFieldAdapter(fieldVisitor);
+ }
+
+ @Override
+ public MethodVisitor visitMethod(
+ final int access,
+ final String name,
+ final String descriptor,
+ final String signature,
+ final String[] exceptions) {
+ String newDescriptor = remapper.mapMethodDesc(descriptor);
+ MethodVisitor methodVisitor =
+ super.visitMethod(
+ access,
+ remapper.mapMethodName(className, name, descriptor),
+ newDescriptor,
+ remapper.mapSignature(signature, false),
+ exceptions == null ? null : remapper.mapTypes(exceptions));
+ return methodVisitor == null
+ ? null
+ : createRemappingMethodAdapter(access, newDescriptor, methodVisitor);
+ }
+
+ @Override
+ public void visitInnerClass(
+ final String name, final String outerName, final String innerName, final int access) {
+ super.visitInnerClass(
+ remapper.mapType(name),
+ outerName == null ? null : remapper.mapType(outerName),
+ innerName,
+ access);
+ }
+
+ @Override
+ public void visitOuterClass(final String owner, final String name, final String descriptor) {
+ super.visitOuterClass(
+ remapper.mapType(owner),
+ name == null ? null : remapper.mapMethodName(owner, name, descriptor),
+ descriptor == null ? null : remapper.mapMethodDesc(descriptor));
+ }
+
+ protected FieldVisitor createRemappingFieldAdapter(final FieldVisitor fieldVisitor) {
+ return new RemappingFieldAdapter(fieldVisitor, remapper);
+ }
+
+ protected MethodVisitor createRemappingMethodAdapter(
+ final int access, final String newDescriptor, final MethodVisitor methodVisitior) {
+ return new RemappingMethodAdapter(access, newDescriptor, methodVisitior, remapper);
+ }
+
+ protected AnnotationVisitor createRemappingAnnotationAdapter(final AnnotationVisitor av) {
+ return new RemappingAnnotationAdapter(av, remapper);
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingFieldAdapter.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingFieldAdapter.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingFieldAdapter.java
old mode 100644
new mode 100755
index 4bb4d3f..e6ed262
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingFieldAdapter.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingFieldAdapter.java
@@ -1,32 +1,30 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.commons;
@@ -37,37 +35,40 @@ import org.apache.tapestry5.internal.plastic.asm.TypePath;
/**
* A {@link FieldVisitor} adapter for type remapping.
- *
+ *
* @deprecated use {@link FieldRemapper} instead.
* @author Eugene Kuleshov
*/
@Deprecated
public class RemappingFieldAdapter extends FieldVisitor {
- private final Remapper remapper;
+ private final Remapper remapper;
- public RemappingFieldAdapter(final FieldVisitor fv, final Remapper remapper) {
- this(Opcodes.ASM6, fv, remapper);
- }
+ public RemappingFieldAdapter(final FieldVisitor fieldVisitor, final Remapper remapper) {
+ this(Opcodes.ASM6, fieldVisitor, remapper);
+ }
- protected RemappingFieldAdapter(final int api, final FieldVisitor fv,
- final Remapper remapper) {
- super(api, fv);
- this.remapper = remapper;
- }
+ protected RemappingFieldAdapter(
+ final int api, final FieldVisitor fieldVisitor, final Remapper remapper) {
+ super(api, fieldVisitor);
+ this.remapper = remapper;
+ }
- @Override
- public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
- AnnotationVisitor av = fv.visitAnnotation(remapper.mapDesc(desc),
- visible);
- return av == null ? null : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor = fv.visitAnnotation(remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null
+ ? null
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
- @Override
- public AnnotationVisitor visitTypeAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- AnnotationVisitor av = super.visitTypeAnnotation(typeRef, typePath,
- remapper.mapDesc(desc), visible);
- return av == null ? null : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitTypeAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null
+ ? null
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingMethodAdapter.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingMethodAdapter.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingMethodAdapter.java
old mode 100644
new mode 100755
index cd74921..90a719a
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingMethodAdapter.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingMethodAdapter.java
@@ -1,32 +1,30 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.commons;
@@ -39,190 +37,243 @@ import org.apache.tapestry5.internal.plastic.asm.TypePath;
/**
* A {@link LocalVariablesSorter} for type mapping.
- *
+ *
* @deprecated use {@link MethodRemapper} instead.
* @author Eugene Kuleshov
*/
@Deprecated
public class RemappingMethodAdapter extends LocalVariablesSorter {
- protected final Remapper remapper;
+ protected final Remapper remapper;
- public RemappingMethodAdapter(final int access, final String desc,
- final MethodVisitor mv, final Remapper remapper) {
- this(Opcodes.ASM6, access, desc, mv, remapper);
- }
+ public RemappingMethodAdapter(
+ final int access,
+ final String descriptor,
+ final MethodVisitor methodVisitor,
+ final Remapper remapper) {
+ this(Opcodes.ASM6, access, descriptor, methodVisitor, remapper);
+ }
- protected RemappingMethodAdapter(final int api, final int access,
- final String desc, final MethodVisitor mv, final Remapper remapper) {
- super(api, access, desc, mv);
- this.remapper = remapper;
- }
+ protected RemappingMethodAdapter(
+ final int api,
+ final int access,
+ final String descriptor,
+ final MethodVisitor methodVisitor,
+ final Remapper remapper) {
+ super(api, access, descriptor, methodVisitor);
+ this.remapper = remapper;
+ }
- @Override
- public AnnotationVisitor visitAnnotationDefault() {
- AnnotationVisitor av = super.visitAnnotationDefault();
- return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitAnnotationDefault() {
+ AnnotationVisitor annotationVisitor = super.visitAnnotationDefault();
+ return annotationVisitor == null
+ ? annotationVisitor
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
- @Override
- public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
- AnnotationVisitor av = super.visitAnnotation(remapper.mapDesc(desc),
- visible);
- return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitAnnotation(remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null
+ ? annotationVisitor
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
- @Override
- public AnnotationVisitor visitTypeAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- AnnotationVisitor av = super.visitTypeAnnotation(typeRef, typePath,
- remapper.mapDesc(desc), visible);
- return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitTypeAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null
+ ? annotationVisitor
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
- @Override
- public AnnotationVisitor visitParameterAnnotation(int parameter,
- String desc, boolean visible) {
- AnnotationVisitor av = super.visitParameterAnnotation(parameter,
- remapper.mapDesc(desc), visible);
- return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitParameterAnnotation(
+ final int parameter, final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitParameterAnnotation(parameter, remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null
+ ? annotationVisitor
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
- @Override
- public void visitFrame(int type, int nLocal, Object[] local, int nStack,
- Object[] stack) {
- super.visitFrame(type, nLocal, remapEntries(nLocal, local), nStack,
- remapEntries(nStack, stack));
- }
+ @Override
+ public void visitFrame(
+ final int type,
+ final int numLocal,
+ final Object[] local,
+ final int numStack,
+ final Object[] stack) {
+ super.visitFrame(
+ type, numLocal, remapEntries(numLocal, local), numStack, remapEntries(numStack, stack));
+ }
- private Object[] remapEntries(int n, Object[] entries) {
- if (entries != null) {
- for (int i = 0; i < n; i++) {
- if (entries[i] instanceof String) {
- Object[] newEntries = new Object[n];
- if (i > 0) {
- System.arraycopy(entries, 0, newEntries, 0, i);
- }
- do {
- Object t = entries[i];
- newEntries[i++] = t instanceof String ? remapper
- .mapType((String) t) : t;
- } while (i < n);
- return newEntries;
- }
- }
+ private Object[] remapEntries(final int numTypes, final Object[] entries) {
+ if (entries == null) {
+ return entries;
+ }
+ Object[] remappedEntries = null;
+ for (int i = 0; i < numTypes; ++i) {
+ if (entries[i] instanceof String) {
+ if (remappedEntries == null) {
+ remappedEntries = new Object[numTypes];
+ System.arraycopy(entries, 0, remappedEntries, 0, numTypes);
}
- return entries;
+ remappedEntries[i] = remapper.mapType((String) entries[i]);
+ }
}
+ return remappedEntries == null ? entries : remappedEntries;
+ }
- @Override
- public void visitFieldInsn(int opcode, String owner, String name,
- String desc) {
- super.visitFieldInsn(opcode, remapper.mapType(owner),
- remapper.mapFieldName(owner, name, desc),
- remapper.mapDesc(desc));
- }
+ @Override
+ public void visitFieldInsn(
+ final int opcode, final String owner, final String name, final String descriptor) {
+ super.visitFieldInsn(
+ opcode,
+ remapper.mapType(owner),
+ remapper.mapFieldName(owner, name, descriptor),
+ remapper.mapDesc(descriptor));
+ }
- @Deprecated
- @Override
- public void visitMethodInsn(final int opcode, final String owner,
- final String name, final String desc) {
- if (api >= Opcodes.ASM5) {
- super.visitMethodInsn(opcode, owner, name, desc);
- return;
- }
- doVisitMethodInsn(opcode, owner, name, desc,
- opcode == Opcodes.INVOKEINTERFACE);
+ @Deprecated
+ @Override
+ public void visitMethodInsn(
+ final int opcode, final String owner, final String name, final String descriptor) {
+ if (api >= Opcodes.ASM5) {
+ super.visitMethodInsn(opcode, owner, name, descriptor);
+ return;
}
+ doVisitMethodInsn(opcode, owner, name, descriptor, opcode == Opcodes.INVOKEINTERFACE);
+ }
- @Override
- public void visitMethodInsn(final int opcode, final String owner,
- final String name, final String desc, final boolean itf) {
- if (api < Opcodes.ASM5) {
- super.visitMethodInsn(opcode, owner, name, desc, itf);
- return;
- }
- doVisitMethodInsn(opcode, owner, name, desc, itf);
+ @Override
+ public void visitMethodInsn(
+ final int opcode,
+ final String owner,
+ final String name,
+ final String descriptor,
+ final boolean isInterface) {
+ if (api < Opcodes.ASM5) {
+ super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
+ return;
}
+ doVisitMethodInsn(opcode, owner, name, descriptor, isInterface);
+ }
- private void doVisitMethodInsn(int opcode, String owner, String name,
- String desc, boolean itf) {
- // Calling super.visitMethodInsn requires to call the correct version
- // depending on this.api (otherwise infinite loops can occur). To
- // simplify and to make it easier to automatically remove the backward
- // compatibility code, we inline the code of the overridden method here.
- // IMPORTANT: THIS ASSUMES THAT visitMethodInsn IS NOT OVERRIDDEN IN
- // LocalVariableSorter.
- if (mv != null) {
- mv.visitMethodInsn(opcode, remapper.mapType(owner),
- remapper.mapMethodName(owner, name, desc),
- remapper.mapMethodDesc(desc), itf);
- }
+ private void doVisitMethodInsn(
+ final int opcode,
+ final String owner,
+ final String name,
+ final String descriptor,
+ final boolean isInterface) {
+ // Calling super.visitMethodInsn requires to call the correct version
+ // depending on this.api (otherwise infinite loops can occur). To
+ // simplify and to make it easier to automatically remove the backward
+ // compatibility code, we inline the code of the overridden method here.
+ // IMPORTANT: THIS ASSUMES THAT visitMethodInsn IS NOT OVERRIDDEN IN
+ // LocalVariableSorter.
+ if (mv != null) {
+ mv.visitMethodInsn(
+ opcode,
+ remapper.mapType(owner),
+ remapper.mapMethodName(owner, name, descriptor),
+ remapper.mapMethodDesc(descriptor),
+ isInterface);
}
+ }
- @Override
- public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
- Object... bsmArgs) {
- for (int i = 0; i < bsmArgs.length; i++) {
- bsmArgs[i] = remapper.mapValue(bsmArgs[i]);
- }
- super.visitInvokeDynamicInsn(
- remapper.mapInvokeDynamicMethodName(name, desc),
- remapper.mapMethodDesc(desc), (Handle) remapper.mapValue(bsm),
- bsmArgs);
+ @Override
+ public void visitInvokeDynamicInsn(
+ final String name,
+ final String descriptor,
+ final Handle bootstrapMethodHandle,
+ final Object... bootstrapMethodArguments) {
+ for (int i = 0; i < bootstrapMethodArguments.length; i++) {
+ bootstrapMethodArguments[i] = remapper.mapValue(bootstrapMethodArguments[i]);
}
+ super.visitInvokeDynamicInsn(
+ remapper.mapInvokeDynamicMethodName(name, descriptor),
+ remapper.mapMethodDesc(descriptor),
+ (Handle) remapper.mapValue(bootstrapMethodHandle),
+ bootstrapMethodArguments);
+ }
- @Override
- public void visitTypeInsn(int opcode, String type) {
- super.visitTypeInsn(opcode, remapper.mapType(type));
- }
+ @Override
+ public void visitTypeInsn(final int opcode, final String type) {
+ super.visitTypeInsn(opcode, remapper.mapType(type));
+ }
- @Override
- public void visitLdcInsn(Object cst) {
- super.visitLdcInsn(remapper.mapValue(cst));
- }
+ @Override
+ public void visitLdcInsn(final Object value) {
+ super.visitLdcInsn(remapper.mapValue(value));
+ }
- @Override
- public void visitMultiANewArrayInsn(String desc, int dims) {
- super.visitMultiANewArrayInsn(remapper.mapDesc(desc), dims);
- }
+ @Override
+ public void visitMultiANewArrayInsn(final String descriptor, final int numDimensions) {
+ super.visitMultiANewArrayInsn(remapper.mapDesc(descriptor), numDimensions);
+ }
- @Override
- public AnnotationVisitor visitInsnAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- AnnotationVisitor av = super.visitInsnAnnotation(typeRef, typePath,
- remapper.mapDesc(desc), visible);
- return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitInsnAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null
+ ? annotationVisitor
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
- @Override
- public void visitTryCatchBlock(Label start, Label end, Label handler,
- String type) {
- super.visitTryCatchBlock(start, end, handler, type == null ? null
- : remapper.mapType(type));
- }
+ @Override
+ public void visitTryCatchBlock(
+ final Label start, final Label end, final Label handler, final String type) {
+ super.visitTryCatchBlock(start, end, handler, type == null ? null : remapper.mapType(type));
+ }
- @Override
- public AnnotationVisitor visitTryCatchAnnotation(int typeRef,
- TypePath typePath, String desc, boolean visible) {
- AnnotationVisitor av = super.visitTryCatchAnnotation(typeRef, typePath,
- remapper.mapDesc(desc), visible);
- return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitTryCatchAnnotation(
+ final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitTryCatchAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null
+ ? annotationVisitor
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
- @Override
- public void visitLocalVariable(String name, String desc, String signature,
- Label start, Label end, int index) {
- super.visitLocalVariable(name, remapper.mapDesc(desc),
- remapper.mapSignature(signature, true), start, end, index);
- }
+ @Override
+ public void visitLocalVariable(
+ final String name,
+ final String descriptor,
+ final String signature,
+ final Label start,
+ final Label end,
+ final int index) {
+ super.visitLocalVariable(
+ name,
+ remapper.mapDesc(descriptor),
+ remapper.mapSignature(signature, true),
+ start,
+ end,
+ index);
+ }
- @Override
- public AnnotationVisitor visitLocalVariableAnnotation(int typeRef,
- TypePath typePath, Label[] start, Label[] end, int[] index,
- String desc, boolean visible) {
- AnnotationVisitor av = super.visitLocalVariableAnnotation(typeRef,
- typePath, start, end, index, remapper.mapDesc(desc), visible);
- return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
- }
+ @Override
+ public AnnotationVisitor visitLocalVariableAnnotation(
+ final int typeRef,
+ final TypePath typePath,
+ final Label[] start,
+ final Label[] end,
+ final int[] index,
+ final String descriptor,
+ final boolean visible) {
+ AnnotationVisitor annotationVisitor =
+ super.visitLocalVariableAnnotation(
+ typeRef, typePath, start, end, index, remapper.mapDesc(descriptor), visible);
+ return annotationVisitor == null
+ ? annotationVisitor
+ : new RemappingAnnotationAdapter(annotationVisitor, remapper);
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingSignatureAdapter.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingSignatureAdapter.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingSignatureAdapter.java
old mode 100644
new mode 100755
index 74276a8..0c60a91
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingSignatureAdapter.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/RemappingSignatureAdapter.java
@@ -1,32 +1,30 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm.commons;
@@ -35,123 +33,125 @@ import org.apache.tapestry5.internal.plastic.asm.signature.SignatureVisitor;
/**
* A {@link SignatureVisitor} adapter for type mapping.
- *
+ *
* @deprecated use {@link SignatureRemapper} instead.
* @author Eugene Kuleshov
*/
@Deprecated
public class RemappingSignatureAdapter extends SignatureVisitor {
- private final SignatureVisitor v;
-
- private final Remapper remapper;
-
- private String className;
-
- public RemappingSignatureAdapter(final SignatureVisitor v,
- final Remapper remapper) {
- this(Opcodes.ASM6, v, remapper);
- }
-
- protected RemappingSignatureAdapter(final int api,
- final SignatureVisitor v, final Remapper remapper) {
- super(api);
- this.v = v;
- this.remapper = remapper;
- }
-
- @Override
- public void visitClassType(String name) {
- className = name;
- v.visitClassType(remapper.mapType(name));
- }
-
- @Override
- public void visitInnerClassType(String name) {
- String remappedOuter = remapper.mapType(className) + '$';
- className = className + '$' + name;
- String remappedName = remapper.mapType(className);
- int index = remappedName.startsWith(remappedOuter) ? remappedOuter
- .length() : remappedName.lastIndexOf('$') + 1;
- v.visitInnerClassType(remappedName.substring(index));
- }
-
- @Override
- public void visitFormalTypeParameter(String name) {
- v.visitFormalTypeParameter(name);
- }
-
- @Override
- public void visitTypeVariable(String name) {
- v.visitTypeVariable(name);
- }
-
- @Override
- public SignatureVisitor visitArrayType() {
- v.visitArrayType();
- return this;
- }
-
- @Override
- public void visitBaseType(char descriptor) {
- v.visitBaseType(descriptor);
- }
-
- @Override
- public SignatureVisitor visitClassBound() {
- v.visitClassBound();
- return this;
- }
-
- @Override
- public SignatureVisitor visitExceptionType() {
- v.visitExceptionType();
- return this;
- }
-
- @Override
- public SignatureVisitor visitInterface() {
- v.visitInterface();
- return this;
- }
-
- @Override
- public SignatureVisitor visitInterfaceBound() {
- v.visitInterfaceBound();
- return this;
- }
-
- @Override
- public SignatureVisitor visitParameterType() {
- v.visitParameterType();
- return this;
- }
-
- @Override
- public SignatureVisitor visitReturnType() {
- v.visitReturnType();
- return this;
- }
-
- @Override
- public SignatureVisitor visitSuperclass() {
- v.visitSuperclass();
- return this;
- }
-
- @Override
- public void visitTypeArgument() {
- v.visitTypeArgument();
- }
-
- @Override
- public SignatureVisitor visitTypeArgument(char wildcard) {
- v.visitTypeArgument(wildcard);
- return this;
- }
-
- @Override
- public void visitEnd() {
- v.visitEnd();
- }
+ private final SignatureVisitor signatureVisitor;
+
+ private final Remapper remapper;
+
+ private String className;
+
+ public RemappingSignatureAdapter(
+ final SignatureVisitor signatureVisitor, final Remapper remapper) {
+ this(Opcodes.ASM6, signatureVisitor, remapper);
+ }
+
+ protected RemappingSignatureAdapter(
+ final int api, final SignatureVisitor signatureVisitor, final Remapper remapper) {
+ super(api);
+ this.signatureVisitor = signatureVisitor;
+ this.remapper = remapper;
+ }
+
+ @Override
+ public void visitClassType(final String name) {
+ className = name;
+ signatureVisitor.visitClassType(remapper.mapType(name));
+ }
+
+ @Override
+ public void visitInnerClassType(final String name) {
+ String remappedOuter = remapper.mapType(className) + '$';
+ className = className + '$' + name;
+ String remappedName = remapper.mapType(className);
+ int index =
+ remappedName.startsWith(remappedOuter)
+ ? remappedOuter.length()
+ : remappedName.lastIndexOf('$') + 1;
+ signatureVisitor.visitInnerClassType(remappedName.substring(index));
+ }
+
+ @Override
+ public void visitFormalTypeParameter(final String name) {
+ signatureVisitor.visitFormalTypeParameter(name);
+ }
+
+ @Override
+ public void visitTypeVariable(final String name) {
+ signatureVisitor.visitTypeVariable(name);
+ }
+
+ @Override
+ public SignatureVisitor visitArrayType() {
+ signatureVisitor.visitArrayType();
+ return this;
+ }
+
+ @Override
+ public void visitBaseType(final char descriptor) {
+ signatureVisitor.visitBaseType(descriptor);
+ }
+
+ @Override
+ public SignatureVisitor visitClassBound() {
+ signatureVisitor.visitClassBound();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitExceptionType() {
+ signatureVisitor.visitExceptionType();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitInterface() {
+ signatureVisitor.visitInterface();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitInterfaceBound() {
+ signatureVisitor.visitInterfaceBound();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitParameterType() {
+ signatureVisitor.visitParameterType();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitReturnType() {
+ signatureVisitor.visitReturnType();
+ return this;
+ }
+
+ @Override
+ public SignatureVisitor visitSuperclass() {
+ signatureVisitor.visitSuperclass();
+ return this;
+ }
+
+ @Override
+ public void visitTypeArgument() {
+ signatureVisitor.visitTypeArgument();
+ }
+
+ @Override
+ public SignatureVisitor visitTypeArgument(final char wildcard) {
+ signatureVisitor.visitTypeArgument(wildcard);
+ return this;
+ }
+
+ @Override
+ public void visitEnd() {
+ signatureVisitor.visitEnd();
+ }
}