Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Using '*' for java imports

Hi kessel,

I have made a patch for a CDT Oomph setup, available here:
https://git.eclipse.org/r/#/c/39617/

It needs a few tweaks (Mars target) but it should be available in the catalog soon.

For the Organize Import preference, it is not necessary to use Oomph because that preference can already be set per project and committed to the repository (.settings folders). I think it would be good to agree on such preferences and properly set up all the projects settings in the CDT repo. In the Trace Compass project, we use a little script to synchronize all the projects settings, it could probably be reused for CDT. http://git.eclipse.org/c/tracecompass/org.eclipse.tracecompass.git/tree/sync_settings.sh

Marc-Andre


From: cdt-dev-bounces@xxxxxxxxxxx [cdt-dev-bounces@xxxxxxxxxxx] on behalf of kesselhaus [kesselhaus@xxxxxxx]
Sent: Monday, 19 January 2015 7:55 PM
To: cdt-dev@xxxxxxxxxxx
Subject: Re: [cdt-dev] Using '*' for java imports

Hi gang,

Just a suggestion out if the Eclipse news.
There's that new Oomph project, which seems to receive a lot of attention about how to setup and contribute to eclipse projects.
Not sure, if someone did it already, but would it help CDT too, if someone would gather/prepare these styles and guidelines by a Oomph-setup?

Regards,
kessel


Am 19.01.2015 um 17:44 schrieb Alena Laskavaia:
+1 for using "Organize Imports". I think people should enabled this as save action.

On Mon, Jan 19, 2015 at 11:34 AM, Marc Khouzam <marc.khouzam@xxxxxxxxxxxx> wrote:
I wasnt' suggesting going through CDT's code to clean that up :)
Maybe just a recommendation to avoid using import wildcards.
Actually, the recommendation should be to use Eclipse's automatic import feature (ctrl-sht-O) all the time.  That will avoid a rearrangement of imports when some other change is made by someone else.


From: cdt-dev-bounces@xxxxxxxxxxx [dschaefer@xxxxxxx]
Sent: January 19, 2015 11:09 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Using '*' for java imports


From: Marc Khouzam <marc.khouzam@xxxxxxxxxxxx>
Reply-To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Date: Monday, January 19, 2015 at 11:02 AM
To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Subject: Re: [cdt-dev] Using '*' for java imports

I believe using wildcards for imports can, in some cases, cause issues.
http://www.coderanch.com/how-to/java/WildCardVsSpecificImports
http://stackoverflow.com/questions/147454/why-is-using-a-wild-card-with-a-java-import-statement-bad/147461#147461

This question should not apply to CDT in general if we we use Ctrl-Shift-O to manage our imports since Eclipse won't use wildcards unless you have more than 99 similar imports.  I think there is only one file were that happens, which triggered Elena's question.

I agree not to ask people to change their settings.  For that one file, I'll probably change it back myself when I notice it, but I won't ask others to do it.

Now, to my surprise, I do see that wildcards are used once in a while in CDT for imports.  Those are imports that were included by hand.  I think we should avoid those as a general rule.

I'd would suggest CDT not uses wilcards for imports unless Eclipse does it itself using Ctrl-Shift-O.  This addresses Elena's concern, and makes the code more robust.

Opinions?

Does it really make the code more robust? I just want to make sure if we’re going to spend a lot of time on an issue, that it’s a real issue.

Doug.



Marc




From: cdt-dev-bounces@xxxxxxxxxxx [elaskavaia.cdt@xxxxxxxxx]
Sent: January 19, 2015 10:24 AM
To: Doug Schaefer
Cc: CDT General developers list.
Subject: Re: [cdt-dev] Using '*' for java imports

Marc are you ok with that?

On Mon, Jan 19, 2015 at 9:54 AM, Doug Schaefer <dschaefer@xxxxxxx> wrote:
I just use the defaults. I have too many workspaces to be changing settings other than getting my emacs keys turned on.

We have no official rules. I think we’re all to busy with the little time we have working on fixing up and growing the CDT to worry much about that. The defaults are fine.

Doug.

From: Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx>
Reply-To: "elaskavaia.cdt@xxxxxxxxx>
Date: Saturday, January 17, 2015 at 8:55 AM
To: Doug Schaefer <dschaefer@xxxxxxx>
Cc: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Subject: Re: [cdt-dev] Using '*' for java imports

Do you edit default eclipse settings for "Organize Import"?
I do Organize imports too and it collapses them into * if I have more than 99 import, which is default.
So what is our "official" rule for that?

On Fri, Jan 16, 2015 at 10:00 PM, Doug Schaefer <dschaefer@xxxxxxx> wrote:
I always do an Organize Imports when I edit a file. My experience is that gets rid of the '*'s. So if it's a file I'm editing, the *'s won't last long.

Doug.

From: Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx>
Date: Fri Jan 16 2015 20:54:49 GMT-0500 (EST)
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
Subject: [cdt-dev] Using '*' for java imports

Marc told me (on review) that we don't using '*' for imports, I checked our code
style and it is not documented anywhere https://wiki.eclips ​ e.org/CDT/policy#Cod ​e_Formatting
It does say though that we use default Eclipse formatting. By default eclipse folds imports into * if you have more then 99 imports (that was the case I had). Unless it is really needed I would not
be a fan of changing eclipse defaults, i.e. we should allow fold imports if more than 99.
Anybody have strong objections to do otherwise?



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top