Tabnine Logo
IField
Code IndexAdd Tabnine to your IDE (free)

How to use
IField
in
com.ibm.wala.classLoader

Best Java code snippets using com.ibm.wala.classLoader.IField (Showing top 20 results out of 315)

origin: wala/WALA

private List<IField> collectFields() {
  List<IField> fields = new ArrayList<>();
  Iterator<IClass> itr = cha.iterator();
  while (itr.hasNext()) {
    IClass cls = itr.next();
    for (IField field : cls.getAllStaticFields()) {
      if (field.getFieldTypeReference().isReferenceType()) {
        fields.add(field);
      }
    }
  }
  return fields;
}
origin: wala/WALA

@Override
public Collection<IField> getDeclaredStaticFields() {
 Set<IField> result = HashSetFactory.make();
 for (IField F : declaredFields.values()) {
  if (F.isStatic()) {
   result.add(F);
  }
 }
 return result;
}
origin: wala/WALA

@Override
public PointerKey getPointerKeyForInstanceField(InstanceKey I, IField field) {
 if (field == null) {
  throw new IllegalArgumentException("field is null");
 }
 
 
 IField resolveAgain = I.getConcreteType().getField(field.getName(), field.getFieldTypeReference().getName());
 if (resolveAgain != null) {
  field = resolveAgain;
 }
 
 return new InstanceFieldKey(I, field);
}
origin: wala/WALA

@Override
public String descString() {
  return field.getDeclaringClass().toString() + '.' + field.getName().toString();
}

origin: wala/WALA

for (IField f : klass.getDeclaredInstanceFields()) {
 int tempValue = nextLocal++;
 SSAGetInstruction G = insts.GetInstruction(statements.size(), tempValue, 1, f.getReference());
 statements.add(G);
 SSAPutInstruction P = insts.PutInstruction(statements.size(), retValue, tempValue, f.getReference());
 statements.add(P);
origin: wala/WALA

public void visitPutInternal(int rval, int ref, boolean isStatic, FieldReference field) {
 if (DEBUG) {
  System.err.println("visitPut " + field);
 }
 // skip putfields of primitive type
 if (field.getFieldType().isPrimitiveType()) {
  return;
 }
 IField f = getClassHierarchy().resolveField(field);
 if (f == null) {
  if (DEBUG) {
   System.err.println("Could not resolve field " + field);
  }
  Warnings.add(FieldResolutionFailure.create(field));
  return;
 }
 assert f.getFieldTypeReference().getName().equals(field.getFieldType().getName()) :
  "name clash of two fields with the same name but different type: " + f.getReference() + " <=> " + field;
 assert isStatic || !symbolTable.isStringConstant(ref) : "put to string constant shouldn't be allowed?";
 if (isStatic) {
  processPutStatic(rval, field, f);
 } else {
  processPutField(rval, ref, f);
 }
}
origin: com.ibm.wala/com.ibm.wala.core

private Map<PointerKey, Object> computePointerKeys(IClass klass) {
 Map<PointerKey, Object> result = HashMapFactory.make();
 if (klass.isArrayClass()) {
  ArrayClass a = (ArrayClass) klass;
  if (a.getElementClass() != null && a.getElementClass().isReferenceType()) {
   PointerKey p = pointerKeys.getPointerKeyForArrayContents(new ConcreteTypeKey(a));
   result.put(p, p);
  }
 } else {
  for (IField f : klass.getAllFields()) {
   if (!f.getFieldTypeReference().isPrimitiveType()) {
    if (f.isStatic()) {
     PointerKey p = pointerKeys.getPointerKeyForStaticField(f);
     result.put(p, p);
    } else {
     PointerKey p = pointerKeys.getPointerKeyForInstanceField(new ConcreteTypeKey(klass), f);
     result.put(p, p);
    }
   }
  }
 }
 return result;
}
origin: wala/WALA

assert(f.isStatic()) : "All fields of AndroidModelClass are expected to be static! " + f + " is not.";
final TypeReference fdType = f.getReference().getFieldType();
  final VariableKey subKey = new SSAValue.WeaklyNamedKey(fdType.getName(), "ctx" + fdType.getName().getClassName().toString());
  instance = this.pm.getUnallocated(fdType, subKey);
  final SSAInstruction getInst = instructionFactory.GetInstruction(pc, instance, f.getReference());
  this.body.addStatement(getInst);
  this.pm.setAllocation(instance, getInst);
origin: wala/WALA

@Override
public boolean shouldRefine(IField field, PointerKey basePtr, PointerKey val, IFlowLabel label, StateMachine.State state) {
 if (field == null) {
  throw new IllegalArgumentException("null field");
 }
 if (field == ArrayContents.v()) {
  return true;
 } else {
  final IClass declaringClass = field.getDeclaringClass();
  final Matcher m = refinePattern.matcher(declaringClass.toString());
  final boolean foundPattern = m.find();
  recordDecision(declaringClass, foundPattern);
  return foundPattern;
 }
}
origin: wala/WALA

 /**
  * This main program shows one example use of thread escape analysis: producing a set of fields to be monitored for a
  * dynamic race detector. The idea is that any field might have a race with two exceptions: final fields do not have
  * races since there are no writes to them, and volatile fields have atomic read and write semantics provided by the
  * VM. Hence, this piece of code produces a list of all other fields.
  */
 public static void main(String[] args) throws IOException, IllegalArgumentException, CancelException {
  String mainClassName = args[0];

  Set<JarFile> jars = HashSetFactory.make();
  for (int i = 1; i < args.length; i++) {
   jars.add(new JarFile(args[i], false));
  }

  Set<IClass> escapingTypes = (new SimpleThreadEscapeAnalysis(jars, mainClassName)).gatherThreadEscapingClasses();

  for (IClass cls : escapingTypes) {
   if (!cls.isArrayClass()) {
    for (IField f : cls.getAllFields()) {
     if (!f.isVolatile() && !f.isFinal()) {
      System.err.println(f.getReference());
     }
    }
   }
  }
 }
}
origin: wala/WALA

protected List<IField> findDeclaredField(Atom name) {
 
 List<IField> result = new ArrayList<>(1);
 
 if (instanceFields != null) {
  for (IField instanceField : instanceFields) {
   if (instanceField.getName() == name) {
    result.add(instanceField);
   }
  }
 }
 if (staticFields != null) {
  for (IField staticField : staticFields) {
   if (staticField.getName() == name) {
    result.add(staticField);
   }
  }
 }
 return result;
}
origin: wala/WALA

@Override
public SinkSpec[] getSinkSpecs() {		
  List<SinkSpec> specs = new ArrayList<>();
  Collection<IMethod> methods = cha.getPossibleTargets(StringStuff.makeMethodReference(methodSignature));
  for (IField field : fields) {
    if (!field.isFinal()) {
      for (IMethod method : methods) {
        specs.add(new StaticFieldSinkSpec(field, method));
      }
    }
  }
  return specs.toArray(new SinkSpec[] {});
}
origin: com.ibm.wala/com.ibm.wala.core

for (IField f : klass.getDeclaredInstanceFields()) {
 int tempValue = nextLocal++;
 SSAGetInstruction G = insts.GetInstruction(statements.size(), tempValue, 1, f.getReference());
 statements.add(G);
 SSAPutInstruction P = insts.PutInstruction(statements.size(), retValue, tempValue, f.getReference());
 statements.add(P);
origin: com.ibm.wala/com.ibm.wala.core

public void visitPutInternal(int rval, int ref, boolean isStatic, FieldReference field) {
 if (DEBUG) {
  System.err.println("visitPut " + field);
 }
 // skip putfields of primitive type
 if (field.getFieldType().isPrimitiveType()) {
  return;
 }
 IField f = getClassHierarchy().resolveField(field);
 if (f == null) {
  if (DEBUG) {
   System.err.println("Could not resolve field " + field);
  }
  Warnings.add(FieldResolutionFailure.create(field));
  return;
 }
 assert f.getFieldTypeReference().getName().equals(field.getFieldType().getName()) :
  "name clash of two fields with the same name but different type: " + f.getReference() + " <=> " + field;
 assert isStatic || !symbolTable.isStringConstant(ref) : "put to string constant shouldn't be allowed?";
 if (isStatic) {
  processPutStatic(rval, field, f);
 } else {
  processPutField(rval, ref, f);
 }
}
origin: wala/WALA

private Map<PointerKey, Object> computePointerKeys(IClass klass) {
 Map<PointerKey, Object> result = HashMapFactory.make();
 if (klass.isArrayClass()) {
  ArrayClass a = (ArrayClass) klass;
  if (a.getElementClass() != null && a.getElementClass().isReferenceType()) {
   PointerKey p = pointerKeys.getPointerKeyForArrayContents(new ConcreteTypeKey(a));
   result.put(p, p);
  }
 } else {
  for (IField f : klass.getAllFields()) {
   if (!f.getFieldTypeReference().isPrimitiveType()) {
    if (f.isStatic()) {
     PointerKey p = pointerKeys.getPointerKeyForStaticField(f);
     result.put(p, p);
    } else {
     PointerKey p = pointerKeys.getPointerKeyForInstanceField(new ConcreteTypeKey(klass), f);
     result.put(p, p);
    }
   }
  }
 }
 return result;
}
origin: com.ibm.wala/com.ibm.wala.dalvik

assert(f.isStatic()) : "All fields of AndroidModelClass are expected to be static! " + f + " is not.";
final TypeReference fdType = f.getReference().getFieldType();
  final VariableKey subKey = new SSAValue.WeaklyNamedKey(fdType.getName(), "ctx" + fdType.getName().getClassName().toString());
  instance = this.pm.getUnallocated(fdType, subKey);
  final SSAInstruction getInst = instructionFactory.GetInstruction(pc, instance, f.getReference());
  this.body.addStatement(getInst);
  this.pm.setAllocation(instance, getInst);
origin: com.ibm.wala/com.ibm.wala.core

@Override
public boolean shouldRefine(IField field, PointerKey basePtr, PointerKey val, IFlowLabel label, StateMachine.State state) {
 if (field == null) {
  throw new IllegalArgumentException("null field");
 }
 if (field == ArrayContents.v()) {
  return true;
 } else {
  final IClass declaringClass = field.getDeclaringClass();
  final Matcher m = refinePattern.matcher(declaringClass.toString());
  final boolean foundPattern = m.find();
  recordDecision(declaringClass, foundPattern);
  return foundPattern;
 }
}
origin: wala/WALA

@Override
public String descString() {
  return field.getDeclaringClass().toString() + '.' + field.getName().toString();
}

origin: com.ibm.wala/com.ibm.wala.core

protected List<IField> findDeclaredField(Atom name) {
 
 List<IField> result = new ArrayList<>(1);
 
 if (instanceFields != null) {
  for (IField instanceField : instanceFields) {
   if (instanceField.getName() == name) {
    result.add(instanceField);
   }
  }
 }
 if (staticFields != null) {
  for (IField staticField : staticFields) {
   if (staticField.getName() == name) {
    result.add(staticField);
   }
  }
 }
 return result;
}
origin: wala/WALA

public IUnaryFlowFunction makeStaticFieldTaints(
    BasicBlockInContext<E> dest, SSAInstruction inst, final PairBasedFlowFunction<E> flowFunction) {
  final Set<DomainElement> elts = HashSetFactory.make();
  for (CodeElement ce : getStaticFieldAccessCodeElts((SSAGetInstruction) inst)) {
    StaticFieldElement sfe = (StaticFieldElement) ce;
    IField field = pa.getClassHierarchy().resolveField(sfe.getRef());
    if (field.isFinal()) {
      continue;
    }
    final StaticFieldFlow<E> taintSource = new StaticFieldFlow<>(dest,
        field, true);
    elts.add(new DomainElement(ce, taintSource));
  }
  IUnaryFlowFunction newTaints = new ConstantFlowFunction<>(domain, elts);
  return compose(flowFunction, newTaints);
}
com.ibm.wala.classLoaderIField

Most used methods

  • getFieldTypeReference
  • getReference
  • isStatic
  • getName
  • getDeclaringClass
  • isFinal
    Is this field final?
  • getAnnotations
  • isVolatile
    Is this member volatile?

Popular in Java

  • Running tasks concurrently on multiple threads
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • getSupportFragmentManager (FragmentActivity)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • JFileChooser (javax.swing)
  • JTable (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now