Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
This module exists solely to package all other gwt modules into a single
uber jar. This makes deploying to non-mavenized targets much easier.
Of course, you would be wise to inherit your dependencies individually;
the uber jar is intended for projects like collide,
which have complex configuration, and adding many jars would be a pain.
/*
* Javassist, a Java-bytecode translator toolkit.
* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. Alternatively, the contents of this file may be used under
* the terms of the GNU Lesser General Public License Version 2.1 or later,
* or the Apache License Version 2.0.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* MODIFIED BY James Nelson of We The Internet, 2013.
* Repackaged to avoid conflicts with different versions of Javassist,
* and modified Javassist APIs to make them more accessible to outside code.
*/
package xapi.bytecode;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.Collection;
import xapi.bytecode.api.Opcode;
public abstract class CtClass {
protected String qualifiedName;
/**
* The version number of this release.
*/
public static final String version = "3.12.0.GA";
/**
* Prints the version number and the copyright notice.
*
*
The following command invokes this method:
*
*
java -jar javassist.jar
*/
public static void main(String[] args) {
System.out.println("Javassist version " + CtClass.version);
System.out.println("Copyright (C) 1999-2010 Shigeru Chiba."
+ " All Rights Reserved.");
}
static final String javaLangObject = "java.lang.Object";
/**
* The CtClass object representing
* the boolean type.
*/
public static CtClass booleanType;
/**
* The CtClass object representing
* the char type.
*/
public static CtClass charType;
/**
* The CtClass object representing
* the byte type.
*/
public static CtClass byteType;
/**
* The CtClass object representing
* the short type.
*/
public static CtClass shortType;
/**
* The CtClass object representing
* the int type.
*/
public static CtClass intType;
/**
* The CtClass object representing
* the long type.
*/
public static CtClass longType;
/**
* The CtClass object representing
* the float type.
*/
public static CtClass floatType;
/**
* The CtClass object representing
* the double type.
*/
public static CtClass doubleType;
/**
* The CtClass object representing
* the void type.
*/
public static CtClass voidType;
static CtClass[] primitiveTypes;
static {
primitiveTypes = new CtClass[9];
booleanType =
new CtPrimitiveType("boolean", 'Z', "java.lang.Boolean",
"booleanValue", "()Z", Opcode.IRETURN,
Opcode.T_BOOLEAN, 1);
primitiveTypes[0] = booleanType;
charType = new CtPrimitiveType("char", 'C', "java.lang.Character",
"charValue", "()C", Opcode.IRETURN,
Opcode.T_CHAR, 1);
primitiveTypes[1] = charType;
byteType = new CtPrimitiveType("byte", 'B', "java.lang.Byte",
"byteValue", "()B", Opcode.IRETURN,
Opcode.T_BYTE, 1);
primitiveTypes[2] = byteType;
shortType = new CtPrimitiveType("short", 'S', "java.lang.Short",
"shortValue", "()S", Opcode.IRETURN,
Opcode.T_SHORT, 1);
primitiveTypes[3] = shortType;
intType = new CtPrimitiveType("int", 'I', "java.lang.Integer",
"intValue", "()I", Opcode.IRETURN,
Opcode.T_INT, 1);
primitiveTypes[4] = intType;
longType = new CtPrimitiveType("long", 'J', "java.lang.Long",
"longValue", "()J", Opcode.LRETURN,
Opcode.T_LONG, 2);
primitiveTypes[5] = longType;
floatType = new CtPrimitiveType("float", 'F', "java.lang.Float",
"floatValue", "()F", Opcode.FRETURN,
Opcode.T_FLOAT, 1);
primitiveTypes[6] = floatType;
doubleType = new CtPrimitiveType("double", 'D', "java.lang.Double",
"doubleValue", "()D", Opcode.DRETURN,
Opcode.T_DOUBLE, 2);
primitiveTypes[7] = doubleType;
voidType = new CtPrimitiveType("void", 'V', "java.lang.Void",
null, null, Opcode.RETURN, 0, 0);
primitiveTypes[8] = voidType;
}
protected CtClass(String name) {
qualifiedName = name;
}
/**
* Converts the object to a string.
*/
@Override
public String toString() {
StringBuffer buf = new StringBuffer(getClass().getName());
buf.append("@");
buf.append(Integer.toHexString(hashCode()));
buf.append("[");
extendToString(buf);
buf.append("]");
return buf.toString();
}
/**
* Implemented in subclasses to add to the {@link #toString()} result.
* Subclasses should put a space before each token added to the buffer.
*/
protected void extendToString(StringBuffer buffer) {
buffer.append(getName());
}
/**
* Returns a ClassPool for this class.
*/
public ClassPool getClassPool() { return null; }
/**
* Returns a class file for this class.
*
*
This method is not available if isFrozen()
* is true.
*/
public ClassFile getClassFile() {
checkModify();
return getClassFile2();
}
/**
* Returns a class file for this class (read only).
* Normal applications do not need calling this method. Use
* getClassFile().
*
*
The ClassFile object obtained by this method
* is read only. Changes to this object might not be reflected
* on a class file generated by toBytecode(),
* toClass(), etc.
*
*
This method is available even if isFrozen()
* is true. However, if the class is frozen, it might be also
* pruned.
*
* @see CtClass#getClassFile()
* @see CtClass#isFrozen()
* @see CtClass#prune()
*/
public ClassFile getClassFile2() { return null; }
/**
* Returns the uniform resource locator (URL) of the class file.
*/
public URL getURL() throws NotFoundException {
throw new NotFoundException(getName());
}
/**
* Returns true if the definition of the class has been modified.
*/
public boolean isModified() { return false; }
/**
* Returns true if the class has been loaded or written out
* and thus it cannot be modified any more.
*
* @see #defrost()
* @see #detach()
*/
public boolean isFrozen() { return true; }
/**
* Makes the class frozen.
*
* @see #isFrozen()
* @see #defrost()
* @since 3.6
*/
public void freeze() {}
/* Note: this method is overridden by CtClassType
*/
void checkModify() throws RuntimeException {
if (isFrozen()) {
throw new RuntimeException(getName() + " class is frozen");
}
// isModified() must return true after this method is invoked.
}
/**
* Defrosts the class so that the class can be modified again.
*
*
To avoid changes that will be never reflected,
* the class is frozen to be unmodifiable if it is loaded or
* written out. This method should be called only in a case
* that the class will be reloaded or written out later again.
*
*
If defrost() will be called later, pruning
* must be disallowed in advance.
*
* @see #isFrozen()
* @see #stopPruning(boolean)
* @see #detach()
*/
public void defrost() {
throw new RuntimeException("cannot defrost " + getName());
}
/**
* Returns true if this object represents a primitive
* Java type: boolean, byte, char, short, int, long, float, double,
* or void.
*/
public boolean isPrimitive() { return false; }
/**
* Returns true if this object represents an array type.
*/
public boolean isArray() {
return false;
}
/**
* If this object represents an array, this method returns the component
* type of the array. Otherwise, it returns null.
* @throws NotFoundException
*/
public CtClass getComponentType() throws NotFoundException {
return null;
}
/**
* Returns true if this class extends or implements
* clazz. It also returns true if
* this class is the same as clazz.
* @throws NotFoundException
*/
public boolean subtypeOf(CtClass clazz) throws NotFoundException {
return this == clazz || getName().equals(clazz.getName());
}
/**
* Obtains the fully-qualified name of the class.
*/
public String getName() { return qualifiedName; }
/**
* Obtains the not-qualified class name.
*/
public final String getSimpleName() {
String qname = qualifiedName;
int index = qname.lastIndexOf('.');
if (index < 0) {
return qname;
} else {
return qname.substring(index + 1);
}
}
/**
* Obtains the package name. It may be null.
*/
public final String getPackageName() {
String qname = qualifiedName;
int index = qname.lastIndexOf('.');
if (index < 0) {
return null;
} else {
return qname.substring(0, index);
}
}
/**
* Sets the class name
*
* @param name fully-qualified name
*/
public void setName(String name) {
checkModify();
if (name != null) {
qualifiedName = name;
}
}
/**
* Substitutes newName for all occurrences of a class
* name oldName in the class file.
*
* @param oldName replaced class name
* @param newName substituted class name
*/
public void replaceClassName(String oldName, String newName) {
checkModify();
}
/**
* Changes class names appearing in the class file according to the
* given map.
*
*
All the class names appearing in the class file are tested
* with map to determine whether each class name is
* replaced or not. Thus this method can be used for collecting
* all the class names in the class file. To do that, first define
* a subclass of ClassMap so that get()
* records all the given parameters. Then, make an instance of
* that subclass as an empty hash-table. Finally, pass that instance
* to this method. After this method finishes, that instance would
* contain all the class names appearing in the class file.
*
* @param map the hashtable associating replaced class names
* with substituted names.
*/
public void replaceClassName(ClassMap map) {
checkModify();
}
/**
* Returns a collection of the names of all the classes
* referenced in this class.
* That collection includes the name of this class.
*
*
This method may return null.
*/
public synchronized Collection