@Override public String getSourceFileName() { return realType.getSourceFileName(); }
@Override public String getSourceFileName() { return realType.getSourceFileName(); }
File workingDir = new File(receiver.getSourceFileName()).getParentFile(); SourceModule sourceModule = resolve(rootDir, workingDir, target); if (previouslyRequired.containsKey(sourceModule.getClassName())) {
@Test public void testHello() throws ClassHierarchyException, IOException { if (analyzingJar()) return; AnalysisScope scope = null; scope = AnalysisScopeReader.readJavaScope(TestConstants.HELLO, null, MY_CLASSLOADER); // TODO: it's annoying to have to build a class hierarchy here. // see feature 38676 ClassHierarchy cha = ClassHierarchyFactory.make(scope); TypeReference t = TypeReference.findOrCreate(scope.getApplicationLoader(), TestConstants.HELLO_MAIN); IClass klass = cha.lookupClass(t); Assert.assertTrue("failed to load " + t, klass != null); String sourceFile = klass.getSourceFileName(); System.err.println("Source file: " + sourceFile); Assert.assertTrue(sourceFile != null); }
@Test public void testFromJar() throws ClassHierarchyException, IOException { if (analyzingJar()) return; AnalysisScope scope = null; scope = AnalysisScopeReader.readJavaScope(TestConstants.HELLO, null, MY_CLASSLOADER); // TODO: it's annoying to have to build a class hierarchy here. // open a feature to fix this ClassHierarchy cha = ClassHierarchyFactory.make(scope); TypeReference t = TypeReference.findOrCreate(scope.getPrimordialLoader(), CLASS_IN_PRIMORDIAL_JAR); IClass klass = cha.lookupClass(t); Assert.assertTrue(klass != null); String sourceFile = klass.getSourceFileName(); Assert.assertTrue(sourceFile != null); System.err.println("Source file: " + sourceFile); Module container = ((BytecodeClass<?>)klass).getContainer(); Assert.assertTrue(container != null); System.err.println("container: " + container); } }