Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup] erefactor/EclipseJdt - Exit loop earlier #97

Merged
merged 1 commit into from Jun 10, 2021

Conversation

cal101
Copy link

@cal101 cal101 commented Mar 26, 2021

EclipseJdt cleanup 'BreakLoopEarly' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor

Comment on lines 194 to 199
for(IConsole element : manager.getConsoles()) {
if(this == element) {
exists = true;
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for(IConsole element : manager.getConsoles()) {
if(this == element) {
exists = true;
break;
}
}
exists = Arrays.asList(ConsolePlugin.getDefault().getConsoleManager().getConsoles()).contains(this);
if(this == element) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I just looked at correctness.
Will fix at the weekend.
I wonder why we have Arrays.fill but no Arrays.contains.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refuse to do that without an IDE.

So I tried again opening m2e, this time in eclipse jee 2021-03, different error this time but far from anything usable.

2 hours wasted for nothing. Giving up.

Starting with vanilla eclipse jee 2021-03

export JAVA_HOME=/usr/lib/jvm/openjdk-11
PATH=${JAVA_HOME}/bin:${PATH}

git checkout -b BreakLoopEarlyCleanUp-manual origin/erefactor/master-project/1/jdt/jdt-BreakLoopEarlyCleanUp

Following https://www.eclipse.org/m2e/documentation/m2e-development-environment.html

eclipse-2021-03

New workspace: workspace-2021-03-m2e-core

Because it's jee eclipse I expect m2e and git integration to be present.

Trying to install "Logback Classic Module"

Help / Install New Software

Add "Orbit" Repository as I understand the docs:

    Orbit, https://download.eclipse.org/tools/orbit/downloads/

Error: No software site found.

Maybe:
    Orbit, https://download.eclipse.org/tools/orbit/downloads/2021-03/

Seems to work.

    Unmark "Hide items already installed"

    Select Logback Classic Module 1.2.3 ...

    Next

    Your original request has been modified.
    "Logback Classic Module" is already present because other installed software requires it.  It will be added to the installed software list.
    
    Cancel

git Submodules.
    How to check out THIS project with sub modules?

        git submodule init
        git submodule update


    How to make sure versions match?
        hopefully empty git status is sufficient.

File / Import / Existing Maven Projects

    Next
    Selecting checkout dir as root directory
    Deselect all
    Select m2e-maven-runtime and all 4 sub projects
    Finish

    No error markers.

File / Import / Existing Maven Projects

    Next
    Selecting checkout dir as root directory
    "Selecting everything under m2e-core"
    Guessing that does not mean org.eclipse.m2e.core but the root pom.xml
    Let everything being included, exclude m2e-core-tests tree.

    Finish.

Eclipse is asking to "Setup Maven plugin connectors"
    
    Leave all marked.
    Finish

    Install (all)
        - m2e connector for modello
        - m2e connector for the Maven Dependency Plugin
        - Tycho Project Configurators
    Next
    Review
    Next
    Accept License
    Finish

Eclipse is "Installing Software"
Requestor: "unsigned software to be installed ..."
    Install anyway

Restart Eclipse IDE to apply the software update?
    Restart Now

Change Buildpath of 
     "org.eclipse.m2e.tests.common"

How ???

Seems the sub project was NOT imported as a maven project because it was not offered.

Maybe we need newer m2e?

Help / Install New Software

    Add M2E Releases, http://download.eclipse.org/technology/m2e/releases

    Select 1.15.0.... of m2e and m2e-slf4j

    Next

    Cannot complete the request.  See the error log for details.
"m2e - slf4j over logback logging (Optional)" will be ignored because a newer version is already installed. 
"m2e - Maven Integration for Eclipse (includes Incubating components)" will be ignored because a newer version is already installed. 


*** OK, let's ignore the buildpath of "org.eclipse.m2e.tests.common".

"Update the maven project configuration for all projects and do a clean build."

Hmm OK, let's hope that means selecting "m2e-core / Maven / Update Project"
and selecting all projects (note that "org.eclipse.m2e.tests.common" is missing from that list)
and leaving all other values default
and clicking OK.

eclipse: "Updating Maven Project"

475 Errors.

Project / Clean
    Clean all projects
    Clean

"You may need to Update Maven (forcing update of snapshot releases) and do Project/Clean…/Clean_all_projects
 to clear all compilation errors."

Hmm how to "Update Maven"?

Guess that means the system installed maven.

mvn --version
Apache Maven 3.6.0

Latest version is 3.6.3, let's try to use that.
(If maven version is so important, why not use mvn wrapper?)

wget https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

mkdir ~/cal01/local
tar -C ~/cal01/local/ -zxvf apache-maven-3.6.3-bin.tar.gz
PATH=~/cal01/local/apache-maven-3.6.3/bin:${PATH}

mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

How to tell eclipse?

They would tell if anything is needed, yes?
Let's just exit and start eclipse again.

eclipse-2021-03

Project / Clean / Clean all

469 Errors.

Let's call that progress.

Project / Clean / Clean all

469 Errors.

Let's ask google how and if to configure maven in eclipse.

First hit: maven-in-eclipse-step-by-step-installationA

"Despite an honest effort, I have been unable to find a comprehensive tutorial on any Maven plugin. M2E, which seems like the de facto standard,
 has nothing but broken (or recursive) links on their site."

A quite old quote from that SO post but I feel it.

"After successful installation do the followings in Eclipse:

Go to Window --> Preferences
Observe, Maven is enlisted at left panel"

Let's take a look:

    No maven binary configured at that location.

m2e-core / Maven / Update Project

Project / Clean / Clean all

469 Errors.

Giving up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that.
Can you please post to m2e-dev@eclipse.org to get assistance on that matter? This document is probably out of date and we should discuss its update (or replacement) on the mailing-list.
For this case, assuming your IDE does contain a snapshot version of m2e and your current runtime IDE is used as target platform, you only need to open the project you're willing to modify (org.eclipse.m2e.core.ui), dependencies will be resolved against your current IDE and you shouldn't see so many warnings.

Copy link
Author

@cal101 cal101 Apr 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least I was able to open eclipse with the project containing is file now following the CONTRIBUTING.md.
Thanks for updating that.

Still having 32 errors when trying to open all projects but ignoring those.

@cal101 cal101 force-pushed the jdt-BreakLoopEarlyCleanUp branch 4 times, most recently from 3144891 to 5ed9d9f Compare March 31, 2021 10:10
@vogella
Copy link
Contributor

vogella commented Apr 13, 2021

@cal101 the exit loop cleanup was improved in 4.20, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=572048. You could updated your SDK to the latest I-Build to benefit from this fix. See https://download.eclipse.org/eclipse/downloads/

If you find more issues with the cleanups in the latest I-Build please report to JDT and cc Fabrice Tiercelin. Fabrice is actively enhancing and fixing the cleanups.

@cal101
Copy link
Author

cal101 commented Apr 30, 2021

@vogella Thanks for caring. I am in contact with the AutoRefactor-Project for quite some years now and already reported quite some bugs in the past.
Not much time for refactoring at the moment so I didn't try the latest I-Build but I am aware of using the I-builds and the run that created this commit originally already used the latest i-build at that time.
Fabrice Tiercelin is doing a great job migrating the AutoRefactor cleanups and fixing eclipse ones.
I didn't report to eclipse bugzilla yet but reported to the AutoRefactor project instead and Fabrice Tiercelin transferred as needed.
When our company moved away from bugzilla maybe 10 years (?) ago I didn't missed it.

P.S. Your web site is a great source of information describing how to do a lot of things in a very good way. But for me not having followed eclipse stuff in detail for quite some years I often found myself wondering WHY something should be done and what the deeper goal of something is.

@mickaelistria
Copy link
Contributor

@cal101 What's the state here? Did you rebase on top of recent change from @HannesWell to simplify import of the project?

@cal101 cal101 force-pushed the jdt-BreakLoopEarlyCleanUp branch from 8a39968 to 56881be Compare June 1, 2021 16:08
@cal101
Copy link
Author

cal101 commented Jun 1, 2021

I rebased Apr 30, but now I did it again.

@cal101 cal101 force-pushed the jdt-BreakLoopEarlyCleanUp branch 2 times, most recently from f367b28 to 119284f Compare June 9, 2021 16:25
Manual cleanup based on EclipseJdt cleanup 'BreakLoopEarly' applied by erefactor.

For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php
For erefactor see https://github.com/cal101/erefactor

Signed-off-by: Carsten Heyl <cal-1@web.de>
@cal101 cal101 force-pushed the jdt-BreakLoopEarlyCleanUp branch from 119284f to f72f6a6 Compare June 10, 2021 06:58
@mickaelistria mickaelistria merged commit 3a20916 into eclipse-m2e:master Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants