Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 614: Theory and Construction of Compilers Lecture 18 Fall 2003 Department of Computer Science University of Alabama Joel Jones.

Similar presentations


Presentation on theme: "CS 614: Theory and Construction of Compilers Lecture 18 Fall 2003 Department of Computer Science University of Alabama Joel Jones."— Presentation transcript:

1 CS 614: Theory and Construction of Compilers Lecture 18 Fall 2003 Department of Computer Science University of Alabama Joel Jones

2 Lecture 18©2003 Joel Jones2 Overview Basic concepts of using Eclipse Basic concepts of developing Eclipse plug-ins Project

3 Lecture 18©2003 Joel Jones3 Basic Eclipse Components Workbench desktop development environment Perspectives contain view and editors and control what appears in menus and tool bars Resources collective term for projects, folders and files in the workbench Navigator view provides hierarchical view of resources and open them for editing Markers are associated with resources—tasks, problems, errors, warnings, information, bookmarks Help is available through Help > Help Contents menu

4 Lecture 18©2003 Joel Jones4 Java Development By itself, Eclipse does little, but is extended by plug-ins, notably Java Development Toolkit (jdt) Project contains resources, first step in writing a Java program is creating a project JDT provides several Java perspectives with Java source editors, Java views (packages, methods and fields of classes, debugging, etc.)

5 Lecture 18©2003 Joel Jones5 Java Editor Quick Fix marker to active a choice of fixes to code Templates menu item to generate common source code patterns such as iterating over an array Refactoring menu items to make high- level changes to source code, possibly involving multiple resources (classes)

6 Lecture 18©2003 Joel Jones6 JDT Plug-in Development Core “headless” code for manipulating data structures representing user’s program (org.eclipse.jdt.core) IJavaModel, IJavaProject, IPackageFramentRoot, IPackageFragment, ICompilationUnit, IPackageDeclaration, IImportContainer, IImportDeclaration, IType,IField, IMethod, IInitializer, IClassFile Note that it doesn’t represent the contents of a method. For that we need org.eclipse.jdt.core.dom.AST UI code for manipulating Java perspective (org.eclipse.jdt.ui)

7 Lecture 18©2003 Joel Jones7 Java Class java.util.Hashtable Maps keys to values (both key and value must be objects, not primitives) Keys must implement the hashCode and equals methods However, java.lang.Object implements both of these, so by default all objects implement these two methods The notion of equality implemented by Object is object identity, not value equality That is, (new Foo(4)).equals(new Foo(4)) is by default not true So, value objects usually implement equals if two distinct objects are “equals” if their values are the same If “equals” is implemented, then “hashCode” must also be implemented (especially not “hashcode”)

8 Lecture 18©2003 Joel Jones8 Project Write Eclipse JDT plug-in validates use of Hashtable Detect all classes that are used as keys to Hashtable For each of these, if equals is implemented, make sure hashCode (with correct signature) is implemented


Download ppt "CS 614: Theory and Construction of Compilers Lecture 18 Fall 2003 Department of Computer Science University of Alabama Joel Jones."

Similar presentations


Ads by Google