Java源码示例:proguard.optimize.evaluation.StoringInvocationUnit
示例1
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// All parameters of non-static methods are shifted by one in the local
// variable frame.
boolean isStatic =
(programMethod.getAccessFlags() & AccessConstants.STATIC) != 0;
int parameterStart = isStatic ? 0 : 1;
int parameterCount =
ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass),
isStatic);
for (int index = parameterStart; index < parameterCount; index++)
{
Value value = StoringInvocationUnit.getMethodParameterValue(programMethod, index);
if (value != null &&
value.isParticular())
{
constantParameterVisitor.visitProgramMethod(programClass, programMethod);
}
}
}
示例2
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
Value parameterValue = StoringInvocationUnit.getFieldValue(programField);
if (parameterValue.computationalType() == Value.TYPE_REFERENCE)
{
Clazz referencedClass = parameterValue.referenceValue().getReferencedClass();
if (programField.referencedClass != referencedClass)
{
if (DEBUG)
{
System.out.println("MemberDescriptorSpecializer: "+programClass.getName()+"."+programField.getName(programClass)+" "+programField.getDescriptor(programClass));
System.out.println(" "+programField.referencedClass.getName()+" -> "+referencedClass.getName());
}
programField.referencedClass = referencedClass;
// Visit the field, if required.
if (extraParameterMemberVisitor != null)
{
extraParameterMemberVisitor.visitProgramField(programClass, programField);
}
}
}
}
示例3
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// All parameters of non-static methods are shifted by one in the local
// variable frame.
int firstParameterIndex =
(programMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_STATIC) != 0 ?
0 : 1;
int parameterCount =
ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass));
for (int index = firstParameterIndex; index < parameterCount; index++)
{
Value value = StoringInvocationUnit.getMethodParameterValue(programMethod, index);
if (value != null &&
value.isParticular())
{
constantParameterVisitor.visitProgramMethod(programClass, programMethod);
}
}
}
示例4
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
Value parameterValue = StoringInvocationUnit.getFieldValue(programField);
if (parameterValue.computationalType() == Value.TYPE_REFERENCE)
{
Clazz referencedClass = parameterValue.referenceValue().getReferencedClass();
if (programField.referencedClass != referencedClass)
{
if (DEBUG)
{
System.out.println("MemberDescriptorSpecializer: "+programClass.getName()+"."+programField.getName(programClass)+" "+programField.getDescriptor(programClass));
System.out.println(" "+programField.referencedClass.getName()+" -> "+referencedClass.getName());
}
programField.referencedClass = referencedClass;
// Visit the field, if required.
if (extraParameterMemberVisitor != null)
{
extraParameterMemberVisitor.visitProgramField(programClass, programField);
}
}
}
}
示例5
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// All parameters of non-static methods are shifted by one in the local
// variable frame.
int firstParameterIndex =
(programMethod.getAccessFlags() & ClassConstants.ACC_STATIC) != 0 ?
0 : 1;
int parameterCount =
ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass));
for (int index = firstParameterIndex; index < parameterCount; index++)
{
Value value = StoringInvocationUnit.getMethodParameterValue(programMethod, index);
if (value != null &&
value.isParticular())
{
constantParameterVisitor.visitProgramMethod(programClass, programMethod);
}
}
}
示例6
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
Value parameterValue = StoringInvocationUnit.getFieldValue(programField);
if (parameterValue.computationalType() == Value.TYPE_REFERENCE)
{
Clazz referencedClass = parameterValue.referenceValue().getReferencedClass();
if (programField.referencedClass != referencedClass)
{
if (DEBUG)
{
System.out.println("MemberDescriptorSpecializer: "+programClass.getName()+"."+programField.getName(programClass)+" "+programField.getDescriptor(programClass));
System.out.println(" "+programField.referencedClass.getName()+" -> "+referencedClass.getName());
}
programField.referencedClass = referencedClass;
// Visit the field, if required.
if (extraParameterMemberVisitor != null)
{
extraParameterMemberVisitor.visitProgramField(programClass, programField);
}
}
}
}
示例7
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// All parameters of non-static methods are shifted by one in the local
// variable frame.
int firstParameterIndex =
(programMethod.getAccessFlags() & ClassConstants.ACC_STATIC) != 0 ?
0 : 1;
int parameterCount =
ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass));
for (int index = firstParameterIndex; index < parameterCount; index++)
{
Value value = StoringInvocationUnit.getMethodParameterValue(programMethod, index);
if (value != null &&
value.isParticular())
{
constantParameterVisitor.visitProgramMethod(programClass, programMethod);
}
}
}
示例8
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
Value parameterValue = StoringInvocationUnit.getFieldValue(programField);
if (parameterValue.computationalType() == Value.TYPE_REFERENCE)
{
Clazz referencedClass = parameterValue.referenceValue().getReferencedClass();
if (programField.referencedClass != referencedClass)
{
if (DEBUG)
{
System.out.println("MemberDescriptorSpecializer: "+programClass.getName()+"."+programField.getName(programClass)+" "+programField.getDescriptor(programClass));
System.out.println(" "+programField.referencedClass.getName()+" -> "+referencedClass.getName());
}
programField.referencedClass = referencedClass;
// Visit the field, if required.
if (extraParameterMemberVisitor != null)
{
extraParameterMemberVisitor.visitProgramField(programClass, programField);
}
}
}
}
示例9
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// Is the method an initializer?
if (ClassUtil.isInitializer(programMethod.getName(programClass)))
{
// Does it have exactly one parameter?
if (ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass)) == 1)
{
// Is the parameter a non-null reference?
Value value =
StoringInvocationUnit.getMethodParameterValue(programMethod, 1);
if (value != null &&
value.computationalType() == Value.TYPE_REFERENCE &&
value.referenceValue().isNotNull() == Value.ALWAYS)
{
// Does the method initialize the field?
programMethod.attributesAccept(programClass, this);
}
else
{
wrapCounter = Integer.MIN_VALUE;
}
}
else
{
wrapCounter = Integer.MIN_VALUE;
}
}
}
示例10
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
Value value = StoringInvocationUnit.getFieldValue(programField);
if (value != null &&
value.isParticular())
{
constantMemberVisitor.visitProgramField(programClass, programField);
}
}
示例11
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
Value value = StoringInvocationUnit.getMethodReturnValue(programMethod);
if (value != null &&
value.isParticular())
{
constantMemberVisitor.visitProgramMethod(programClass, programMethod);
}
}
示例12
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
Value value = StoringInvocationUnit.getFieldValue(programField);
if (value != null &&
value.isParticular())
{
constantMemberVisitor.visitProgramField(programClass, programField);
}
}
示例13
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
Value value = StoringInvocationUnit.getMethodReturnValue(programMethod);
if (value != null &&
value.isParticular())
{
constantMemberVisitor.visitProgramMethod(programClass, programMethod);
}
}
示例14
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
Value value = StoringInvocationUnit.getFieldValue(programField);
if (value != null &&
value.isParticular())
{
constantMemberVisitor.visitProgramField(programClass, programField);
}
}
示例15
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
Value value = StoringInvocationUnit.getMethodReturnValue(programMethod);
if (value != null &&
value.isParticular())
{
constantMemberVisitor.visitProgramMethod(programClass, programMethod);
}
}
示例16
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
Value value = StoringInvocationUnit.getFieldValue(programField);
if (value != null &&
value.isParticular())
{
constantMemberVisitor.visitProgramField(programClass, programField);
}
}
示例17
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
Value value = StoringInvocationUnit.getMethodReturnValue(programMethod);
if (value != null &&
value.isParticular())
{
constantMemberVisitor.visitProgramMethod(programClass, programMethod);
}
}
示例18
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// All parameters of non-static methods are shifted by one in the local
// variable frame.
boolean isStatic =
(programMethod.getAccessFlags() & AccessConstants.STATIC) != 0;
int parameterStart = isStatic ? 0 : 1;
int parameterCount =
ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass),
isStatic);
int classIndex = 0;
// Go over the parameters.
for (int parameterIndex = parameterStart; parameterIndex < parameterCount; parameterIndex++)
{
Value parameterValue = StoringInvocationUnit.getMethodParameterValue(programMethod, parameterIndex);
if (parameterValue.computationalType() == Value.TYPE_REFERENCE)
{
Clazz referencedClass = parameterValue.referenceValue().getReferencedClass();
if (programMethod.referencedClasses[classIndex] != referencedClass)
{
if (DEBUG)
{
System.out.println("MemberDescriptorSpecializer: "+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass));
System.out.println(" "+programMethod.referencedClasses[classIndex].getName()+" -> "+referencedClass.getName());
}
programMethod.referencedClasses[classIndex] = referencedClass;
// Visit the method, if required.
if (extraParameterMemberVisitor != null)
{
extraParameterMemberVisitor.visitProgramMethod(programClass, programMethod);
}
}
classIndex++;
}
}
}
示例19
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// All parameters of non-static methods are shifted by one in the local
// variable frame.
int firstParameterIndex =
(programMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_STATIC) != 0 ?
0 : 1;
int parameterCount =
ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass));
int classIndex = 0;
// Go over the parameters.
for (int parameterIndex = firstParameterIndex; parameterIndex < parameterCount; parameterIndex++)
{
Value parameterValue = StoringInvocationUnit.getMethodParameterValue(programMethod, parameterIndex);
if (parameterValue.computationalType() == Value.TYPE_REFERENCE)
{
Clazz referencedClass = parameterValue.referenceValue().getReferencedClass();
if (programMethod.referencedClasses[classIndex] != referencedClass)
{
if (DEBUG)
{
System.out.println("MemberDescriptorSpecializer: "+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass));
System.out.println(" "+programMethod.referencedClasses[classIndex].getName()+" -> "+referencedClass.getName());
}
programMethod.referencedClasses[classIndex] = referencedClass;
// Visit the method, if required.
if (extraParameterMemberVisitor != null)
{
extraParameterMemberVisitor.visitProgramMethod(programClass, programMethod);
}
}
classIndex++;
}
}
}
示例20
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// All parameters of non-static methods are shifted by one in the local
// variable frame.
int firstParameterIndex =
(programMethod.getAccessFlags() & ClassConstants.ACC_STATIC) != 0 ?
0 : 1;
int parameterCount =
ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass));
int classIndex = 0;
// Go over the parameters.
for (int parameterIndex = firstParameterIndex; parameterIndex < parameterCount; parameterIndex++)
{
Value parameterValue = StoringInvocationUnit.getMethodParameterValue(programMethod, parameterIndex);
if (parameterValue.computationalType() == Value.TYPE_REFERENCE)
{
Clazz referencedClass = parameterValue.referenceValue().getReferencedClass();
if (programMethod.referencedClasses[classIndex] != referencedClass)
{
if (DEBUG)
{
System.out.println("MemberDescriptorSpecializer: "+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass));
System.out.println(" "+programMethod.referencedClasses[classIndex].getName()+" -> "+referencedClass.getName());
}
programMethod.referencedClasses[classIndex] = referencedClass;
// Visit the method, if required.
if (extraParameterMemberVisitor != null)
{
extraParameterMemberVisitor.visitProgramMethod(programClass, programMethod);
}
}
classIndex++;
}
}
}
示例21
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
// All parameters of non-static methods are shifted by one in the local
// variable frame.
int firstParameterIndex =
(programMethod.getAccessFlags() & ClassConstants.ACC_STATIC) != 0 ?
0 : 1;
int parameterCount =
ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass));
int classIndex = 0;
// Go over the parameters.
for (int parameterIndex = firstParameterIndex; parameterIndex < parameterCount; parameterIndex++)
{
Value parameterValue = StoringInvocationUnit.getMethodParameterValue(programMethod, parameterIndex);
if (parameterValue.computationalType() == Value.TYPE_REFERENCE)
{
Clazz referencedClass = parameterValue.referenceValue().getReferencedClass();
if (programMethod.referencedClasses[classIndex] != referencedClass)
{
if (DEBUG)
{
System.out.println("MemberDescriptorSpecializer: "+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass));
System.out.println(" "+programMethod.referencedClasses[classIndex].getName()+" -> "+referencedClass.getName());
}
programMethod.referencedClasses[classIndex] = referencedClass;
// Visit the method, if required.
if (extraParameterMemberVisitor != null)
{
extraParameterMemberVisitor.visitProgramMethod(programClass, programMethod);
}
}
classIndex++;
}
}
}