eclipse-jdt / eclipse.jdt.debug

Eclipse Public License 2.0
16 stars 46 forks source link

Support JEP 445 main methods #326

Closed akurtakov closed 10 months ago

akurtakov commented 11 months ago

What it does

Using isMainMethodCandidate ensures there is at least one main method so JVM will be able to launch.

How to test

Create a class with public/protected/default non-static main method with or without String[] args and verify that Run As/Debug As works.

Author checklist

akurtakov commented 11 months ago

One step further in making https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1106 usabel in the IDE.

iloveeclipse commented 11 months ago

@akurtakov : can you please add a test that launches "simple modern" main? It should fail without your patch.

akurtakov commented 11 months ago

So there are no specific test plugins for debug.ui or launching plugins. Do I assume correct that https://github.com/eclipse-jdt/eclipse.jdt.debug/blob/master/org.eclipse.jdt.debug.tests is the place to put such tests or should I start new dedicated bundles?

akurtakov commented 11 months ago

Some hints where exactly to put such tests in the current structure would be much appreciated.

iloveeclipse commented 11 months ago

So there are no specific test plugins for debug.ui or launching plugins. Do I assume correct that https://github.com/eclipse-jdt/eclipse.jdt.debug/blob/master/org.eclipse.jdt.debug.tests is the place to put such tests

Right. Briefly looking at it, something similar to org.eclipse.jdt.debug.tests.breakpoints.MiscBreakpointsTestsor org.eclipse.jdt.debug.tests.launching.LongClassPathTests - they use org.eclipse.jdt.debug.tests.AbstractDebugTest.launchAndXXX() API. But maybe you can find a better test for inspiration.

iloveeclipse commented 11 months ago

Some hints where exactly to put such tests in the current structure would be much appreciated.

Somewhere at org.eclipse.jdt.debug.tests.launching

akurtakov commented 10 months ago

This proves that instance main methods are called. I don't think it's needed to repeat the extensive tests as done in jdt.core as the debug code actually calls isMainMethodCandidate which is extensively tested in core.

iloveeclipse commented 10 months ago

This proves that instance main methods are called. I don't think it's needed to repeat the extensive tests as done in jdt.core as the debug code actually calls isMainMethodCandidate which is extensively tested in core.

Sure. Unfortunately both new tests fail: https://ci.eclipse.org/jdt/job/eclipse.jdt.debug-github/job/PR-326/6/#showFailuresLink

akurtakov commented 10 months ago

Sure. Unfortunately both new tests fail: https://ci.eclipse.org/jdt/job/eclipse.jdt.debug-github/job/PR-326/6/#showFailuresLink

I'm trying to figure out why it's not using Java 21 .

akurtakov commented 10 months ago

So the failure is due to:

Loading trusted files from base branch master at dc3a1d9b6ba09c2931ad39487bfa4506fe360152 rather than f44e7e2fde7b33b39eb257bff065ba89859f2c01
Obtained Jenkinsfile from dc3a1d9b6ba09c2931ad39487bfa4506fe360152
‘Jenkinsfile’ has been modified in an untrusted revision

As I not a committer my change to Jenkinsfile is simply ignored. @jjohnstn @rgrunber Would you please push the Jenkinsfile change in its own PR so I care rebase this one on top of it?

akurtakov commented 10 months ago

@jjohnstn Thanks for the fast jenkinsfile change. This PR is ready for review now.

akurtakov commented 10 months ago

@iloveeclipse As you already looked at this one do you want to finish the review?