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

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

Best Java code snippets using com.ibm.wala.classLoader.IField.getFieldTypeReference (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

public InstanceFieldKeyWithFilter(IClassHierarchy cha, InstanceKey instance, IField field) {
 super(instance, field);
 if (field == null) {
  throw new IllegalArgumentException("field is null");
 }
 if (cha == null) {
  throw new IllegalArgumentException("cha is null");
 }
 IClass fieldType = cha.lookupClass(field.getFieldTypeReference());
 if (fieldType == null) {
  // TODO: assertions.unreachable()
  this.filter = cha.lookupClass(TypeReference.JavaLangObject);
 } else {
  this.filter = fieldType;
 }
}
origin: com.ibm.wala/com.ibm.wala.core

public InstanceFieldKeyWithFilter(IClassHierarchy cha, InstanceKey instance, IField field) {
 super(instance, field);
 if (field == null) {
  throw new IllegalArgumentException("field is null");
 }
 if (cha == null) {
  throw new IllegalArgumentException("cha is null");
 }
 IClass fieldType = cha.lookupClass(field.getFieldTypeReference());
 if (fieldType == null) {
  // TODO: assertions.unreachable()
  this.filter = cha.lookupClass(TypeReference.JavaLangObject);
 } else {
  this.filter = fieldType;
 }
}
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: com.ibm.wala/com.ibm.wala.core

@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

if (field != null && field.getFieldTypeReference().getName().equals(type)) {
 return field;
} else {
 if (f.getFieldTypeReference().getName().equals(type)) {
  return f;
origin: com.ibm.wala/com.ibm.wala.core

if (field != null && field.getFieldTypeReference().getName().equals(type)) {
 return field;
} else {
 if (f.getFieldTypeReference().getName().equals(type)) {
  return 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

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

final TypeReference fieldTypeRef = field.getFieldTypeReference();
elts.add(new FieldElement(ik, field.getReference()));
final IClass fieldClass = analysisContext.getClassHierarchy().lookupClass(fieldTypeRef);
origin: com.ibm.wala/com.ibm.wala.core

private IClass inferType(PointerKey key) {
 if (key instanceof LocalPointerKeyWithFilter) {
  LocalPointerKeyWithFilter lpk = (LocalPointerKeyWithFilter) key;
  FilteredPointerKey.TypeFilter filter = lpk.getTypeFilter();
  assert filter instanceof FilteredPointerKey.SingleClassFilter;
  return ((FilteredPointerKey.SingleClassFilter) filter).getConcreteType();
 } else if (key instanceof StaticFieldKey) {
  StaticFieldKey s = (StaticFieldKey) key;
  return getCallGraph().getClassHierarchy().lookupClass(s.getField().getFieldTypeReference());
 } else if (key instanceof InstanceFieldKey) {
  InstanceFieldKey i = (InstanceFieldKey) key;
  return getCallGraph().getClassHierarchy().lookupClass(i.getField().getFieldTypeReference());
 } else if (key instanceof ArrayContentsKey) {
  ArrayContentsKey i = (ArrayContentsKey) key;
  FilteredPointerKey.TypeFilter filter = i.getTypeFilter();
  assert filter instanceof FilteredPointerKey.SingleClassFilter;
  return ((FilteredPointerKey.SingleClassFilter) filter).getConcreteType();
 } else if (key instanceof ExceptionReturnValueKey) {
  return getCallGraph().getClassHierarchy().lookupClass(TypeReference.JavaLangException);
 } else if (key instanceof ReturnValueKey) {
  ReturnValueKey r = (ReturnValueKey) key;
  return getCallGraph().getClassHierarchy().lookupClass(r.getNode().getMethod().getReturnType());
 } else {
  Assertions.UNREACHABLE("inferType " + key.getClass());
  return null;
 }
}
origin: wala/WALA

private IClass inferType(PointerKey key) {
 if (key instanceof LocalPointerKeyWithFilter) {
  LocalPointerKeyWithFilter lpk = (LocalPointerKeyWithFilter) key;
  FilteredPointerKey.TypeFilter filter = lpk.getTypeFilter();
  assert filter instanceof FilteredPointerKey.SingleClassFilter;
  return ((FilteredPointerKey.SingleClassFilter) filter).getConcreteType();
 } else if (key instanceof StaticFieldKey) {
  StaticFieldKey s = (StaticFieldKey) key;
  return getCallGraph().getClassHierarchy().lookupClass(s.getField().getFieldTypeReference());
 } else if (key instanceof InstanceFieldKey) {
  InstanceFieldKey i = (InstanceFieldKey) key;
  return getCallGraph().getClassHierarchy().lookupClass(i.getField().getFieldTypeReference());
 } else if (key instanceof ArrayContentsKey) {
  ArrayContentsKey i = (ArrayContentsKey) key;
  FilteredPointerKey.TypeFilter filter = i.getTypeFilter();
  assert filter instanceof FilteredPointerKey.SingleClassFilter;
  return ((FilteredPointerKey.SingleClassFilter) filter).getConcreteType();
 } else if (key instanceof ExceptionReturnValueKey) {
  return getCallGraph().getClassHierarchy().lookupClass(TypeReference.JavaLangException);
 } else if (key instanceof ReturnValueKey) {
  ReturnValueKey r = (ReturnValueKey) key;
  return getCallGraph().getClassHierarchy().lookupClass(r.getNode().getMethod().getReturnType());
 } else {
  Assertions.UNREACHABLE("inferType " + key.getClass());
  return null;
 }
}
origin: wala/WALA

FlowType<E> flow = new StaticFieldFlow<>(block, field, true);
TypeReference typeRef = field.getFieldTypeReference();
origin: com.ibm.wala/com.ibm.wala.cast.js

@Override
public void visitAstGlobalWrite(AstGlobalWrite instruction) {
 int rval = instruction.getVal();
 FieldReference field = makeNonGlobalFieldReference(instruction.getDeclaredField());
 IField f = getClassHierarchy().resolveField(field);
 assert f != null : "could not resolve referenced global " + field;
 assert !f.getFieldTypeReference().isPrimitiveType();
 InstanceKey globalObj = getBuilder().getGlobalObject(JavaScriptTypes.jsName);
 system.findOrCreateIndexForInstanceKey(globalObj);
 PointerKey p = getPointerKeyForInstanceField(globalObj, f);
 PointerKey rvalKey = getPointerKeyForLocal(rval);
 if (contentsAreInvariant(symbolTable, du, rval)) {
  system.recordImplicitPointsToSet(rvalKey);
  InstanceKey[] ik = getInvariantContents(rval);
  for (InstanceKey element : ik) {
   system.newConstraint(p, element);
  }
 } else {
  system.newConstraint(p, assignOperator, rvalKey);
 }
}
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: wala/WALA

@Override
public void visitAstGlobalWrite(AstGlobalWrite instruction) {
 int rval = instruction.getVal();
 FieldReference field = makeNonGlobalFieldReference(instruction.getDeclaredField());
 IField f = getClassHierarchy().resolveField(field);
 assert f != null : "could not resolve referenced global " + field;
 assert !f.getFieldTypeReference().isPrimitiveType();
 InstanceKey globalObj = getBuilder().getGlobalObject(JavaScriptTypes.jsName);
 system.findOrCreateIndexForInstanceKey(globalObj);
 PointerKey p = getPointerKeyForInstanceField(globalObj, f);
 PointerKey rvalKey = getPointerKeyForLocal(rval);
 if (contentsAreInvariant(symbolTable, du, rval)) {
  system.recordImplicitPointsToSet(rvalKey);
  InstanceKey[] ik = getInvariantContents(rval);
  for (InstanceKey element : ik) {
   system.newConstraint(p, element);
  }
 } else {
  system.newConstraint(p, assignOperator, rvalKey);
 }
}
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

 @Test public void testDupFieldNames() throws IOException, ClassHierarchyException {
  AnalysisScope scope = null;
  scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), DupFieldsTest.class.getClassLoader());
  ClassHierarchy cha = ClassHierarchyFactory.make(scope);
  TypeReference ref = TypeReference.findOrCreate(ClassLoaderReference.Application, "LDupFieldName");
  IClass klass = cha.lookupClass(ref);
  boolean threwException = false;
  try {
   klass.getField(Atom.findOrCreateUnicodeAtom("a"));
  } catch (IllegalStateException e) {
   threwException = true;
  }
  Assert.assertTrue(threwException);    
  IField f = cha.resolveField(FieldReference.findOrCreate(ref, Atom.findOrCreateUnicodeAtom("a"), TypeReference.Int));
  Assert.assertEquals(f.getFieldTypeReference(), TypeReference.Int);
  f = cha.resolveField(FieldReference.findOrCreate(ref, Atom.findOrCreateUnicodeAtom("a"), TypeReference.Boolean));
  Assert.assertEquals(f.getFieldTypeReference(), TypeReference.Boolean);
 }
}
origin: com.ibm.wala/com.ibm.wala.core

public void processPutField(int rval, int ref, IField f) {
 assert !f.getFieldTypeReference().isPrimitiveType();
 PointerKey refKey = getPointerKeyForLocal(ref);
 PointerKey rvalKey = getPointerKeyForLocal(rval);
origin: wala/WALA

public void processPutField(int rval, int ref, IField f) {
 assert !f.getFieldTypeReference().isPrimitiveType();
 PointerKey refKey = getPointerKeyForLocal(ref);
 PointerKey rvalKey = getPointerKeyForLocal(rval);
com.ibm.wala.classLoaderIFieldgetFieldTypeReference

Popular methods of IField

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

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Permission (java.security)
    Legacy security code; do not use.
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JComboBox (javax.swing)
  • Top 12 Jupyter Notebook extensions
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