Skip to content

'....PackageFragment cannot be cast to org.eclipse.jdt.core.IType' error when running 'net.sf.j2s.test.junit' as Java2Script Unit Test  #16

@abego

Description

@abego

Steps to reproduce

In Eclipse Package Explorer:

  • Right-Click package 'net.sf.j2s.test.junit'
  • Select 'Run As > Java2Script Unit Test'

A 'Problem occured' dialog appears with the message:

'Launching net.sf.j2s.test.junit' has encountered a problem

An internal error occurred during: "Launching net.sf.j2s.test.junit".
org.eclipse.jdt.internal.core.PackageFragment cannot be cast to org.eclipse.jdt.core.IType

The error log contains this entry:

!MESSAGE An internal error occurred during: "Launching net.sf.j2s.test.junit".
!STACK 0
java.lang.ClassCastException: org.eclipse.jdt.internal.core.PackageFragment cannot be cast to org.eclipse.jdt.core.IType
at net.sf.j2s.ui.launching.J2SLaunchingUtil.launchingJ2SUnit(J2SLaunchingUtil.java:149)
at net.sf.j2s.ui.launching.J2SUnitConfigurationDelegate.launch(J2SUnitConfigurationDelegate.java:21)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

(Running individual test classes works fine)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions