Pages

Wednesday, October 31, 2012

Eclipse ICompilationUnit

Compared to concrete class CompilationUnit, ICompilation is an interface as the "I" prepended. Screen Shot 2012 10 31 at 9 36 38 AM
It's for Type representation where as CompilationUnit is for AST representation, and parser object links between the two using Parser#setSource(ICompilationUnit); and parser.createAST(null).

In order to get the ICompilationUnit from java source code, you need to start from Workspace, IProject, IJavaProject and then find IType(The by using findType(TYPE_NAME).

References

No comments:

Post a Comment