You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed the following error that happens not all the time, but randomly. Which is super confusing:
'org.eclipse.m2e.core.project.IMavenProjectFacade[] org.eclipse.m2e.core.project.IMavenProjectRegistry.getProjects()'
java.lang.NoSuchMethodError: 'org.eclipse.m2e.core.project.IMavenProjectFacade[] org.eclipse.m2e.core.project.IMavenProjectRegistry.getProjects()'
at org.sonarlint.eclipse.m2e.internal.MavenUtils.getProjectSubProjects(MavenUtils.java:159)
at org.sonarlint.eclipse.m2e.internal.MavenModuleFilter.getSubProjects(MavenModuleFilter.java:100)
at org.sonarlint.eclipse.core.internal.backend.FileSystemSynchronizer.getSubProjects(FileSystemSynchronizer.java:270)
at org.sonarlint.eclipse.core.internal.backend.FileSystemSynchronizer$1.run(FileSystemSynchronizer.java:116)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
For every project we run the following method and even with debugging it only happens very sporadically and doesn't look deterministic.
publicstaticCollection<ISonarLintProject> getProjectSubProjects(ISonarLintProjectproject) {
varmodules = newArrayList<ISonarLintProject>();
varprojectManager = MavenPlugin.getMavenProjectRegistry();
// If an exception is thrown here due to the SonarLintUtils.adapt(...) returning null, something must be broken on// the IDE side as isPartOfHierarchy(...) already made that adaption and the contract is to call it prior to// calling this method!varslProject = SonarLintUtils.adapt(project.getResource(), IProject.class,
"[MavenUtils#getProjectSubProjects] Try find Eclipse from '" + project.getName() + "'");
varprojectFacade = projectManager.create(slProject, null);
if (projectFacade == null) {
returnmodules;
}
try {
varparentProject = projectFacade.getMavenProject(null);
for (varmavenProjectFacade : projectManager.getProjects()) {
varmavenProject = mavenProjectFacade.getMavenProject(null);
if (checkIfPossibleParentProject(mavenProject, parentProject)) {
varpossibleSlProject = SonarLintUtils.adapt(mavenProjectFacade.getProject(), ISonarLintProject.class,
"[MavenUtils#getProjectSubProjects] Try get SonarLint project from '" + mavenProject.getName() + "'");
if (possibleSlProject != null) {
modules.add(possibleSlProject);
}
}
}
} catch (Exception | NoSuchMethodErrorex) {
SonarLintLogger.get().error(ex.getMessage(), ex);
}
returnmodules;
}
I now put the NoSuchMethodError in the catch block. As I said, for some projects, it has no problems, but rarely it fails. It happens on all the following Eclipse IDE versions and m2e:
Eclipse IDE 4.31 / 4.32 / 4.33 iBuilds
m2e 2.6.0.20240220-1109 / 2.6.2.20240820-2239
Does this ring a bell? For me it doesn't make any sense as the method should be there. For new and older versions of m2e.
Best,
Tobias
The text was updated successfully, but these errors were encountered:
I changed the code to the following, and at least from running it like 100 times for now, it didn't appear again. I have little to no clue why it thought that we wanted to have an array as a return value instead of the List<...> 😕
Compiled against a newer Version of m2e and ran with an older one. Or Vice versa.
The signature was changed somewhere along the way from IMavenProjectFacade[] to List<IMavenProjectFacade>.
I‘ll close this now, but thanks for the hint nevertheless.
Hey everyone,
I noticed the following error that happens not all the time, but randomly. Which is super confusing:
For every project we run the following method and even with debugging it only happens very sporadically and doesn't look deterministic.
I now put the
NoSuchMethodError
in the catch block. As I said, for some projects, it has no problems, but rarely it fails. It happens on all the following Eclipse IDE versions and m2e:Does this ring a bell? For me it doesn't make any sense as the method should be there. For new and older versions of m2e.
Best,
Tobias
The text was updated successfully, but these errors were encountered: