Marking of this project

You need to present your work in person to me. We will run similarity check between all the submissions, including the ones in the past and the solution from professionals. There will be zero tolerance for plagiarism. There will not be any partial marks for this project.

Due date

This assignment is worth 5 points. You need to submit your report before November 29, 11:00 AM, then present your work to me in person before 4pm the same day. In your presentation you need to explain the details and run a live demo. Submissions without presentation will receive zero mark.

This assignment is meant to be a complicated one. You need to spend long hours to get familiar with JDT, Eclipse, and Eclipse plug-in.

There are different ways to count the methods and classes. For instance, we see that polymophic methods are treated as either equally or differently. Both implementations will be considered acceptable, although our prefeered solution is to treat polymorphic methods as different ones.

The numbers can be also slightly different depending on your way to visit these AST nodes. Using SimpleName and MethodInvocation can cause slight difference. Either way is considered correct.

The problem

Your task is to analyse Java source code so that you can count all the method calls in JDK (src.zip) (Java Development Kit). This zip file contains 7471 java files, 371k lines of code. Among all these java files, For instance, when you see the following statement,
 aString.toUpperCase();
The String class receives one more method call, and the toUpperCase() method is used one more time. The object 'aString' can be of any name, and you should not count the occurrence of variable names. You need to utilize the parsing result to infer that it is of type String. To avoid name conflict, you should use the complete package path in your program and in your report. For example, String should be written as "java.lang.String", toUpperCase should be "java.lang.String.toUpperCase()".

Method

You need to parse the source code so that you can extract the relevant information. You can choose one of the existing Java parsers. One choice is Eclipse JDT that can generate an AST (abstract syntax tree). It won't suffice to manipilate the source code directly using tools such as regular expression. One reason is that there are comments, which can be very complex and can contain code snippets. In addition, there are a few other cases you need to consider:

What to submit

Submit one zipped file that contains the following files:

Hints on using JDT

JDT resources