/**
  * @param type
  * @return a TypeAbstraction object representing this type. We just use ConeTypes by default,
  *     since we don't propagate information allowing us to distinguish between points and cones
  *     yet.
  */
 protected TypeAbstraction typeRef2TypeAbstraction(IClassHierarchy cha, TypeReference type) {
   IClass klass = cha.lookupClass(type);
   if (klass != null) {
     return new ConeType(klass);
   }
   Assertions.UNREACHABLE(type.toString());
   return null;
 }
Exemplo n.º 2
0
  private void testClassAnnotations(
      TypeReference typeUnderTest,
      Collection<Annotation> expectedRuntimeInvisibleAnnotations,
      Collection<Annotation> expectedRuntimeVisibleAnnotations)
      throws IOException, ClassHierarchyException, InvalidClassFileException {
    IClass classUnderTest = cha.lookupClass(typeUnderTest);
    Assert.assertNotNull(typeUnderTest.toString() + " not found", classUnderTest);
    Assert.assertTrue(classUnderTest instanceof ShrikeClass);
    ShrikeClass shrikeClassUnderTest = (ShrikeClass) classUnderTest;

    Collection<Annotation> runtimeInvisibleAnnotations =
        shrikeClassUnderTest.getRuntimeInvisibleAnnotations();
    assertEqualCollections(expectedRuntimeInvisibleAnnotations, runtimeInvisibleAnnotations);

    Collection<Annotation> runtimeVisibleAnnotations =
        shrikeClassUnderTest.getRuntimeVisibleAnnotations();
    assertEqualCollections(expectedRuntimeVisibleAnnotations, runtimeVisibleAnnotations);
  }