Poll: Duplocator

Hello everyone,

Have you ever tried to find duplicates in your code within IntelliJ IDEA?
Do you use similar functionality in TeamCity?

Thank you.

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"


16 comments
Comment actions Permalink

Have you ever tried to find duplicates in your code within IntelliJ
IDEA?

Yes. Especially when the code is from someone else :).

Do you use similar functionality in TeamCity?

No. Somehow it doesn't feel naturally(at least to me) for CI server to
do such tasks (maybe for other users that don't have IntelliJ it makes more sense).

Ahmed.

0
Comment actions Permalink

I didn't use it in IntelliJ so far because I think this task is much better suited for a build server (e.g. running at night).
I tried once how this would look&feel in Agra, but I ran into TW-2191

Why do you ask?

0
Comment actions Permalink

Hello Tobias,

Thank you.

We do not have any feedback (except TW-2191) on duplicates finder and we
do not think that this silence is a sign of perfect done feature. We want
to improve a situation.

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

I didn't use it in IntelliJ so far because I think this task is much
better suited for a build server (e.g. running at night).

I tried once how this would look&feel in Agra, but I ran into TW-2191

Why do you ask?



0
Comment actions Permalink

I tried both, in Idea and in TC. However, in TC it does not show anything in Web, there is a bug reported. Also, I tried to click in TC Web UI to open these files in IDE (I downloaded the Idea plugin first) bug again - nothing happened.

Also, I tried to download Eclipse plug-in, but it was even worse. Seems that TC does not even support openning files from Inspections. Duplications did not work either. I'm waiting for the fix to try it again..

0
Comment actions Permalink

Yes, and Yes (although I haven't used TeamCity with Selena yet, so I can't comment on the new integration).

The duplicate locator is very nice, but would be about a zillion times nicer if the duplications found were actionable. It should be possible to trigger sets of refactorings to remove the duplications (Extract Method, Extract Superclass, Pull Members Up, Add/Remove Type Parameter, Weaken Type, etc.). I know it's a hard problem, but it's very much one worth solving. Another improvement would be finding not just duplicate fragments, but duplicate methods or classes.

--Dave Griffith

0
Comment actions Permalink

Hello Dave,

Yes, and Yes (although I haven't used TeamCity with Selena yet, so I
can't comment on the new integration).

The duplicate locator is very nice, but would be about a zillion times
nicer if the duplications found were actionable. It should be
possible to trigger sets of refactorings to remove the duplications
(Extract Method, Extract Superclass, Pull Members Up, Add/Remove Type
Parameter, Weaken Type, etc.). I know it's a hard problem, but it's
very much one worth solving. Another improvement would be finding not
just duplicate fragments, but duplicate methods or classes.


It is already planned for M2.

Thank you.

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"


0
Comment actions Permalink

Anna Kozlova wrote:

Have you ever tried to find duplicates in your code within IntelliJ
IDEA? Do you use similar functionality in TeamCity?


I just tried it in TC and happened to run it on a project with a bunch of
generated webservice-client classes. The TC-runner definitely needs a
possibility to limit the analysis to a certain scope that allows to exclude such
code.

Also, the naming of the options should be consistent in IDEA and TC. The
"Detalization level" options in TC are inverted from the ones in IDEA (I
actually find "anonymization" used in IDEA easier to understand than
"detalization") while the other two options are IMO more clearly described in
the TC UI.

Sascha

0
Comment actions Permalink

Hello Sascha,

Anna Kozlova wrote:

>> Have you ever tried to find duplicates in your code within IntelliJ
>> IDEA? Do you use similar functionality in TeamCity?
>>

I just tried it in TC and happened to run it on a project with a bunch
of generated webservice-client classes. The TC-runner definitely needs
a possibility to limit the analysis to a certain scope that allows to
exclude such code.


As workaround: You will be able to add pre/post ant scripts for Duplicates
Finder as well as Inspections and Ipr runner.

We have corresponding issue for Inspections : http://jetbrains.net/jira/browse/TW-1452

Also, the naming of the options should be consistent in IDEA and TC.
The "Detalization level" options in TC are inverted from the ones in
IDEA (I actually find "anonymization" used in IDEA easier to
understand than "detalization") while the other two options are IMO
more clearly described in the TC UI.


"Distinguish"?

Thank you.

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"


0
Comment actions Permalink

Outstanding!

--Dave Griffith

0
Comment actions Permalink

For what it's worth, I have "Java envy" about this feature since our code is C#. Is JetBrains planning to implement duplicate detection for C#, either in ReSharper or TeamCity?

0
Comment actions Permalink

Hello,

I think its quite possible.

Thank you

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

For what it's worth, I have "Java envy" about this feature since our
code is C#. Is JetBrains planning to implement duplicate detection for
C#, either in ReSharper or TeamCity?



0
Comment actions Permalink

Better late than never, but I just started playing with this functionality.

Anna Kozlova wrote:

Have you ever tried to find duplicates in your code within IntelliJ
IDEA?


Only locally within a file for testing

Do you use similar functionality in TeamCity?


I tried, but on our medium-small project (15 modules, 10,000 classes) it
keeps running out of memory (I got up to 3G before I terminated the
experiment).

R

0
Comment actions Permalink

Hello Robert,

Could you please set up Xmx500m - seems that it is again problem with GC.

We've run duplicates finder over idea project ;)

Thank you.

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Better late than never, but I just started playing with this
functionality.

Anna Kozlova wrote:

>> Have you ever tried to find duplicates in your code within IntelliJ
>> IDEA?
>>

Only locally within a file for testing

>> Do you use similar functionality in TeamCity?
>>

I tried, but on our medium-small project (15 modules, 10,000 classes)
it keeps running out of memory (I got up to 3G before I terminated the
experiment).

R



0
Comment actions Permalink

Hello Anna,

I took your advice and set up 500M as the maximum heap, but I got
an OOM error after 36% of the analysis.

Since I'm running under 1.6, I also have a hprof dump - is it worth
opening a JIRA ticket and uploading the snapshot? Or is there anything
else I should be trying? (Note that my agents are 64-bit machines, so
my first thought was that 500M is perhaps a 32-bit suggestion and I
should try 1G, but it still crashes, although this time after 51% of the
analysis.)

Thanks for your help,
Robert

Anna Kozlova wrote:

Hello Robert,

Could you please set up Xmx500m - seems that it is again problem with GC.
We've run duplicates finder over idea project ;)

Thank you.


0
Comment actions Permalink

Hello Robert,

Please upload your snapshot to ftp://intellij.net/.uploads (500m otherwise
I won't have a chance to analyse it)

Thank you.

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Hello Anna,

I took your advice and set up 500M as the maximum heap, but I got an
OOM error after 36% of the analysis.

Since I'm running under 1.6, I also have a hprof dump - is it worth
opening a JIRA ticket and uploading the snapshot? Or is there
anything else I should be trying? (Note that my agents are 64-bit
machines, so my first thought was that 500M is perhaps a 32-bit
suggestion and I should try 1G, but it still crashes, although this
time after 51% of the analysis.)

Thanks for your help,
Robert
Anna Kozlova wrote:

>> Hello Robert,
>>
>> Could you please set up Xmx500m - seems that it is again problem with
>> GC. We've run duplicates finder over idea project ;)
>>
>> Thank you.
>>


0
Comment actions Permalink

Hello Anna,

java_pid1987.hprof uploaded. I also opened a JIRA issue
http://www.jetbrains.net/jira/browse/TW-2744

Hope that's helpful,
Robert

Anna Kozlova wrote:

Hello Robert,

Please upload your snapshot to ftp://intellij.net/.uploads (500m
otherwise I won't have a chance to analyse it)

Thank you.

---------------------
Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.