Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 219377

Summary: Unused imports in Java EE plugins
Product: [WebTools] Web Tools Reporter: Carl Anderson <ccc>
Component: J2EE Standard ToolsAssignee: Carl Anderson <ccc>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: kaloyan
Version: 3.0   
Target Milestone: 3.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 197531    
Bug Blocks:    
Attachments:
Description Flags
Add the default compiler prefs & fixes none

Description Carl Anderson CLA 2008-02-19 01:15:07 EST
A year ago, we worked to reduce the number of warnings in WTP.  Since then, some of them have crept back in.  The most obvious one of these is the occurrence of unused imports.

At the beginning of WTP 3.0 development, we went through and put in default compiler settings for some of the WTP plugins - see bug 197531.  I am going to put these same defaults in for the various plugins that have unused imports.
Comment 1 Carl Anderson CLA 2008-02-19 01:21:42 EST
This may seem like a minor issue, but it actually impacts some adopter's development environments- in order to improve performance and reduce code size, unused imports are marked as errors in the workspace preferences.  This means that when they pull in the WTP code to work on a patch for a problem, errors show up.  Normally, I wouldn't worry about that, but since we should have fixed these anyway, we should do this now.

Also, by setting compiler preferences at a plugin level it ensures that, even if an adopter product has different settings, WTP code that is pulled in will compile with the settings that we need/desire.

Furthermore, by setting various items as errors now, it will ensure that this sort of thing does not creep back into WTP.
Comment 2 Carl Anderson CLA 2008-02-19 11:19:43 EST
Created attachment 90078 [details]
Add the default compiler prefs & fixes

I had to remove:
org.eclipse.jdt.core.compiler.problem.discouragedReference=error

And I had to remove the unused imports and local variables and private methods.

This hit a lot of code, but other than a bug that was uncovered in JavaEEEMFArchiveAdapterHelper (where the unused local variables needed to be used), the functionality and code paths should remain unchanged.  (Which should be obvious, since removing unused code and variables should not effect anything.)
Comment 3 Kaloyan Raev CLA 2008-02-20 03:02:30 EST
Carl, thanks you for the note and taking care of this. 
I am perfectly OK with the suggested changes. Please, go on. 
Comment 4 Carl Anderson CLA 2008-02-20 11:21:05 EST
Committed to HEAD

Note- more unused imports had been committed, so there were a few additional classes changed to keep from causing build errors.