use of org.jf.smalidea.psi.impl.SmaliClassTypeElement in project smali by JesusFreke.
the class ClassReferenceTest method testJavaReferenceFromSmaliInDumbMode.
/**
* Test a reference to a java class from a smali class, while in dumb mode
*/
public void testJavaReferenceFromSmaliInDumbMode() throws Exception {
SmaliClassTypeElement typeElement = (SmaliClassTypeElement) configureByFileText(".class public Lblah; .super L<ref>java/lang/Object;", "blah.smali");
Assert.assertNotNull(typeElement);
Assert.assertEquals("Object", typeElement.getName());
DumbServiceImpl.getInstance(getProject()).setDumb(true);
PsiClass psiClass = typeElement.resolve();
Assert.assertNull(psiClass);
DumbServiceImpl.getInstance(getProject()).setDumb(false);
}
use of org.jf.smalidea.psi.impl.SmaliClassTypeElement in project smali by JesusFreke.
the class ClassReferenceTest method testSmaliReferenceFromSmali.
/**
* Test a reference to a smali class from a smali class
*/
public void testSmaliReferenceFromSmali() throws Exception {
createFile("blarg.smali", ".class public Lblarg; .super Ljava/lang/Object;");
SmaliClassTypeElement typeElement = (SmaliClassTypeElement) configureByFileText(".class public Lblah; .super L<ref>blarg;", "blah.smali");
Assert.assertEquals("blarg", typeElement.getName());
SmaliClass smaliClass = (SmaliClass) typeElement.resolve();
Assert.assertNotNull(smaliClass);
Assert.assertEquals("blarg", smaliClass.getQualifiedName());
JavaResolveResult resolveResult = typeElement.advancedResolve(false);
Assert.assertNotNull(resolveResult.getElement());
Assert.assertEquals("blarg", ((PsiClass) resolveResult.getElement()).getQualifiedName());
JavaResolveResult[] resolveResults = typeElement.multiResolve(false);
Assert.assertEquals(1, resolveResults.length);
Assert.assertNotNull(resolveResults[0].getElement());
Assert.assertEquals("blarg", ((PsiClass) resolveResults[0].getElement()).getQualifiedName());
}
use of org.jf.smalidea.psi.impl.SmaliClassTypeElement in project smali by JesusFreke.
the class ClassReferenceTest method testJavaReferenceFromSmali.
/**
* Test a reference to a java class from a smali class
*/
public void testJavaReferenceFromSmali() throws Exception {
SmaliClassTypeElement typeElement = (SmaliClassTypeElement) configureByFileText(".class public Lblah; .super L<ref>java/lang/Object;", "blah.smali");
Assert.assertNotNull(typeElement);
Assert.assertEquals("Object", typeElement.getName());
PsiClass psiClass = typeElement.resolve();
Assert.assertNotNull(psiClass);
Assert.assertEquals("java.lang.Object", psiClass.getQualifiedName());
JavaResolveResult resolveResult = typeElement.advancedResolve(false);
Assert.assertNotNull(resolveResult.getElement());
Assert.assertEquals("java.lang.Object", ((PsiClass) resolveResult.getElement()).getQualifiedName());
JavaResolveResult[] resolveResults = typeElement.multiResolve(false);
Assert.assertEquals(1, resolveResults.length);
Assert.assertNotNull(resolveResults[0].getElement());
Assert.assertEquals("java.lang.Object", ((PsiClass) resolveResults[0].getElement()).getQualifiedName());
}
Aggregations