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

Bug 311325

Summary: Inconsistent use of Java 5, too many warnings
Product: z_Archived Reporter: Igor Jacy Lino Campista <icampista>
Component: MylynAssignee: Holger Voormann <eclipse>
Status: CLOSED FIXED QA Contact: David Williams <david_williams>
Severity: normal    
Priority: P3 CC: d_a_carver, eclipse, florian
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Patch that fixes 549 warnings, clarifies interfaces and simplifies many lines of code.
none
Patch that fixes 333 warnings, clarifies interfaces and simplifies many lines of code.
d_a_carver: iplog+
Patch that fixes 333 warnings, clarifies interfaces and simplifies many lines of code.
eclipse: iplog+
Igor's patch reviewed
none
more use or generics and 52 warning fixes
none
more use of generics and 52 warning fixes
none
2nd patch that fixes 52 warnings, more generics updates , replace some deprecated apis, plugin build/localization corrections eclipse: iplog+

Description Igor Jacy Lino Campista CLA 2010-05-02 18:43:53 EDT
During my investigation of some bugs I realized......

There are currently about 2473 warnings in the eclipse problems view. (848 if disabling serialization and discouraged API warnings)


Going through several classes of code, I realized many parts of the code are in a bit of a mess, which in some cases makes it hard to understand the logic behind something or makes it harder to extend and/or maintain.

The VEX DOM (EMF) generated code is Java 5 compliant, in comparison with a big amount of classes that are still in Java 1.4 constructs. Does not mix that well.
Comment 1 Igor Jacy Lino Campista CLA 2010-05-02 18:46:29 EDT
Created attachment 166742 [details]
Patch that fixes 549 warnings, clarifies interfaces and simplifies many lines of code.



So.... what started as a bit of updating, end up in a big update of as much as I could, leaving modified things backwards compatible, leaving untouched what I was not sure or did not make sense (left some comments in the few places(5 or so) ).


After my big update, 1938 warnings are appearing in the eclipse problems view. (299 if disabling serialization and discouraged API warnings)

So 549 warnings less. And in most cases code is reduced by half or more and of course is much more clear.  Everything is compiling fine, all JUnit tests are green.

Cheers,
Igor

PS: I notice some detail of the EMF model that perhaps needs a correction. Validator.getValidRootElements() seems like it should return a Set<String>
Comment 2 Holger Voormann CLA 2010-05-03 13:19:48 EDT
(In reply to comment #1)

Thank you for the patch.

Unfortunately, it seems the patch is not against CVS head, for instance the last change of ListenerList took place 18th Februar 2010.
Could you please update and contribute this patch again?
Comment 3 Igor Jacy Lino Campista CLA 2010-05-03 14:14:30 EDT
Created attachment 166821 [details]
Patch that fixes 333 warnings, clarifies interfaces and simplifies many lines of code.


oh man, that was the reason of the date. :(

ok, adapted to the trunk. 

The trunk had less warnings, but still got several things improved.
Comment 4 Igor Jacy Lino Campista CLA 2010-05-03 14:15:08 EDT
warnings before the patch: 442

warnings after the patch: 109
Comment 5 Igor Jacy Lino Campista CLA 2010-05-05 06:35:00 EDT
I left out tests cleaning on purpose.

When the patch (333 warning fixes) will be taken,  I have a 2nd patch that improves the Box interface further and also cleans some tests.
Comment 6 Florian Thienel CLA 2010-05-05 16:40:23 EDT
+1 for the second patch, a big step towards the goal of 0 warnings
Comment 7 David Carver CLA 2010-05-05 16:49:32 EDT
(In reply to comment #6)
> +1 for the second patch, a big step towards the goal of 0 warnings

Due to the size of the patch, I suspect we will have to send through IP review just to be safe.  Shouldn't take long for it go through the review.

Holger or FTL do yo you guys want to submit the appropriate CQ?   It'll be a good learning process.
Comment 8 Holger Voormann CLA 2010-05-05 16:56:47 EDT
(In reply to comment #7)
> Holger or FTL do yo you guys want to submit the appropriate CQ?   It'll be a
> good learning process.

Yes, but what's the next step for me? Should I review it or added it to the IP log first?
Comment 9 David Carver CLA 2010-05-05 17:22:04 EDT
(In reply to comment #8)
> (In reply to comment #7)
> > Holger or FTL do yo you guys want to submit the appropriate CQ?   It'll be a
> > good learning process.
> 
> Yes, but what's the next step for me? Should I review it or added it to the IP
> log first?

Need to review it, FTL and I discussed on IRC that we may want to break the patch down into smaller patches, just to make it easier to deal with.  Make sure appropriate header information is updated as well, with bug number in each file that was touched.
Comment 10 Holger Voormann CLA 2010-05-05 17:47:01 EDT
(In reply to comment #9)
> Need to review it, FTL and I discussed on IRC that we may want to break the
> patch down into smaller patches, just to make it easier to deal with.  Make
> sure appropriate header information is updated as well, with bug number in each
> file that was touched.
>
Okay. Smaller patches (per plug-in?) would be nice. I will review the first part at Friday.
Comment 11 Igor Jacy Lino Campista CLA 2010-05-06 00:37:45 EDT
I have notice two files that perhaps were the byproduct of switching to the HEAD.

src/org/eclipse/wst/xml/vex/core/internal/validator/DFAState.java (-114 lines) 
src/org/eclipse/wst/xml/vex/core/internal/validator/DTDValidator.java (-330 lines) 

Looks like they were removed since December and no are no more in the HEAD but they were by some reason registered in the patch in removed state.
Comment 12 Igor Jacy Lino Campista CLA 2010-05-06 01:04:02 EDT
Created attachment 167261 [details]
 Patch that fixes 333 warnings, clarifies interfaces and simplifies many lines of code.   

For the sake of completeness, removed the 2 file side-effect parts. File size was 14% reduced :)
Comment 13 Holger Voormann CLA 2010-05-07 15:07:16 EDT
Created attachment 167543 [details]
Igor's patch reviewed

(In reply to comment #12)
Patch reviewed: looks good :-)

Minor changes:
* SacFactory no longer exists
* DomConfigurationElement#62:
     return children.toArray(new IConfigElement[]{});
  => return children.toArray(new IConfigElement[children.size()]);
* "Association" and corresponding test deleted (seems to be dead code)

The size of the patch is greater than 200 lines but less than 250 lines which have been changed or deleted: so the patch must not go through IP.

As soon as Dave succeeded (http://intellectualcramps.blogspot.com/2010/05/build-stress-relief.html) in CI (https://build.eclipse.org/hudson/view/WTP/job/cbi-wtp-inc.vex/) and Chuck is happy again I will apply the patch. ;-)

Igor, thank you very much for cleaning-up the code! :-)))
Comment 14 Holger Voormann CLA 2010-05-09 03:57:21 EDT
(In reply to comment #13)
Patch applied in HEAD

(In reply to comment #5)
> ...
> When the patch (333 warning fixes) will be taken,
> I have a 2nd patch...
I'm leaving this bug open for the 2nd patch.

Thx again for this improvement, Igor.
Comment 15 Igor Jacy Lino Campista CLA 2010-05-09 17:41:03 EDT
Created attachment 167634 [details]
more use or generics and 52 warning fixes


Includes several generic usage updates, replaced some deprecated methods, Validator.rootElements signature correction and several warning fixes in test plugins (including missing localization settings).

27 warnings are missing (not including serialization or API restriction), they are very difficult to corrent since they are coming from Eclipse API not using generics or deprecated methods with replacement not clear to me.  -> I think already out of the scope of this bug ;)
Comment 16 Igor Jacy Lino Campista CLA 2010-05-09 17:57:43 EDT
Created attachment 167635 [details]
 more use of generics and 52 warning fixes
Comment 17 Igor Jacy Lino Campista CLA 2010-05-09 18:02:10 EDT
(In reply to comment #16)
> Created an attachment (id=167635) [details]
>  more use of generics and 52 warning fixes



2 additional comments to the 2nd patch:

1) I don't understand why the TableLayoutTest.java has (-244 / +243 lines), there were some 6-8 line changes, but "Create Patch..." choses to include the whole file.

2) The AbstractAddRowHandler.java had a bit more refactoring to extract the concept of RowCell. I could simplify more the lines 90-98 but chose not to since I don't know if the list changes.
Comment 18 Florian Thienel CLA 2010-05-10 16:05:58 EDT
(In reply to comment #17)
> 2) The AbstractAddRowHandler.java had a bit more refactoring to extract the
> concept of RowCell. I could simplify more the lines 90-98 but chose not to
> since I don't know if the list changes.
The refactoring of AbstractAddRowHandler is definitely more complex than the most of the other changes in the patches. Igor, could you enter an own issue with a description of what should be done, to separate this refactoring from the other, more simple changes? There should also be a unit test to ensure that the logic is not changed.

Igor, you did a great job cleaning up the code base. I really like what you contributed so far. Do you want to be a committer for Vex?
Comment 19 Igor Jacy Lino Campista CLA 2010-05-11 16:09:01 EDT
Created attachment 168023 [details]
2nd patch that fixes 52 warnings, more generics updates , replace some deprecated apis, plugin build/localization corrections


AbstractAddRowHandler has now basic generics update. (a separate bug will be created for the more complex refactoring :)
Comment 20 Igor Jacy Lino Campista CLA 2010-05-11 16:37:08 EDT
(In reply to comment #18)

I have created a separate bug with the patch for the AbstractAddRowHandler simplification at https://bugs.eclipse.org/bugs/show_bug.cgi?id=312502


I also re-created the 2nd patch without the simplification (only the generics update).


Thanks, I really want to get VEX going and improving. I would gladly like to be a committer, is there special/particular expectations on that?
Comment 21 Florian Thienel CLA 2010-05-11 16:51:47 EDT
(In reply to comment #20)
> Thanks, I really want to get VEX going and improving. I would gladly like to be
> a committer, is there special/particular expectations on that?
Fine, the family is growing ;)

There are tons of information about "being a committer". A good entry point is here http://www.eclipse.org/legal/committerguidelines.php and here http://www.eclipse.org/legal/newcommitter.php

I will start your nomination...
Comment 22 Holger Voormann CLA 2010-05-11 17:19:10 EDT
(In reply to comment #20)
> Thanks, I really want to get VEX going and improving.
> I would gladly like to be a committer,
> is there special/particular expectations on that?
>
Yes, you have to spell Vex with lower-case "ex". ;-)

I知 happy to see that you are going to become a committer for Vex.

One question about your 2nd patch:
Have you recreated the model (package: ...provisional.dom.I/impl) or edit it manually?

I will review the patch but probably this will take some time...
Comment 23 Igor Jacy Lino Campista CLA 2010-05-11 17:31:24 EDT
(In reply to comment #22)

Ahh, ok. :)


The model was recreated, no manual thing done besides the using the EMF ecore editor. (all under emf-src is the by-product, looks like some cosmetical simplifications were done there automatically)
Comment 24 Holger Voormann CLA 2010-05-17 12:55:40 EDT
(In reply to comment #19)
2nd patch reviewed and applied.

Thank you for the contributions. I'm happy that you become a committer. :-))
Comment 25 Florian Thienel CLA 2011-06-02 05:22:26 EDT
Closing resolved bugs.
Comment 26 Florian Thienel CLA 2011-11-09 17:37:31 EST
Moved to Mylyn Docs Vex.