[ 
https://issues.apache.org/jira/browse/CAMEL-4796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Babak Vahdat updated CAMEL-4796:
--------------------------------

    Attachment: CAMEL-4796-@Deprecated-@Override.patch

Attached please find the next patch in the series regarding the usage of the 
@Deprecated & @Override annotations. I admit that this patch is pretty big 
*BUT* IMHO it's verification
could be done in some extend *automatically / easier*:

{code}
$> grep "+   "  CAMEL-4796-@Deprecated-@Override.patch | less
{code}

Then you will see by more than 95% only the lines like:

{code}
+    @Override
+    @Override
+    @Override
+    @Deprecated
+    @Override
+    @Override
+            @Override
+        @Override
+    @Override
+    @Deprecated
+                    @Override
+    @Override
+        @Override
+    @Override
+    @Override
+            @Override
+        @Override
+    @Override
+    @Override
+    @Override
+    @Deprecated
+            @Override
+    @Override
+            @Override
+            @Override
+                    @Override
+        @Override
{code}

However you will still catch some lines like:

{code}
+    @Override
+      @Override
+    protected 
org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person 
internalGetResult() {
+      @Override
+    public Builder clear() {
+      @Override
+    public Builder clone() {
+      @Override
+    public com.google.protobuf.Descriptors.Descriptor
+      @Override
+    public 
org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person 
getDefaultInstanceForType() {
+      @Override
+    public boolean isInitialized() {
+      @Override
+    public 
org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person build() 
{
+      @Override
+    public 
org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.Person 
buildPartial() {
+      @Override
+    public Builder mergeFrom(com.google.protobuf.Message other) {
+      @Override
+    public Builder mergeFrom(
+    @Override
+    @Override
+    @Override
+    @Override
+    @Override
+    @Override
+    @Override
+      @Override
+    protected 
org.apache.camel.dataformat.protobuf.generated.AddressBookProtos.AddressBook 
internalGetResult() {
+      @Override
{code}

where unfortunately you would have to verify it manually/visually :-(

So to check such lines doing:

{code}
grep "+   "  CAMEL-4796-@Deprecated-@Override.patch | grep -v @Override | grep 
-v @Deprecated
{code}

Should do the trick, which are really not too much lines (only 85 lines):

{code}
grep "+   "  CAMEL-4796-@Deprecated-@Override.patch | grep -v @Override | grep 
-v @Deprecated | wc -l
{code}

Other than add of the missing @Override & @Deprecated annotations there's *one* 
semantic change I also made by the class

{code}
org.apache.camel.management.mbean.ManagedRoute
{code}

I commented on the last revision on this [1] however didn't hear anything from 
Dan in @Dev Forum. Later on however we exchaneged some mails between me and him
and talked about all other possible stuff but not really about his revision. If 
the commiter who intends to apply this patch doesn't agree with me on this then
simply skip the change on this class :-(

Also please note that the semantics of the @Override annotation has been 
extended by the JDK 1.5 ==> JDK 1.6 transition [2]. The javadoc in JDK 1.6 
doesn't reflect this
fact but the JDK 1.7 [3] does it! So if we claim that we use/rely on JDK 1.6+ 
then IMHO we should respect it's *complete* semantics as well.

[1] 
http://camel.465427.n5.nabble.com/The-last-revision-on-the-ManagedRoute-shutdown-JMX-API-td5098934.html#a5102867
[2] http://blogs.oracle.com/ahe/entry/override_snafu
[3] http://docs.oracle.com/javase/7/docs/api/java/lang/Override.html

                
> Code Clean-Up
> -------------
>
>                 Key: CAMEL-4796
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4796
>             Project: Camel
>          Issue Type: Improvement
>    Affects Versions: 2.8.3
>            Reporter: Babak Vahdat
>            Assignee: Babak Vahdat
>             Fix For: 2.9.1, 2.10
>
>         Attachments: CAMEL-4796-@Deprecated-@Override.patch, 
> CAMEL-4796-enhanced-for-loops.patch, CAMEL-4796-obsolete-super-call.patch, 
> CAMEL-4796-organize-imports-2.patch, CAMEL-4796-organize-imports.patch, 
> CAMEL-4796-remove-$NON-NLS$.patch, CAMEL-4796-remove-unnecessary-casts.patch
>
>
> This ticket aims to resolve the issues already mentioned in [1], but just to 
> name them ALL explicitly here:
> - Removal of the unused imports
> - Convert for loops to the enhanced one (supported since Java Tiger)
> - Removal of the obsolete "super();" call by the Constructors (Since JDK 1.0 
> compilers already do it inside the byte-code for free!)
> - Remove of all $NON-NLS$ tags
> - Removal of the unnecessary casts
> - Usage of the @Deprecated & @Override annotations where required
> - Avoidance of the raw type declarations by the generified classes *as much 
> as possible*
> - Removal of unused private memebers: Types, Constructors, Fields and Methods 
> where applicable
> - Remove the trailing whitespace on *all* lines, even on the empty ones
>     
> Add of missing serialVersionUID where required and default it to *1L* where 
> serialVersionUID has been already declared should be better postponed to the 
> major 3.0.x release as otherwise the backward-compatility would be broken on 
> the 2.x.y release branches.
> If you can think of other possible clean-ups as well you may like to propose 
> for including, then please first better discuss it in [1] so that other 
> commiters can better/faster/easier react on it.
> I'll provide the patches *exactly in the same order* as mentioned above.
> Right now on the trunk my used IDE (eclipse) reports 1991 warnings!
> [1] 
> http://camel.465427.n5.nabble.com/DISCUSS-Trunk-Code-Cleanup-td5071594.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to