Skip to content

Commit 57cb548

Browse files
committed
Fix ClassCastException
Fix ClassCastException (not tested!). See Stack Overflow question 78834435: https://stackoverflow.com/q/78834435/6505250 Stack trace (`eclipse.buildId=4.32.0.20240606-1231`): ``` java.lang.ClassCastException: class org.eclipse.jdt.internal.core.JavaNature cannot be cast to class org.eclipse.jdt.core.IJavaProject (org.eclipse.jdt.internal.core.JavaNature and org.eclipse.jdt.core.IJavaProject are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @529500a7) at org.hibernate.eclipse.console.wizards.NewConfigurationWizard.init(NewConfigurationWizard.java:325) at ... ``` Signed-off-by: Holger Voormann <[email protected]>
1 parent 43bcf10 commit 57cb548

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: orm/plugin/core/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public void init(IWorkbench workbench, IStructuredSelection selection) {
322322
if (selection.getFirstElement() instanceof IProject){
323323
try {
324324
if (((IProject)selection.getFirstElement()).getNature(JavaCore.NATURE_ID) != null) {
325-
jproj = (IJavaProject)((IProject)selection.getFirstElement()).getNature(JavaCore.NATURE_ID);
325+
jproj = JavaCore.create((IProject)selection.getFirstElement());
326326
}
327327
} catch (CoreException e) {
328328
HibernateConsolePlugin.getDefault().log(e);
@@ -362,4 +362,4 @@ public boolean canFinish() {
362362
return super.canFinish();
363363
}
364364

365-
}
365+
}

0 commit comments

Comments
 (0)