Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

added type exact add/remove methods. #3861

Merged
merged 1 commit into from
Jan 21, 2016
Merged

Conversation

kaikreuzer
Copy link
Member

resolves openhab/openhab-distro#101

Signed-off-by: Kai Kreuzer kai@openhab.org

resolves openhab/openhab-distro#101

Signed-off-by: Kai Kreuzer <kai@openhab.org>
@maggu2810
Copy link
Contributor

Do you like to add the "override" annotation?

@kaikreuzer
Copy link
Member Author

No, because it does not override but overload the method. In this case, this annotation isn't used, right?

@maggu2810
Copy link
Contributor

Okay, I have not known, that this is handled different for overloaded methods.
My settings in of the Eclipse IDE save actions / formatter will add "@OverRide" for overwritten and overloaded functions.
Also the annotation documentation does not differ here.

java.lang.Override
@target(value={METHOD})
@retention(value=SOURCE)
Indicates that a method declaration is intended to override a method declaration in a supertype. If a method is annotated with this annotation type compilers are required to generate an error message unless at least one of the following conditions hold:

  • The method does override or implement a method declared in a supertype.
  • The method has a signature that is override-equivalent to that of any public method declared in Object.

@kaikreuzer
Copy link
Member Author

My settings in of the Eclipse IDE save actions / formatter will add "@OverRide" for overwritten and overloaded functions.

Hm, I thought I am using the same formatter as you? Mine doesn't add it.

The method has a signature that is override-equivalent

So does this apply here? What does override-equivalent exactly mean...?

@maggu2810
Copy link
Contributor

Hm, I thought I am using the same formatter as you?

For ESH and OH2, but there are other projects and other formatters I am using. 😉
But I checked the save actions and "Add missing '@OverRide' annotations", "Add missing '@OverRide' annotations to implementations of interface methods" and "Add missing '@deprecated' annotations" is selected for the ESH and OH2 formatter, too.
Perhaps I am missing something (I tested it with two classes where the one defines a function foo and a child implements foo by calling super.foo()...).
Let's try me it with the Eclipse IDE and investigate what is the difference.

Two method signatures m1 and m2 are override-equivalent iff either m1 is a subsignature of m2 or m2 is a subsignature of m1. (https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.2)

@kaikreuzer
Copy link
Member Author

Which means that they are not override-equivalent, so not having the annotation is correct.

note that we are talking about the two methods foo(Class1 x)and foo(Class2 y), where Class2 extends Class1 - so their erasure is no the same.

@maggu2810
Copy link
Contributor

AbstractActiveBinding is using BindingProvider, HttpBinding is using HttpBindingProvider...
So all fine, nothing to complain 😉

@maggu2810
Copy link
Contributor

I will shut up and you can merge :)

kaikreuzer added a commit that referenced this pull request Jan 21, 2016
added type exact add/remove methods.
@kaikreuzer kaikreuzer merged commit 693a528 into openhab:master Jan 21, 2016
@kaikreuzer kaikreuzer deleted the http branch January 21, 2016 13:20
@watou watou added this to the 1.9.0 milestone Jan 30, 2016
@kaikreuzer kaikreuzer modified the milestones: 1.9.0, 1.9.0.b2 Feb 1, 2016
@watou watou mentioned this pull request Apr 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Erros logged when installing the HTTP binding in openHAB2
3 participants